* [Bug lto/54898] [4.8 regression] ICE in uniquify_nodes, at lto/lto.c:1898
2012-10-11 10:10 [Bug lto/54898] New: [4.8 regression] ICE in uniquify_nodes, at lto/lto.c:1898 dimhen at gmail dot com
@ 2012-10-11 10:11 ` dimhen at gmail dot com
2012-10-11 14:00 ` rguenth at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: dimhen at gmail dot com @ 2012-10-11 10:11 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54898
--- Comment #1 from Dmitry G. Dyachenko <dimhen at gmail dot com> 2012-10-11 10:11:02 UTC ---
Created attachment 28422
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28422
2.cpp
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug lto/54898] [4.8 regression] ICE in uniquify_nodes, at lto/lto.c:1898
2012-10-11 10:10 [Bug lto/54898] New: [4.8 regression] ICE in uniquify_nodes, at lto/lto.c:1898 dimhen at gmail dot com
2012-10-11 10:11 ` [Bug lto/54898] " dimhen at gmail dot com
@ 2012-10-11 14:00 ` rguenth at gcc dot gnu.org
2012-10-11 15:00 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-10-11 14:00 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54898
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2012-10-11
AssignedTo|unassigned at gcc dot |rguenth at gcc dot gnu.org
|gnu.org |
Target Milestone|--- |4.8.0
Ever Confirmed|0 |1
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> 2012-10-11 13:59:03 UTC ---
Ick. Mine.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug lto/54898] [4.8 regression] ICE in uniquify_nodes, at lto/lto.c:1898
2012-10-11 10:10 [Bug lto/54898] New: [4.8 regression] ICE in uniquify_nodes, at lto/lto.c:1898 dimhen at gmail dot com
2012-10-11 10:11 ` [Bug lto/54898] " dimhen at gmail dot com
2012-10-11 14:00 ` rguenth at gcc dot gnu.org
@ 2012-10-11 15:00 ` rguenth at gcc dot gnu.org
2012-10-11 15:16 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-10-11 15:00 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54898
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> 2012-10-11 15:00:09 UTC ---
What happens is that the input at LTRANS stage has wrecked TYPE_MAIN_VARIANT:
(gdb) call debug_tree ($31)
<integer_type 0x7ffff692a348 wchar_t readonly SI
size <integer_cst 0x7ffff67f40a0 type <integer_type 0x7ffff67f00a8
bitsizetype> constant 32>
unit size <integer_cst 0x7ffff67f40c0 type <integer_type 0x7ffff67f0000
sizetype> constant 4>
align 32 symtab 0 alias set -1 structural equality precision 32 min
<integer_cst 0x7ffff6912880 -2147483648> max <integer_cst 0x7ffff6912a40
2147483647>>
(gdb) p $31->type_common.main_variant
$32 = (tree) 0x7ffff6924540
(gdb) call debug_tree ($32)
<integer_type 0x7ffff6924540 wchar_t SI
size <integer_cst 0x7ffff67f40a0 type <integer_type 0x7ffff67f00a8
bitsizetype> constant 32>
unit size <integer_cst 0x7ffff67f40c0 type <integer_type 0x7ffff67f0000
sizetype> constant 4>
align 32 symtab 0 alias set -1 structural equality precision 32 min
<integer_cst 0x7ffff67f4040 -2147483648> max <integer_cst 0x7ffff67f4060
2147483647> context <translation_unit_decl 0x7ffff6927170 D.2440>>
(gdb) p $31->type_common.main_variant->type_common.main_variant
$33 = (tree) 0x7ffff67f05e8
(gdb) call debug_tree ($33)
<integer_type 0x7ffff67f05e8 int public SI
size <integer_cst 0x7ffff67f40a0 type <integer_type 0x7ffff67f00a8
bitsizetype> constant 32>
unit size <integer_cst 0x7ffff67f40c0 type <integer_type 0x7ffff67f0000
sizetype> constant 4>
align 32 symtab 0 alias set -1 canonical type 0x7ffff67f05e8 precision 32
min <integer_cst 0x7ffff67f4040 -2147483648> max <integer_cst 0x7ffff67f4060
2147483647>
pointer_to_this <pointer_type 0x7ffff67f82a0>>
thus a TYPE_MAIN_VARIANT of a main variant is not itself. The code
cannot deal with this impossible situation. Thus,
TYPE_MAIN_VARIANT (t) == TYPE_MAIN_VARIANT (TYPE_MAIN_VARIANT (t))
needs to always hold.
It might be that things break here because $33 is integer_type_node, a
type we pre-load into the streamer cache.
More investigation needed.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug lto/54898] [4.8 regression] ICE in uniquify_nodes, at lto/lto.c:1898
2012-10-11 10:10 [Bug lto/54898] New: [4.8 regression] ICE in uniquify_nodes, at lto/lto.c:1898 dimhen at gmail dot com
` (2 preceding siblings ...)
2012-10-11 15:00 ` rguenth at gcc dot gnu.org
@ 2012-10-11 15:16 ` rguenth at gcc dot gnu.org
2012-10-11 16:46 ` markus at trippelsdorf dot de
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-10-11 15:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54898
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> 2012-10-11 15:16:07 UTC ---
We produce this situation somewhen during WPA stage (probably type merging).
(gdb) p expr
$1 = (tree) 0x7ffff693e3f0
(gdb) p expr->type_common.main_variant
$2 = (tree) 0x7ffff6922b28
type merging assumes that if TYPE_MAIN_VARIANT (t) == t then t will
prevail or be replaced with a different type that also is a main variant.
we first read $2, with main variant 0x7ffff67f05e8:
(gdb) call debug_tree ($2)
<integer_type 0x7ffff6922b28 wchar_t SI
size <integer_cst 0x7ffff67f40a0 type <integer_type 0x7ffff67f00a8
bitsizetype> constant 32>
unit size <integer_cst 0x7ffff67f40c0 type <integer_type 0x7ffff67f0000
sizetype> constant 4>
align 32 symtab 0 alias set -1 structural equality precision 32 min
<integer_cst 0x7ffff67f4040 -2147483648> max <integer_cst 0x7ffff67f4060
2147483647> context <translation_unit_decl 0x7ffff67fbf18 D.2366>>
(gdb) call debug_tree ($10)
<integer_type 0x7ffff67f05e8 int public SI
size <integer_cst 0x7ffff67f40a0 type <integer_type 0x7ffff67f00a8
bitsizetype> constant 32>
unit size <integer_cst 0x7ffff67f40c0 type <integer_type 0x7ffff67f0000
sizetype> constant 4>
align 32 symtab 0 alias set -1 canonical type 0x7ffff67f05e8 precision 32
min <integer_cst 0x7ffff67f4040 -2147483648> max <integer_cst 0x7ffff67f4060
2147483647>
pointer_to_this <pointer_type 0x7ffff67f82a0>>
then we read $1
(gdb) call debug_tree ($1)
<integer_type 0x7ffff693e3f0 SI
size <integer_cst 0x7ffff67f40a0 type <integer_type 0x7ffff67f00a8
bitsizetype> constant 32>
unit size <integer_cst 0x7ffff67f40c0 type <integer_type 0x7ffff67f0000
sizetype> constant 4>
align 32 symtab 0 alias set -1 structural equality precision 32 min
<integer_cst 0x7ffff6912a20 -2147483648> max <integer_cst 0x7ffff6912a40
2147483647>>
(gdb) call debug_tree ($1->type_common.main_variant)
<integer_type 0x7ffff6922b28 wchar_t SI
size <integer_cst 0x7ffff67f40a0 type <integer_type 0x7ffff67f00a8
bitsizetype> constant 32>
unit size <integer_cst 0x7ffff67f40c0 type <integer_type 0x7ffff67f0000
sizetype> constant 4>
align 32 symtab 0 alias set -1 canonical type 0x7ffff67f05e8 precision 32
min <integer_cst 0x7ffff67f4040 -2147483648> max <integer_cst 0x7ffff67f4060
2147483647> context <translation_unit_decl 0x7ffff67fbf18 D.2366>
pointer_to_this <pointer_type 0x7ffff6922a80>>
ouch. With the following asserts the testcase can possibly be reduced:
Index: gcc/tree-streamer-in.c
===================================================================
--- gcc/tree-streamer-in.c (revision 192359)
+++ gcc/tree-streamer-in.c (working copy)
@@ -703,6 +703,7 @@ lto_input_ts_type_common_tree_pointers (
/* Do not stream TYPE_NEXT_VARIANT, we reconstruct the variant lists
during fixup. */
TYPE_MAIN_VARIANT (expr) = stream_read_tree (ib, data_in);
+ gcc_assert (TYPE_MAIN_VARIANT (expr) == TYPE_MAIN_VARIANT (TYPE_MAIN_VARIANT
(expr)) || TYPE_MAIN_VARIANT (TYPE_MAIN_VARIANT (expr)) == NULL_TREE);
TYPE_CONTEXT (expr) = stream_read_tree (ib, data_in);
/* TYPE_CANONICAL gets re-computed during type merging. */
TYPE_CANONICAL (expr) = NULL_TREE;
Index: gcc/tree-streamer-out.c
===================================================================
--- gcc/tree-streamer-out.c (revision 192359)
+++ gcc/tree-streamer-out.c (working copy)
@@ -612,6 +612,7 @@ write_ts_type_common_tree_pointers (stru
reconstructed during fixup. */
/* Do not stream TYPE_NEXT_VARIANT, we reconstruct the variant lists
during fixup. */
+ gcc_assert (TYPE_MAIN_VARIANT (expr) == TYPE_MAIN_VARIANT (TYPE_MAIN_VARIANT
(expr)));
stream_write_tree (ob, TYPE_MAIN_VARIANT (expr), ref_p);
stream_write_tree (ob, TYPE_CONTEXT (expr), ref_p);
/* TYPE_CANONICAL is re-computed during type merging, so no need
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug lto/54898] [4.8 regression] ICE in uniquify_nodes, at lto/lto.c:1898
2012-10-11 10:10 [Bug lto/54898] New: [4.8 regression] ICE in uniquify_nodes, at lto/lto.c:1898 dimhen at gmail dot com
` (3 preceding siblings ...)
2012-10-11 15:16 ` rguenth at gcc dot gnu.org
@ 2012-10-11 16:46 ` markus at trippelsdorf dot de
2012-10-12 10:16 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: markus at trippelsdorf dot de @ 2012-10-11 16:46 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54898
Markus Trippelsdorf <markus at trippelsdorf dot de> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |markus at trippelsdorf dot
| |de
--- Comment #5 from Markus Trippelsdorf <markus at trippelsdorf dot de> 2012-10-11 16:45:51 UTC ---
The testcases could be a bit further reduced:
markus@x4 testcase % < test.i
typedef wchar_t;
wchar_t a;
markus@x4 testcase % < test.ii
class P
{
public:
typedef int PCXSTR;
typedef wchar_t YCHAR;
};
class F
{
P::PCXSTR PCXSTR;
};
class M
{
bool OnHashAlg (const wchar_t *);
F m_sPubKeyAlgOID;
};
bool
M::OnHashAlg (const wchar_t *)
{
}
markus@x4 testcase % gcc -r -nostdlib -flto test.i test.ii
lto1: internal compiler error: in uniquify_nodes, at lto/lto.c:1873
and with your gcc_asserts applied:
markus@x4 lto_bug % < test.i
typedef wchar_t;
wchar_t a;
markus@x4 lto_bug % < test.ii
void
fn1 (const wchar_t *)
{
}
markus@x4 lto_bug % gcc -r -nostdlib -flto test.i test.ii
lto1: internal compiler error: in write_ts_type_common_tree_pointers, at
tree-streamer-out.c:615
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug lto/54898] [4.8 regression] ICE in uniquify_nodes, at lto/lto.c:1898
2012-10-11 10:10 [Bug lto/54898] New: [4.8 regression] ICE in uniquify_nodes, at lto/lto.c:1898 dimhen at gmail dot com
` (4 preceding siblings ...)
2012-10-11 16:46 ` markus at trippelsdorf dot de
@ 2012-10-12 10:16 ` rguenth at gcc dot gnu.org
2012-10-12 12:14 ` rguenth at gcc dot gnu.org
2012-10-12 12:29 ` rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-10-12 10:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54898
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> 2012-10-12 10:16:19 UTC ---
What happens is that we merge wchar_t that is a main variant in one TU
with wchar_t that is not a main variant in another TU.
I have a patch.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug lto/54898] [4.8 regression] ICE in uniquify_nodes, at lto/lto.c:1898
2012-10-11 10:10 [Bug lto/54898] New: [4.8 regression] ICE in uniquify_nodes, at lto/lto.c:1898 dimhen at gmail dot com
` (5 preceding siblings ...)
2012-10-12 10:16 ` rguenth at gcc dot gnu.org
@ 2012-10-12 12:14 ` rguenth at gcc dot gnu.org
2012-10-12 12:29 ` rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-10-12 12:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54898
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> 2012-10-12 12:14:18 UTC ---
Author: rguenth
Date: Fri Oct 12 12:14:03 2012
New Revision: 192397
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=192397
Log:
2012-10-12 Richard Biener <rguenther@suse.de>
PR lto/54898
* lto.c (gimple_types_compatible_p_1): Also compare
TYPE_MAIN_VARIANT.
(iterative_hash_gimple_type): Also hash TYPE_MAIN_VARIANT.
Modified:
trunk/gcc/lto/ChangeLog
trunk/gcc/lto/lto.c
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug lto/54898] [4.8 regression] ICE in uniquify_nodes, at lto/lto.c:1898
2012-10-11 10:10 [Bug lto/54898] New: [4.8 regression] ICE in uniquify_nodes, at lto/lto.c:1898 dimhen at gmail dot com
` (6 preceding siblings ...)
2012-10-12 12:14 ` rguenth at gcc dot gnu.org
@ 2012-10-12 12:29 ` rguenth at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-10-12 12:29 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54898
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> 2012-10-12 12:29:12 UTC ---
Fixed.
^ permalink raw reply [flat|nested] 9+ messages in thread