http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49515
Summary: [4.7 Regression] gcc.dg/torture/tls/thr-init-2.c -O2 -fpic execution test failure Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: ubiz...@gmail.com CC: r...@gcc.gnu.org Target: alpha-linux-gnu gcc.dg/torture/tls/thr-init-2.c -O2 -fpic testcase fails on alphaev68-pc-linux-gnu due to clobbering of $16 register. The problematic function in the testcase compiles to (-O2 -fpic): $test_code..ng: ldq $27,__tls_get_addr($29) !literal!1 lda $30,-16($30) stq $26,0($30) stq $9,8($30) .prologue 1 mov $16,$9 lda $16,fstat($29) !tlsldm!1 jsr $26,($27),__tls_get_addr !lituse_tlsldm!1 ldah $29,0($26) !gpdisp!3 ldah $1,fstat($0) !dtprelhi ldq $26,0($30) lda $29,0($29) !gpdisp!3 >>> ldl $16,fstat($1) !dtprello >>> addl $16,$9,$16 ldq $9,8($30) addl $31,$16,$0 >>> stl $16,fstat($1) !dtprello lda $30,16($30) ret $31,($26),1 $ ./a.out a=2 fstat=33554434 Aborted The difference to working code from gcc-4.4.5 is: @@ -26,17 +26,18 @@ ldah $1,fstat($0) !dtprelhi ldq $26,0($30) lda $29,0($29) !gpdisp!3 - ldl $0,fstat($1) !dtprello - addl $0,$9,$0 + ldl $16,fstat($1) !dtprello + addl $16,$9,$16 ldq $9,8($30) - stl $0,fstat($1) !dtprello + addl $31,$16,$0 + stl $16,fstat($1) !dtprello lda $30,16($30) ret $31,($26),1 Please note that $0 is used instead (extra addl is just a move from $16 to $0). Does !dtprello relocation need live $16 register? The relevant patterns in alpha.md do not model that dependancy.