Re: Stack direction check fails with optimizations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I disagree.
gcc (versions 3 and 4) will indeed inline with various -On
options but gets it right.
AFAIK the return test in growsdown MUST be evaluated
regardless of optimization out of the variables themselves
and therefore the compiler in this case must do it right.

Actually, as a side note to the original implementation, is
not the compiler free to choose what to do with at a
static defined variable ?

Roger

Roger While <simrw@xxxxxxxxxxxx> writes:

> Any reason why the following should not work ? -
>
> int
> growsdown (void *x)
> {
>         int y;
>         return x > (void *)&y;
> }
>
> int
> main()
> {
>         int x;
>         exit (growsdown(&x));
> }

That could fail exactly the same way if growsdown were inlined by the
compiler.

Andreas.





_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux