https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113711
--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> --- (In reply to Hongyu Wang from comment #6) > (In reply to H.J. Lu from comment #5) > > (In reply to Hongyu Wang from comment #4) > > > Previously I added > > > https://gcc.gnu.org/git/?p=gcc.git;a=commit; > > > h=d564198f960a2f5994dde3f6b83d7a62021e49c3 > > > > > > to prohibit several *POFF constant usage in NDD add alternative. If > > > checking > > > ADDR_SPACE_GENERIC can avoid the seg prefix usage, we can drop that > > > change? > > > > Are there are any testcases for this change? > > > > Cut and edit from gcc.dg\torture\tls\tls-test.c > > #include <pthread.h> > __thread int a = 255; > __thread int *b; > int *volatile a_in_other_thread = (int *) 12345; > > void * > thread_func (void *arg) > { > a_in_other_thread = &a; //Previously it will try to generate addq > $a@tpoff, %fs:0, %rax > a+=11144; //this was not fixed on trunk as UNSPEC_TPOFF is in mem operand > *((int *) arg) = a; > > return (void *)0; > } My patch seems to work. But we need to add such tests to gcc.target/i386.