autoconf
[Top][All Lists]
Advanced

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

Re: Stack direction check fails with optimizations


From: Roger While
Subject: Re: Stack direction check fails with optimizations
Date: Wed, 13 Dec 2006 21:35:41 +0100

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 <address@hidden> 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.







reply via email to

[Prev in Thread] Current Thread [Next in Thread]