This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

[Bug c/30717] New: Compile error with e500 target on gcc 4.1/4.2


glibc 2.3.6 fails to compile with gcc 4.1.2 dated 11/24/06 or later, or
matching gcc version 4.2.x, if gcc is compiled for e500 or e500v2 CPUs.

The following code is a shortened test case.

#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
}

Compilation 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 
$ 

The problem is caused by the addition of MASK_STRICT_ALIGN into the processor
mask for 8540 and 8548 CPUs in various locations; if the MASK_STRICT_ALIGN
definitions added between gcc-4.1-20061117 and gcc-4.1-20061124 are removed,
everything compiles fine.
Problem is not seen if gcc is compiled for ppc or powerpc targets.


-- 
           Summary: Compile error with e500 target on gcc 4.1/4.2
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: guenter at roeck-us dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30717


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