Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

GCC runing optomization!

GCC runing optomization!

2005-02-18 by Gus

Hello,

Anyone is using GCC compiler version 3.4.2 WITH optomization?

When I enable optomization, my applicatin acts funny! I am not sure 
why.


Gus

Re: [lpc2000] GCC runing optomization!

2005-02-18 by Bryce Schober

I'm not using 3.4.2, but in general:

We use extensive optimization in all of our products (we couldn't live
without it).  Without optimization gcc basically creates paranoid
assembly code. With optimization, gcc basically assumes that you said
exactly what you mean when you wrote your code, which isn't always
true. Perhaps the most common problems are variable declarations. When
a variable can change outside the current scope (for example, in an
interrupt), it must be declared as volatile so that the compiler won't
assume that the variable hasn't changed since the last time it was
accessed. That was the most common problem I've run into.


On Fri, 18 Feb 2005 17:52:07 -0000, Gus <gus_is_working@...> wrote:
>  
>  Hello,
>  
>  Anyone is using GCC compiler version 3.4.2 WITH optomization?
>  
>  When I enable optomization, my applicatin acts funny! I am not sure 
>  why.
>  
>  
>  Gus
>  
>  
>  
>  
>  ________________________________
>  Yahoo! Groups Links
>  
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/lpc2000/
>   
> To unsubscribe from this group, send an email to:
> lpc2000-unsubscribe@yahoogroups.com
>   
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 


-- 
Bryce Schober

Re: [lpc2000] GCC runing optomization!

2005-02-19 by jane highland

Gus,

The rule with optimisation e.g. -O3 :

If a function calls a function outside of the current
'C' module, the function will definately be called.

If a function calls another function which calls
another function etc. inside the SAME module, it may
not compile as expected (some of the calls may be
optimised out) UNLESS the FINAL function in the chain
accesses something volatile, or is an external
function (to the module).

e.g.

* (volatile unsigned long fred) * FRED = 0;


This is because the scope of the optimiser is limited
to the current module only - it has no idea about
external functions and there leaves any calls to them
intact. But functions inside the same module may just
magically dissappear if they're deemed not to access
anything useful (volatile).

I learned the hard way over several days!

Jane

 --- Gus <gus_is_working@...> wrote: 

---------------------------------

Hello,

Anyone is using GCC compiler version 3.4.2 WITH
optomization?

When I enable optomization, my applicatin acts funny!
I am not sure 
why.


Gus





---------------------------------
Yahoo! Groups Links

   To visit your group on the web, go to:
http://groups.yahoo.com/group/lpc2000/
 
   To unsubscribe from this group, send an email to:
lpc2000-unsubscribe@yahoogroups.com
 
   Your use of Yahoo! Groups is subject to the Yahoo!
Terms of Service.
 


	
	
		
___________________________________________________________ 
ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com

Re: GCC runing optomization!

2005-02-20 by embeddedjanitor

--- In lpc2000@yahoogroups.com, "Gus" <gus_is_working@y...> wrote:
> 
> Hello,
> 
> Anyone is using GCC compiler version 3.4.2 WITH optomization?
> 
> When I enable optomization, my applicatin acts funny! I am not sure 
> why.
> 
> 
> Gus

I have had no problems using various versions of gcc, at various 
optimisation levels. As others have said,check your volatile 
declaraions.

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.