This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: CSE bug (gcc.c-torture/execute/980605-1.c)


"David S. Miller" <davem@dm.cobaltmicro.com> said:
> This one is nasty and has been in GCC for a long time.  When it
> doesn't generate incorrect code, the bug prevents libcalls and
> functions marked with attribute const from being optimized away in
> most cases. ;-(
> 
> For reference since the test case is quite small:
> 
> ========================================
> static int f(int) __attribute__((const));
> int main()
> {
>    int f1, f2, x;
>    x = 1; f1 = f(x);
>    x = 2; f2 = f(x);
>    if (f1 != 1 || f2 != 2)
>      abort ();
>    exit (0);
> }
> static int f(int x) { return x; }
> ========================================

I get an abort on i586 UP, linux-2.1.108, egcs-19980628, glibc-2.0.94,
binutils-2.9.1.0.7 if compiled with -O2.
-- 
Horst von Brand                             vonbrand@sleipnir.valparaiso.cl
Casilla 9G, Viņa del Mar, Chile                               +56 32 672616


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]