public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/61883] New: [4.10 Regression]ICE for gcc.dg/tls/alias-1.c on arm target
@ 2014-07-23  4:42 tony.wang at arm dot com
  2014-07-23  4:46 ` [Bug target/61883] " tony.wang at arm dot com
  2014-07-23  4:48 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: tony.wang at arm dot com @ 2014-07-23  4:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61883

            Bug ID: 61883
           Summary: [4.10 Regression]ICE for gcc.dg/tls/alias-1.c on arm
                    target
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tony.wang at arm dot com

The trunk will ICE when user declare tls variables with alias name on run-time
need to generate emutls variables.

How to reproduce:
/work/tonwan01/test_alias$
/work/tonwan01/gcc/gcc-arm-none-eabi-4_9-2014q2-20140515/install-native/lib/gcc/arm-none-eabi/4.10.0/cc1
-quiet -v -D_USES_INITFINI_ alias-1-clean.c -quiet -dumpbase alias-1-clean.c
-mthumb -mcpu=cortex-m0 -auxbase-strip alias-1.exe -version -o /tmp/cc0AHQ0g.s

alias-1.c:24:3: internal compiler error: Segmentation fault
_attribute_ ((visibility ("hidden")));
^
0xbdde7f crash_signal
/work/tonwan01/gcc/gcc-arm-none-eabi-4_9-2014q2-20140515/src/gcc/gcc/toplev.c:337
0x78b390 symtab_alias_target
/work/tonwan01/gcc/gcc-arm-none-eabi-4_9-2014q2-20140515/src/gcc/gcc/cgraph.h:1535
0x78d629 verify_symtab_base(symtab_node*)
/work/tonwan01/gcc/gcc-arm-none-eabi-4_9-2014q2-20140515/src/gcc/gcc/symtab.c:830
0x78d7bb verify_symtab_node(symtab_node*)
/work/tonwan01/gcc/gcc-arm-none-eabi-4_9-2014q2-20140515/src/gcc/gcc/symtab.c:863
0x78d823 verify_symtab()
/work/tonwan01/gcc/gcc-arm-none-eabi-4_9-2014q2-20140515/src/gcc/gcc/symtab.c:881
0x9e6e85 symtab_remove_unreachable_nodes(bool, _IO_FILE*)
/work/tonwan01/gcc/gcc-arm-none-eabi-4_9-2014q2-20140515/src/gcc/gcc/ipa.c:592
0x7a09f3 ipa_passes
/work/tonwan01/gcc/gcc-arm-none-eabi-4_9-2014q2-20140515/src/gcc/gcc/cgraphunit.c:2065
0x7a0d70 compile()
/work/tonwan01/gcc/gcc-arm-none-eabi-4_9-2014q2-20140515/src/gcc/gcc/cgraphunit.c:2187
0x7a107c finalize_compilation_unit()
/work/tonwan01/gcc/gcc-arm-none-eabi-4_9-2014q2-20140515/src/gcc/gcc/cgraphunit.c:2342
0x60ba71 c_write_global_declarations()
/work/tonwan01/gcc/gcc-arm-none-eabi-4_9-2014q2-20140515/src/gcc/gcc/c/c-decl.c:10452

The reason for this bug is that in the tree-emutls.c pass, the code imply a
default sequence of tls symbol and its corresponding control symbol. Some patch
now move the symtab node generation to a very early stage, so the sequence of
the node in varpool changed which leads to the wrong mapping of tls var and
control var.

For case gcc.dg/tls/alias-1.c

Before:
tls_vars[0]:bar(alias foo)
tls_vars[1]:foo
control_vars[0]:_emutls_v.foo
control_vars[1]:_emutls_v.bar(alias _emutls_v.foo)
So when generate the reference list of main, the actual reference of bar would
be _emutls_v.foo which is correct.

After:
tls_vars[1]:bar(alias foo)
tls_vars[0]:foo
control_vars[0]:_emutls_v.foo
control_vars[1]:_emutls_v.bar(alias _emutls_v.foo)
The reference list of main will point to the alias symbol node _emutls_v.bar,
which finally cause the segment fault.

I also a simpler test case to reproduce this bug, it should be an old bug for
the tree-emutls pass. The way this pass mapping the control vars and tls vars
hasn't consider that there may more than one alias for a tls var. For run time
support tls, the code can compile successfully.

struct __res_state {
 char x[123];
};

__thread struct __res_state foo;
extern __thread struct __res_state bar
  __attribute__ ((alias ("foo")));
extern __thread struct __res_state baz
  __attribute__ ((alias ("foo")));

int main()
{
  bar.x[0] = 0;
  baz.x[1] = 1;
  return 0;
}


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/61883] [4.10 Regression]ICE for gcc.dg/tls/alias-1.c on arm target
  2014-07-23  4:42 [Bug target/61883] New: [4.10 Regression]ICE for gcc.dg/tls/alias-1.c on arm target tony.wang at arm dot com
@ 2014-07-23  4:46 ` tony.wang at arm dot com
  2014-07-23  4:48 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: tony.wang at arm dot com @ 2014-07-23  4:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61883

--- Comment #1 from wangzheyu <tony.wang at arm dot com> ---
For target don't support tls, the above simple test case will fail for the same
reason of gcc.dg/tls/alias-1.c.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug target/61883] [4.10 Regression]ICE for gcc.dg/tls/alias-1.c on arm target
  2014-07-23  4:42 [Bug target/61883] New: [4.10 Regression]ICE for gcc.dg/tls/alias-1.c on arm target tony.wang at arm dot com
  2014-07-23  4:46 ` [Bug target/61883] " tony.wang at arm dot com
@ 2014-07-23  4:48 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-07-23  4:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61883

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 61548.

*** This bug has been marked as a duplicate of bug 61548 ***


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-07-23  4:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-23  4:42 [Bug target/61883] New: [4.10 Regression]ICE for gcc.dg/tls/alias-1.c on arm target tony.wang at arm dot com
2014-07-23  4:46 ` [Bug target/61883] " tony.wang at arm dot com
2014-07-23  4:48 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).