Bug 28217 - [4.0 regression] ICE in tree_int_cst_sgn
: [4.0 regression] ICE in tree_int_cst_sgn
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: c++
: 4.2.0
: P1 normal
: 4.1.2
Assigned To: Not yet assigned to anyone
: http://gcc.gnu.org/ml/gcc/2006-07/msg...
: ice-on-valid-code, monitored
: 28290
:
  Show dependency treegraph
 
Reported: 2006-07-01 21:51 UTC by Andreas Schwab
Modified: 2007-02-03 17:49 UTC (History)
14 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.1.2 4.2.0
Known to fail: 4.1.0 4.1.1
Last reconfirmed: 2006-10-21 21:32:51


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Schwab 2006-07-01 21:51:40 UTC
/tmp/cvs/gcc-20060701/Build/./gcc/xgcc -shared-libgcc
-B/tmp/cvs/gcc-20060701/Build/./gcc -nostdinc++
-L/tmp/cvs/gcc-20060701/Build/ia64-suse-linux/libstdc++-v3/src
-L/tmp/cvs/gcc-20060701/Build/ia64-suse-linux/libstdc++-v3/src/.libs
-B/tmp/cvs/gcc-20060701/Build/root/ia64-suse-linux/bin/
-B/tmp/cvs/gcc-20060701/Build/root/ia64-suse-linux/lib/ -isystem
/tmp/cvs/gcc-20060701/Build/root/ia64-suse-linux/include -isystem
/tmp/cvs/gcc-20060701/Build/root/ia64-suse-linux/sys-include -Winvalid-pch
-Wno-deprecated -xc++-header -O2 -g  -D_GNU_SOURCE
-I/tmp/cvs/gcc-20060701/Build/ia64-suse-linux/libstdc++-v3/include/ia64-suse-linux
-I/tmp/cvs/gcc-20060701/Build/ia64-suse-linux/libstdc++-v3/include
-I/tmp/cvs/gcc-20060701/libstdc++-v3/libsupc++
/tmp/cvs/gcc-20060701/libstdc++-v3/include/precompiled/extc++.h -O2 -g -o
./ia64-suse-linux/bits/extc++.h.gch/O2g.gch
/tmp/cvs/gcc-20060701/Build/ia64-suse-linux/libstdc++-v3/include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp:235:
internal compiler error: tree check: expected integer_cst, have scope_ref in
tree_int_cst_sgn, at tree.c:4476

#1  0x40000000008cd430 in tree_check_failed (node=0x200000000189da40, 
    file=0x4000000000d013b8 "../../gcc/tree.c", line=4476, 
    function=0x4000000000d03d98 "tree_int_cst_sgn") at ../../gcc/tree.c:6059
6059      internal_error ("tree check: %s, have %s in %s, at %s:%d",
(gdb) up
#2  0x40000000008cf5b0 in tree_int_cst_sgn (t=0x200000000189da40)
    at ../../gcc/tree.c:4476
4476      if (TREE_INT_CST_LOW (t) == 0 && TREE_INT_CST_HIGH (t) == 0)
(gdb) p t
$1 = (tree) 0x200000000189da40
(gdb) pt t
 <scope_ref 0x200000000189da40
    arg 0 <record_type 0x2000000001f9a050 is_simple<Key> type_0 type_5 type_6
VOID
        align 8 symtab 0 alias set -1 context <namespace_decl
0x2000000001dd1ad0 detail>
        no-binfo use_template=1 interface-unknown
        chain <type_decl 0x2000000001f9f5a0 is_simple<Key>>>
    arg 1 <identifier_node 0x200000010615bbc0 value
    bindings <(nil)>
    local bindings <(nil)>>>
(gdb) up
During symbol reading, unsupported tag: 'DW_TAG_const_type'.
#3  0x4000000000235010 in write_template_arg_literal (
    value=<value optimized out>) at ../../gcc/cp/mangle.c:1216
1216      int sign = tree_int_cst_sgn (cst);
(gdb) up
#4  0x4000000000237da0 in write_template_args (args=0x2000000002aa6e40)
    at ../../gcc/cp/mangle.c:2310
2310        write_template_arg_literal (node);
(gdb) p args
$2 = (tree) 0x2000000002aa6e40
(gdb) pt
 <tree_vec 0x2000000002aa6e40
    elt 0 <const_decl 0x2000000001cba260 simple_value>
    elt 1 <template_type_parm 0x200000000189b180 Value_Type>
    elt 2 <typename_type 0x2000000001846730 pointer>>
(gdb) p *mangle_obstack 
$10 = {chunk_size = 4064, chunk = 0x6000000000219dc0, 
  object_base = 0x600000000021a2be
"_ZN5pb_ds6detail12binary_heap_IT_T0_T1_E6modifyENS0_33binary_heap_const_point_iterator_IS2_NS0_16conditional_typeILNS5_5._199E",
next_free = 0x600000000021a33c "", chunk_limit = 0x600000000021ada0 "", 
  temp = 0, alignment_mask = 0, 
  chunkfun = @0x4000000000d84880: 0x4000000000c38e00 <xmalloc>, 
  freefun = 0x2000000000046798 <local+4696>, extra_arg = 0x0, 
  use_extra_arg = 0, maybe_empty_object = 0, alloc_failed = 0}
