volatile is not volatile enough

Daniel Jacobowitz drow@mvista.com
Wed Jun 25 15:14:00 GMT 2003


On Wed, Jun 25, 2003 at 03:20:57PM +0200, Jan Engelhardt wrote:
> Hi,
> 
> given a statement like
>   int a[2];
>   func2(func1(a), a[0], a[1]);
> where a is modified by func1, func2 receives wrong input on the stack. In
> detail, first a[1], then a[0] and then a is pushed onto the stack, then func1
> gets called and pops off its a -- which is modified after.
> Adding the keyword volatile doesnot help.
> 
> I am using gcc 3.3 20030226 (prerelease) SuSE Linux 8.2.

This isn't a GCC bug.  The order of evaluation of function arguments is
undefined - including nested function calls.


-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer



More information about the Gcc-bugs mailing list