This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: CSE bug (gcc.c-torture/execute/980605-1.c)
- To: "David S. Miller" <davem at dm dot cobaltmicro dot com>
- Subject: Re: CSE bug (gcc.c-torture/execute/980605-1.c)
- From: Horst von Brand <vonbrand at sleipnir dot valparaiso dot cl>
- Date: Sun, 05 Jul 1998 21:07:55 -0500
- cc: amylaar at cygnus dot com, egcs at cygnus dot com
"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