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 tree-optimization/47286] New: Invalid code when using register ... asm


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

           Summary: Invalid code when using register ... asm
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: anton@samba.org
            Target: powerpc64-unknown-linux-gnu


A gcc build from yesterday (4.6.0 20110113) fails when building a ppc64 Linux
kernel. A cut down testcase:

struct thread_info {
        int preempt_count;
};

static inline struct thread_info *current_thread_info(void)
{
        register struct thread_info *sp asm("r1");
        return sp;
}

void testcase(void)
{
        current_thread_info()->preempt_count += 1;
}

compiled with -O2:

# gcc -O2 -S testcase.s

has the add optimised away:

.L.testcase:
        blr


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