Possible regression with gcc 4.1.2 RC

groeck groeck@teaktechnologies.com
Tue Feb 6 16:11:00 GMT 2007


I tried to compile glibc 2.3.6 and 2.4 for an e500 target using gcc-4.1.2-20070128.
I applied the proposed patch for PR30370 go get gcc compiled.

Unfortunately, glibc compilation fails. After some testing, I was able
to create a small test program - see below. It turns out that the
problem was introduced into the 4.1 branch between 11/17/06 and
11/24/06. gcc-4.2-20070131 also fails.

I tried both "--with-cpu=8540" and "--enable-e500-double --with-cpu=8548"
configuration options. gcc compiled for other powerpc/ppc targets
appears to be ok.

Has anyone besides me seen this problem ? 


Test code is as follows. Compile with any option for -me500 to see the
resulting error. Failing code in glibc is atomic_increment() in elf/dl-profile.c,
line 550.


#define testmacro(mem) \
  ({									      \
    __typeof (*(mem)) __val;						      \
    __asm __volatile ("		addi	%0,%2,1\n"			      \
		      : "=&b" (__val), "=m" (*mem)			      \
		      : "b" (mem), "m" (*mem)				      \
		      : "cr0", "memory");				      \
    __val;								      \

struct teststruct1
    int count;
  } __attribute__ ((packed));

struct teststruct2
    int count;

void testfunc (struct teststruct1 *s1, struct teststruct2 *s2)
  int v;

  testmacro(&v);			// ok
  testmacro(&s1->count);		// fails
  testmacro(&s2->count);		// ok

Compiler output:

$ ppc-teak-linuxspe1-gcc -c testcc.c
testcc.c: In function 'testfunc':
testcc.c:26: error: output number 1 not directly addressable
testcc.c:26: warning: use of memory input without lvalue in asm operand
3 is deprecated

More information about the Gcc mailing list