[Bug middle-end/53093] [4.8 Regression]: tls/alias-1.c ICE, emutls
hubicka at ucw dot cz
gcc-bugzilla@gcc.gnu.org
Wed May 2 14:35:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53093
--- Comment #8 from Jan Hubicka <hubicka at ucw dot cz> 2012-05-02 14:34:02 UTC ---
> > > > Does the aliases behave sanely with emutls?
> > > How do I tell?
> > Honestly I hoped you will know. Emutls is not my area.
>
> I should have mentioned that the other tests covering emutls work, so perhaps I
> could answer the first question with a weak "yes". :)
Hi,
so I managed to get a testcase that fails:
/* { dg-do link } */
/* { dg-require-alias "" } */
/* { dg-require-visibility "" } */
/* { dg-require-effective-target tls_runtime } */
/* Test that encode_section_info handles the change from externally
defined to locally defined (via hidden). Extracted from glibc. */
struct __res_state {
char x[123];
};
extern __thread struct __res_state bar
__attribute__ ((tls_model ("initial-exec")));
__thread struct __res_state foo;
extern __thread struct __res_state bar
__attribute__ ((alias ("foo")))
__attribute__ ((visibility ("hidden")));
int main()
{
bar.x[0] = 15;
if (foo.x[0]!= 15)
abort ();
return 0;
}
I think the bug exists at least in GCC 4.7, but it may be interesting to try
older compilers, too.
I am testing the following fix on x86_64 with emutls enabled. Basically the
bug is as I described: we want emutls variable of alias to be alias of emutls
variable of target, not the alias of target. DECL_VALUE_EXPR is used to
translate vars to emutls vars.
Honza
Index: tree-emutls.c
===================================================================
--- tree-emutls.c (revision 187011)
+++ tree-emutls.c (working copy)
@@ -338,7 +338,7 @@ new_emutls_decl (tree decl, tree alias_o
else
varpool_create_variable_alias (to,
varpool_node_for_asm
- (DECL_ASSEMBLER_NAME (alias_of))->symbol.decl);
+ (DECL_ASSEMBLER_NAME (DECL_VALUE_EXPR
(alias_of)))->symbol.decl);
return to;
}
More information about the Gcc-bugs
mailing list