Optimizes out TLS variable called in a child function

Michael Cronenworth mike@cchtml.com
Wed Apr 22 16:55:00 GMT 2015


On 03/08/2015 07:28 PM, Michael Cronenworth wrote:
> During my adventures in wine and gcc5 I've had to compile updated wine-gecko and
> wine-mono binaries as they get updated at various periods alongside wine. I
> encountered an issue with gcc5 not compiling a TLS routine in wine-mono. I created a
> simple test case and can see the same failure result with the test case in gcc 4.8
> and 4.9 as well as 5. My test case may be doing something wrong, and if it is I may
> be able to fix wine-mono, but the test case fails in a suspiciously single way that
> looks like a gcc bug.
>
> The attached test case is getting the offset location of a TLS variable. When
> compiled with -O0 the test case compiles. When compiled with -O1 the test case will
> not compile with an error for an undefined reference to the TLS variable. If you
> move the THREAD_VAR_OFFSET macro call to main() gcc will compile without error. Any
> suggestions?

This is still an issue with a recent gcc checkout. Should I go ahead and open a gcc bug?



More information about the Gcc-help mailing list