https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83945
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Author: jakub Date: Sat Jan 20 09:58:31 2018 New Revision: 256916 URL: https://gcc.gnu.org/viewcvs?rev=256916&root=gcc&view=rev Log: PR middle-end/83945 * tree-emutls.c: Include gimplify.h. (lower_emutls_2): New function. (lower_emutls_1): If ADDR_EXPR is a gimple invariant and walk_tree with lower_emutls_2 callback finds some TLS decl in it, unshare_expr it before further processing. * gcc.dg/tls/pr83945.c: New test. Added: trunk/gcc/testsuite/gcc.dg/tls/pr83945.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-emutls.c