Bug 85329 - [8 Regression] ICE in add_to_same_comdat_group, at symtab.c:460
Summary: [8 Regression] ICE in add_to_same_comdat_group, at symtab.c:460
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: ipa (show other bugs)
Version: 8.0
: P1 normal
Target Milestone: 8.0
Assignee: Martin Liška
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2018-04-10 19:58 UTC by Matthias Klose
Modified: 2018-04-17 05:42 UTC (History)
1 user (show)

See Also:
Host:
Target: x86_64-linux-gnu, x86_64-linux-gnux32, i686-linux-gnu
Build:
Known to work: 7.3.1
Known to fail: 8.0
Last reconfirmed: 2018-04-11 00:00:00


Attachments
preprocessed source (478.41 KB, application/x-xz)
2018-04-11 13:28 UTC, Matthias Klose
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2018-04-10 19:58:17 UTC
seen with r259224 on the trunk, x86 architectures, building the i2pd package:

$ cat Crypto.ii
class b {
public:
  __attribute__((target("aes"))) b() {}
  __attribute__((target("default"))) b() {}
};
class c {
  b d;
};
void fn1() { c a; }
__attribute__((target_clones("sse", "default"))) void e() {}

$ g++ -std=c++11 -c -O0 -fPIE -Wall Crypto.ii 
during IPA pass: targetclone
Crypto.ii:10:60: internal compiler error: in add_to_same_comdat_group, at symtab.c:460
 __attribute__((target_clones("sse", "default"))) void e() {}
                                                            ^
0x59d301 symtab_node::add_to_same_comdat_group(symtab_node*)
        ../../src/gcc/symtab.c:460
0x12bbbc8 create_dispatcher_calls
        ../../src/gcc/multiple_target.c:157
0x12bbbc8 ipa_target_clone
        ../../src/gcc/multiple_target.c:437
0x12bbbc8 execute
        ../../src/gcc/multiple_target.c:466
Please submit a full bug report,
with preprocessed source if appropriate.
Comment 1 Martin Liška 2018-04-11 07:55:22 UTC
I'll take a look.
Comment 2 Martin Liška 2018-04-11 07:56:48 UTC
Started with r249365.
Comment 3 Martin Liška 2018-04-11 09:19:03 UTC
It's fishy as we have b::b that has create an alias to __ct_base:

#0  symtab_node::create_reference (this=<symtab_node * const 0x7ffff69192e0 "__ct_comp "/2>, referred_node=<symtab_node * 0x7ffff69195c0 "__ct_base "/4>, use_type=IPA_REF_ALIAS, stmt=<gimple 0x0>) at ../../gcc/symtab.c:604
#1  0x0000000000a7048b in symtab_node::resolve_alias (this=<symtab_node * const 0x7ffff69192e0 "__ct_comp "/2>, target=<symtab_node * 0x7ffff69195c0 "__ct_base "/4>, transparent=false) at ../../gcc/symtab.c:1670
#2  0x0000000000a86700 in symbol_table::process_same_body_aliases (this=0x7ffff67aa100) at ../../gcc/cgraphunit.c:709
#3  0x000000000075d516 in c_parse_final_cleanups () at ../../gcc/cp/decl2.c:4683
#4  0x0000000000ec25df in compile_file () at ../../gcc/toplev.c:455
#5  0x0000000000646d45 in do_compile () at ../../gcc/toplev.c:2132
#6  toplev::main (this=this@entry=0x7fffffffd87e, argc=<optimized out>, argc@entry=20, argv=<optimized out>, argv@entry=0x7fffffffd978) at ../../gcc/toplev.c:2267
#7  0x00000000006492fb in main (argc=20, argv=0x7fffffffd978) at ../../gcc/main.c:39

Is it valid to clone the __ct_comp and redirect the alias for the clones?
Nathan?
Comment 4 Martin Liška 2018-04-11 10:21:00 UTC
(In reply to Martin Liška from comment #3)
> It's fishy as we have b::b that has create an alias to __ct_base:
> 
> #0  symtab_node::create_reference (this=<symtab_node * const 0x7ffff69192e0
> "__ct_comp "/2>, referred_node=<symtab_node * 0x7ffff69195c0 "__ct_base
> "/4>, use_type=IPA_REF_ALIAS, stmt=<gimple 0x0>) at ../../gcc/symtab.c:604
> #1  0x0000000000a7048b in symtab_node::resolve_alias (this=<symtab_node *
> const 0x7ffff69192e0 "__ct_comp "/2>, target=<symtab_node * 0x7ffff69195c0
> "__ct_base "/4>, transparent=false) at ../../gcc/symtab.c:1670
> #2  0x0000000000a86700 in symbol_table::process_same_body_aliases
> (this=0x7ffff67aa100) at ../../gcc/cgraphunit.c:709
> #3  0x000000000075d516 in c_parse_final_cleanups () at
> ../../gcc/cp/decl2.c:4683
> #4  0x0000000000ec25df in compile_file () at ../../gcc/toplev.c:455
> #5  0x0000000000646d45 in do_compile () at ../../gcc/toplev.c:2132
> #6  toplev::main (this=this@entry=0x7fffffffd87e, argc=<optimized out>,
> argc@entry=20, argv=<optimized out>, argv@entry=0x7fffffffd978) at
> ../../gcc/toplev.c:2267
> #7  0x00000000006492fb in main (argc=20, argv=0x7fffffffd978) at
> ../../gcc/main.c:39
> 
> Is it valid to clone the __ct_comp and redirect the alias for the clones?
> Nathan?

Forget about it, issue of this PR is somewhere else. I'm testing a patch candidate.
Comment 5 Martin Liška 2018-04-11 10:21:39 UTC
Matthias can you please point to source files of the project?
And can you please attach full preprocessed source file?
Thanks.
Comment 6 Matthias Klose 2018-04-11 13:28:56 UTC
Created attachment 43910 [details]
preprocessed source

source package is https://launchpad.net/ubuntu/+source/i2pd

upstream is http://i2pd.website/
Comment 7 Martin Liška 2018-04-17 05:41:11 UTC
Author: marxin
Date: Tue Apr 17 05:40:39 2018
New Revision: 259428

URL: https://gcc.gnu.org/viewcvs?rev=259428&root=gcc&view=rev
Log:
Make redirection only for target_clones: V3 (PR ipa/85329).

2018-04-17  Martin Liska  <mliska@suse.cz>

	PR ipa/85329
	* multiple_target.c (create_dispatcher_calls): Set apostrophes
	for target_clone error message.  Make default implementation
        clone to be a local declaration.
	(separate_attrs): Add new argument and check for an empty
	string.
	(expand_target_clones): Handle it.
	(ipa_target_clone): Make redirection just for target_clones
	functions.
2018-04-17  Martin Liska  <mliska@suse.cz>

	PR ipa/85329
	* g++.dg/ext/pr85329-2.C: New test.
	* g++.dg/ext/pr85329.C: New test.
	* gcc.target/i386/mvc12.c: New test.

Added:
    trunk/gcc/testsuite/g++.dg/ext/pr85329-2.C
    trunk/gcc/testsuite/g++.dg/ext/pr85329.C
    trunk/gcc/testsuite/gcc.target/i386/mvc12.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/multiple_target.c
    trunk/gcc/testsuite/ChangeLog
Comment 8 Martin Liška 2018-04-17 05:42:05 UTC
Fixed on trunk.