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: unassig...@gcc.gnu.org ReportedBy: an...@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