[Bug middle-end/33992] [4.3 Regression] Miscompiles a function, breaks profiledbootstrap
ubizjak at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Feb 10 08:23:00 GMT 2008
------- Comment #26 from ubizjak at gmail dot com 2008-02-10 08:23 -------
Following is significantly minimized testcase:
--cut here--
#include <stdlib.h>
#include <stdio.h>
struct real_value
{
unsigned long sig[3];
};
#ifdef INLINE
static inline void __attribute__((always_inline))
#else
static void __attribute__((noinline))
#endif
normalize (struct real_value *r)
{
int j;
for (j = 0; ; j++)
if (r->sig[2] & ((unsigned long)1 << (63 - j)))
break;
printf ("%i\n", j);
if (j)
abort ();
}
static void __attribute__((noinline))
do_test (struct real_value *r)
{
int i;
for (i = 0; i < 2; ++i)
normalize (r);
}
int main()
{
struct real_value r;
r.sig[0] = 0ull;
r.sig[1] = 0ull;
r.sig[2] = 0x8000000000000001ull;
do_test (&r);
return 0;
}
--cut here--
[uros@localhost test]$ gcc -O2 -DINLINE t1.c
[uros@localhost test]$ ./a.out
63
Aborted
[uros@localhost test]$ gcc -O2 t1.c
[uros@localhost test]$ ./a.out
0
0
Note, that it looks like MSB is not detected in normalize().
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33992
More information about the Gcc-bugs
mailing list