Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Problems with the implementation of the compiler optimization within Momentics 4.7.0 (maybe a bug??): (4 Items)
   
Problems with the implementation of the compiler optimization within Momentics 4.7.0 (maybe a bug??)  
I am using the QNX Momentics IDE (4.7.0 on Windows) and encountered the following problem which I assume to be a bug of 
the compiler.
When I am writing following in my C file (within a QNX C Project) …
static const float SQRT_2 = sqrt(2);
static float SQRT_2_DIV2 = SQRT_2/2.0;
(that way I try to avoid unnecessary calculation) … I get following error message from the compiler, which I see in the
 “Problems”-View …

initializer element is not constant.

while following line is undelined red ...
static float SQRT_2_DIV2 = SQRT_2/2.0;

Well, on one side I could take this but what I really do not understand is, why the compiler do not detect this “error
” when I compile the same code with a Level 3 optimization? I thought the optimization process is started after parsing
 and syntax validation and should not effect the syntax rules.

Would be glad about some help in this situation.

Ahh, and yes, I tried the -Wc,-std=c99 parameter in the compiler settings but what I get are more and more errors which 
seems to be absolute pointless because I have a good book in front of me where C99 is used and the compiler start to 
tell me that simply everything is false (sounds a bit nonprofessional but I see just red lines).
RE: Problems with the implementation of the compiler optimization within Momentics 4.7.0 (maybe a bug??)  
Hello Daniil

Sometimes the red lines are not coming from the compiler.  The C/C++ perspective has a syntax checker that is analyzing 
your code.  If the paths to compilers, libraries and header files are not set up properly than code that is valid may be
 marked as being in error.  You can turn this off by going to:

Window->preferences->C/C++->Code Analysis

And choosing what you want to report as a bug and what you don't want to report as a bug. 

Thanks,
Rodney

-----Original Message-----
From: Daniil Moerman [mailto:community-noreply@qnx.com] 
Sent: Thursday, September 13, 2012 7:41 AM
To: general-ide
Subject: Problems with the implementation of the compiler optimization within Momentics 4.7.0 (maybe a bug??)

I am using the QNX Momentics IDE (4.7.0 on Windows) and encountered the following problem which I assume to be a bug of 
the compiler.
When I am writing following in my C file (within a QNX C Project) … static const float SQRT_2 = sqrt(2); static float 
SQRT_2_DIV2 = SQRT_2/2.0; (that way I try to avoid unnecessary calculation) … I get following error message from the 
compiler, which I see in the “Problems”-View …

initializer element is not constant.

while following line is undelined red ...
static float SQRT_2_DIV2 = SQRT_2/2.0;

Well, on one side I could take this but what I really do not understand is, why the compiler do not detect this “error
” when I compile the same code with a Level 3 optimization? I thought the optimization process is started after parsing
 and syntax validation and should not effect the syntax rules.

Would be glad about some help in this situation.

Ahh, and yes, I tried the -Wc,-std=c99 parameter in the compiler settings but what I get are more and more errors which 
seems to be absolute pointless because I have a good book in front of me where C99 is used and the compiler start to 
tell me that simply everything is false (sounds a bit nonprofessional but I see just red lines).




_______________________________________________

General
http://community.qnx.com/sf/go/post95546
To cancel your subscription to this discussion, please e-mail general-ide-unsubscribe@community.qnx.com

Re: RE: Problems with the implementation of the compiler optimization within Momentics 4.7.0 (maybe a bug??)  
Sorry Rodney but I did not find the settings you mentioned ... I looked up the internet but there is no reference to 
such a configuration window. But your idea of warnings that become into errors sounds reasonable. I still assume that 
this happens within the compiler, because to change optimization level I just change the parameter which are used for 
invocation of the compiler. I assume that due to this optimization flag there is shift somewhere inside the compiler 
within the list which fixes what the user of the compiler gets as warnings, and what as errors.

What do you thing about that? (I do not have much experience with the qcc or gcc compiler)
RE: RE: Problems with the implementation of the compiler optimization within Momentics 4.7.0 (maybe a bug??)  
Hello Daniil

The best way to test your theory is to run a build from the command line.
If you see the same errors/warnings that you are seeing in your problems
view outputted in the console, then it is a compiler setting.  If you don't
and your build runs fine from the command line, then the problem is with the
IDE and any of the utilities that it is running behind the scenes to analyze
your code. 

Thanks,
Rodney


-----Original Message-----
From: Daniil Moerman [mailto:community-noreply@qnx.com] 
Sent: Friday, September 14, 2012 6:34 AM
To: general-ide
Subject: Re: RE: Problems with the implementation of the compiler
optimization within Momentics 4.7.0 (maybe a bug??)

Sorry Rodney but I did not find the settings you mentioned ... I looked up
the internet but there is no reference to such a configuration window. But
your idea of warnings that become into errors sounds reasonable. I still
assume that this happens within the compiler, because to change optimization
level I just change the parameter which are used for invocation of the
compiler. I assume that due to this optimization flag there is shift
somewhere inside the compiler within the list which fixes what the user of
the compiler gets as warnings, and what as errors.

What do you thing about that? (I do not have much experience with the qcc or
gcc compiler)



_______________________________________________

General
http://community.qnx.com/sf/go/post95580
To cancel your subscription to this discussion, please e-mail
general-ide-unsubscribe@community.qnx.com