Comment 1 Andreas Schwab 2006-07-02 14:53:59 UTC
*** Bug 28219 has been marked as a duplicate of this bug. ***
Comment 2 Richard Guenther 2006-07-04 14:39:56 UTC
Testcase?  Works for me...
Comment 3 Andrew Pinski 2006-07-04 14:48:01 UTC
I want to say this was fixed by:
http://gcc.gnu.org/ml/gcc-cvs/2006-07/msg00011.html

And this works for me also.
Comment 4 Andreas Schwab 2006-07-04 14:52:48 UTC
Still crashes as of today.
Comment 5 fnf@specifix.com 2006-07-04 15:42:53 UTC
Subject: Re:  [4.2 regression] ICE in tree_int_cst_sgn

On Tuesday 04 July 2006 10:39, rguenth at gcc dot gnu dot org wrote:
> Testcase?  Works for me...

28219 has a testcase

-Fred
Comment 6 Andrew Pinski 2006-07-04 15:47:04 UTC
(In reply to comment #5)
> 28219 has a testcase

It does not have a full testcase as you also need the other PCH header file to
try it out.
Comment 7 Andrew Pinski 2006-07-06 22:17:00 UTC
*** Bug 28290 has been marked as a duplicate of this bug. ***
Comment 8 Andreas Schwab 2006-07-11 08:44:58 UTC
This is now causing bootstrap to fail.
Comment 9 fnf@specifix.com 2006-07-11 09:08:25 UTC
Subject: Re:  [4.2 regression] ICE in tree_int_cst_sgn

On Tuesday 11 July 2006 04:44, schwab at suse dot de wrote:
> This is now causing bootstrap to fail.

I'm currently configuring with --disable-libstdcxx-pch to work around
the problem.
Comment 10 David Edelsohn 2006-07-11 13:28:23 UTC
This now causes bootstrap failure on primary platforms.
Comment 11 Mike Stump 2006-07-11 18:31:20 UTC
I've posted a patch to fix this.
Comment 12 Volker Reichelt 2006-07-12 15:03:15 UTC
Reduced (from PR 28219) testcase:

=============================
template<int> struct A
{
  enum { a, b = a };
  void foo(A<b>);
};
=============================

bug.h:4: internal compiler error: tree check: expected integer_cst, have
const_decl in tree_int_cst_sgn, at tree.c:4517
Please submit a full bug report, [etc.]

If I replace "A<b>" by "A<a>" I get a segfault instead.
The testcase crashes since GCC 4.0.0.
The code compiles fine if I compile it as regular C++ file and not
as C++-header.
Comment 13 Benjamin Kosnik 2006-07-12 17:15:18 UTC
Volker, great job on the reduction for this. I am once again amazed.

-benjamin
Comment 14 Jason Merrill 2006-07-12 21:58:06 UTC
Subject: Bug 28217

Author: jason
Date: Wed Jul 12 21:57:58 2006
New Revision: 115399

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115399
Log:
        PR c++/28217
        * semantics.c (note_decl_for_pch): Don't premangle templates.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/semantics.c
Comment 15 Andrew Pinski 2006-07-13 01:11:27 UTC
Fixed on the mainline at least.
Comment 16 Volker Reichelt 2006-07-13 13:21:21 UTC
Jason, would you mind adding a testcase? Thanks!
Comment 17 Jakub Jelinek 2007-01-03 23:53:28 UTC
Subject: Bug 28217

Author: jakub
Date: Wed Jan  3 23:53:18 2007
New Revision: 120410

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=120410
Log:
    PR c++/28217
    * g++.dg/pch/template-1.C: New test.
    * g++.dg/pch/template-1.Hs: New file.

Added:
    trunk/gcc/testsuite/g++.dg/pch/template-1.C
    trunk/gcc/testsuite/g++.dg/pch/template-1.Hs
Modified:
    trunk/gcc/testsuite/ChangeLog
Comment 18 Jakub Jelinek 2007-01-03 23:54:33 UTC
Subject: Bug 28217

Author: jakub
Date: Wed Jan  3 23:54:24 2007
New Revision: 120411

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=120411
Log:
    PR c++/28217
    * g++.dg/pch/template-1.C: New test.
    * g++.dg/pch/template-1.Hs: New file.

Added:
    branches/gcc-4_2-branch/gcc/testsuite/g++.dg/pch/template-1.C
    branches/gcc-4_2-branch/gcc/testsuite/g++.dg/pch/template-1.Hs
Modified:
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog
Comment 19 Jakub Jelinek 2007-01-03 23:56:58 UTC
Subject: Bug 28217

Author: jakub
Date: Wed Jan  3 23:56:44 2007
New Revision: 120412

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=120412
Log:
    Backported from mainline
    2006-07-12  Jason Merrill  <jason@redhat.com>
    PR c++/28217
    * semantics.c (note_decl_for_pch): Don't premangle templates.

    * g++.dg/pch/template-1.C: New test.
    * g++.dg/pch/template-1.Hs: New file.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/pch/template-1.C
    branches/gcc-4_1-branch/gcc/testsuite/g++.dg/pch/template-1.Hs
Modified:
    branches/gcc-4_1-branch/gcc/cp/ChangeLog
    branches/gcc-4_1-branch/gcc/cp/semantics.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
Comment 20 Jakub Jelinek 2007-01-04 00:01:24 UTC
Fixed in 4.1 as well.
Comment 21 Gabriel Dos Reis 2007-02-03 17:49:44 UTC
Fixed in GCC-4.1.2