Related to PR 29877. Take the following PPC64-linux code (ignore the fact the inline-asm should be improved a lot via use of clobbers). static inline int sys_ppu_thread_set_priority(sys_ppu_thread_t thread_id,int prio) { register uint64_t p1 __asm__ ("3") = thread_id; register uint64_t p2 __asm__ ("4") = prio; register uint64_t p3 __asm__ ("5"); register uint64_t p4 __asm__ ("6"); register uint64_t p5 __asm__ ("7"); register uint64_t p6 __asm__ ("8"); register uint64_t p7 __asm__ ("9"); register uint64_t p8 __asm__ ("10"); register uint64_t n __asm__ ("11") = 47; __asm__ volatile ("sc" : "=r" (p1), "=r" (p2), "=r" (p3), "=r" (p4), "=r" (p5), "=r" (p6), "=r" (p7), "=r" (p8), "=r" (n) : "r" (p1), "r" (p2), "r" (p3), "r" (p4), "r" (p5), "r" (p6), "r" (p7), "r" (p8), "r" (n) : "0", "12", "lr", "ctr", "xer", "cr0", "cr1", "cr5", "cr6", "cr7", "memory"); return (int)(p1); } int32_t P(int32_t priority){return 0;} struct Thread { sys_ppu_thread_t tid; Thread(); void setPriority(int32_t p); }; void Thread::setPriority(int32_t p) { sys_ppu_thread_t a = tid; sys_ppu_thread_set_priority(a, P(p)); }
---------------- CUT -------------------- Right now we get in .optimized: p1 = this->tid; p2 = (uint64_t) P (p); Which is wrong as the assignment of p1 happens before the call to P so we clobber it during the setup of the call. -- Summary: [4.1/4.2/4.3 Regression] TER breaks some inline-asm code (again) Product: gcc Version: 4.3.0 Status: UNCONFIRMED Keywords: wrong-code Severity: blocker Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pinskia at gcc dot gnu dot org GCC target triplet: powerpc64-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33619