public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/54898] New: [4.8 regression] ICE in uniquify_nodes, at lto/lto.c:1898
@ 2012-10-11 10:10 dimhen at gmail dot com
  2012-10-11 10:11 ` [Bug lto/54898] " dimhen at gmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: dimhen at gmail dot com @ 2012-10-11 10:10 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54898

             Bug #: 54898
           Summary: [4.8 regression] ICE in uniquify_nodes, at
                    lto/lto.c:1898
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: dimhen@gmail.com


Created attachment 28421
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28421
1.c

gcc version 4.8.0 20121011 (experimental) [trunk revision 192347] (GCC)

$ gcc -fpreprocessed -c -flto 1.c -o 1.o
$ g++ -fpreprocessed -c -flto 2.cpp -o 2.o
$ g++ -O1 -flto -o f 1.o 2.o
lto1: internal compiler error: in uniquify_nodes, at lto/lto.c:1898
0x4d031e uniquify_nodes
    /home/dimhen/src/gcc-current/gcc/lto/lto.c:1898
0x4d28e9 lto_read_decls
    /home/dimhen/src/gcc-current/gcc/lto/lto.c:2081
0x4d28e9 lto_file_finalize
    /home/dimhen/src/gcc-current/gcc/lto/lto.c:2334
0x4d28e9 lto_create_files_from_ids
    /home/dimhen/src/gcc-current/gcc/lto/lto.c:2344
0x4d28e9 lto_file_read
    /home/dimhen/src/gcc-current/gcc/lto/lto.c:2384
0x4d28e9 read_cgraph_and_symbols
    /home/dimhen/src/gcc-current/gcc/lto/lto.c:2953
0x4d28e9 lto_main()
    /home/dimhen/src/gcc-current/gcc/lto/lto.c:3360
Please submit a full bug report,

err arose with 1.c about 500Kb long and 2.cpp about 1.5Mb long
i can attach original files

after creduce'ing they become 9Kb and 12Kb but compiles with numerous warnings


^ 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 ` 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

end of thread, other threads:[~2012-10-12 12:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).