CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Compiler Bug?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
bgpartri
Guest







Compiler Bug?
PostPosted: Sun Jul 27, 2003 3:26 pm     Reply with quote

Is there some reason this code should hang? Am I missing something?

#include <18f452.h>
#include <math.h>

void main(void){
float number_log;
number_log = log(2.0);
number_log += 1;
}

I just put the second executable statement in there so I could single step somewhere. It turns out it isn't needed, because it never returns from the log function.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516407
bgpartri
Guest







Re: Compiler Bug?
PostPosted: Sun Jul 27, 2003 5:24 pm     Reply with quote

The second include was supposed to be <math.h>.

Since my first post, I have found that exp doesn't work either.

:=Is there some reason this code should hang? Am I missing something?
:=
:=#include <18f452.h>
:=#include <math.h>
:=
:=void main(void){
:= float number_log;
:= number_log = log(2.0);
:= number_log += 1;
:=}
:=
:=I just put the second executable statement in there so I could single step somewhere. It turns out it isn't needed, because it never returns from the log function.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516408
bgpartri
Guest







Re: Compiler Bug?
PostPosted: Sun Jul 27, 2003 5:27 pm     Reply with quote

Very interesting. I guess <-m-a-t-h-.-h-> gets processed by something along the way to the list.


:=The second include was supposed to be <math.h>.
:=
:=Since my first post, I have found that exp doesn't work either.
:=
:=:=Is there some reason this code should hang? Am I missing something?
:=:=
:=:=#include <18f452.h>
:=:=#include <math.h>
:=:=
:=:=void main(void){
:=:= float number_log;
:=:= number_log = log(2.0);
:=:= number_log += 1;
:=:=}
:=:=
:=:=I just put the second executable statement in there so I could single step somewhere. It turns out it isn't needed, because it never returns from the log function.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516409
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

Re: Compiler Bug?
PostPosted: Sun Jul 27, 2003 8:24 pm     Reply with quote

You should add a while(1) to keep the processor from going to sleep.


:=Very interesting. I guess <-m-a-t-h-.-h-> gets processed by something along the way to the list.
:=
:=
:=:=The second include was supposed to be <math.h>.
:=:=
:=:=Since my first post, I have found that exp doesn't work either.
:=:=
:=:=:=Is there some reason this code should hang? Am I missing something?
:=:=:=
:=:=:=#include <18f452.h>
:=:=:=#include <math.h>
:=:=:=
:=:=:=void main(void){
:=:=:= float number_log;
:=:=:= number_log = log(2.0);
:=:=:= number_log += 1;
while(1);
:=:=:=}
:=:=:=
:=:=:=I just put the second executable statement in there so I could single step somewhere. It turns out it isn't needed, because it never returns from the log function.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516413
bgpartri
Guest







Re: Compiler Bug?
PostPosted: Sun Jul 27, 2003 8:51 pm     Reply with quote

Thanks. I don't think I would ever have figured that out.

I was still stumped for a while about why my real program still didn't work. I was not programming enough memory. For whatever reason, MPLAB didn't give me an error. It was falling off the end of the program in some way. That program did have a while(TRUE); at the end.

Anyway, its fixed now.

:=You should add a while(1) to keep the processor from going to sleep.
:=
:=
:=:=Very interesting. I guess <-m-a-t-h-.-h-> gets processed by something along the way to the list.
:=:=
:=:=
:=:=:=The second include was supposed to be <math.h>.
:=:=:=
:=:=:=Since my first post, I have found that exp doesn't work either.
:=:=:=
:=:=:=:=Is there some reason this code should hang? Am I missing something?
:=:=:=:=
:=:=:=:=#include <18f452.h>
:=:=:=:=#include <math.h>
:=:=:=:=
:=:=:=:=void main(void){
:=:=:=:= float number_log;
:=:=:=:= number_log = log(2.0);
:=:=:=:= number_log += 1;
:=while(1);
:=:=:=:=}
:=:=:=:=
:=:=:=:=I just put the second executable statement in there so I could single step somewhere. It turns out it isn't needed, because it never returns from the log function.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516415
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group