Bug 12920 - [tree-ssa] compiler fails to build gdb
Summary: [tree-ssa] compiler fails to build gdb
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: tree-ssa
: P2 critical
Target Milestone: tree-ssa
Assignee: Jason Merrill
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2003-11-05 22:06 UTC by Brian Booth
Modified: 2003-12-17 07:11 UTC (History)
2 users (show)

See Also:
Host:
Target: ia64-unknown-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed: 2003-12-16 23:21:17


Attachments
Associated .i file (77.58 KB, application/octet-stream)
2003-11-05 22:07 UTC, Brian Booth
Details
Debugger Output (1.54 KB, application/octet-stream)
2003-11-05 22:08 UTC, Brian Booth
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Booth 2003-11-05 22:06:54 UTC
Occurred on the following version of tree-ssa:
    gcc (GCC) 3.5-tree-ssa 20031105 (merged 20031026)

Configure options given to GCC:
    --prefix=/notnfs/bbooth/ia64/inst --srcdir=/notnfs/bbooth/gcc 
    --disable-multilib

Command line that fails and compiler output:

/notnfs/bbooth/tree-ssa/ia64/gcc/cc1 -fpreprocessed tracepoint.i -qui
rith -Wuninitialized -version -ftime-report -o tracepoint.s
cc1: warning: -Wuninitialized is not supported without -O
GNU C version 3.5-tree-ssa 20031105 (merged 20031026) (ia64-unknown-linux-gnu)
        compiled by GNU C version 3.2.3 20030422 (Red Hat Linux 3.2.3-12).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
/notnfs/bbooth/tree-ssa/GDB/gdb-6.0/gdb/tracepoint.c: In function `stringify_colle

/notnfs/bbooth/tree-ssa/GDB/gdb-6.0/gdb/tracepoint.c:1387: internal compiler error
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

================

.i file to come.
Comment 1 Brian Booth 2003-11-05 22:07:48 UTC
Created attachment 5069 [details]
Associated .i file
Comment 2 Brian Booth 2003-11-05 22:08:37 UTC
Created attachment 5070 [details]
Debugger Output
Comment 3 Falk Hueffner 2003-11-05 23:32:28 UTC
Confirmed on alpha-linux 3.5-tree-ssa 20031105. Smaller test case:

void stringify_collection_list(char *(*str_list)[])
{
  (*str_list)[0] = 0;
}
Comment 4 Falk Hueffner 2003-11-12 16:54:10 UTC
backtrace on 3.5-tree-ssa 20031112 alpha-linux:

Starting program: /src/gcc-tree-ssa-2003.11.12/build/gcc/cc1 /tmp/test.c
 stringify_collection_list

Breakpoint 1, fancy_abort (file=0x120454fe8 "../../gcc/stor-layout.c",
    line=290, function=0x120454dd9 "int_mode_for_mode")
    at ../../gcc/diagnostic.c:584
584       internal_error ("in %s, at %s:%d", function, trim_filename (file), line);
(gdb) bt
#0  fancy_abort (file=0x120454fe8 "../../gcc/stor-layout.c", line=290,
    function=0x120454dd9 "int_mode_for_mode") at ../../gcc/diagnostic.c:584
#1  0x0000000120302b08 in int_mode_for_mode (mode=BLKmode)
    at ../../gcc/stor-layout.c:290
#2  0x00000001201a0504 in store_bit_field (str_rtx=0x20000297038, bitsize=64,
    bitnum=0, fieldmode=DImode, value=0x200001ea400, total_size=-1)
    at ../../gcc/expmed.c:376
#3  0x00000001201c5dc0 in store_field (target=0x20000297038, bitsize=64,
    bitpos=0, mode=DImode, exp=0x200001ed800, value_mode=VOIDmode,
    unsignedp=1, type=0x200002f97a0, alias_set=0) at ../../gcc/expr.c:5258
#4  0x00000001201c6538 in expand_assignment (to=0x200001f0be0,
    from=0x200001ed800, want_value=3119008) at ../../gcc/expr.c:3843
#5  0x00000001201b0d24 in expand_expr_1 (exp=0x200001f0c30,
    target=0x200001ea400, tmode=VOIDmode, modifier=EXPAND_NORMAL)
    at ../../gcc/expr.c:8907
#6  0x00000001201c2014 in expand_expr (exp=0x200001f0c30,
    target=0x200001ea400, tmode=VOIDmode, modifier=EXPAND_NORMAL)
    at ../../gcc/expr.c:6291
#7  0x00000001201b5310 in expand_expr_1 (exp=0x200001f0cd0,
    target=0x200001f0d10, tmode=VOIDmode, modifier=EXPAND_NORMAL)
    at ../../gcc/expr.c:6851
#8  0x00000001201c2054 in expand_expr (exp=0x200001f0cd0,
    target=0x200001ea400, tmode=VOIDmode, modifier=EXPAND_NORMAL)
    at ../../gcc/expr.c:6298
#9  0x00000001202f734c in expand_expr_stmt_value (exp=0x200001f0cd0,
    want_value=0, maybe_last=541412825) at ../../gcc/stmt.c:2222
#10 0x0000000120060084 in expand_stmt_toplev (t=0x120454fe8)
    at ../../gcc/c-semantics.c:920
#11 0x00000001200bd4dc in tree_rest_of_compilation (fndecl=0x200002f9b20,
    nested_p=false) at ../../gcc/tree-optimize.c:341
#12 0x0000000120021888 in c_expand_body_1 (fndecl=0x200002f9b20, nested_p=0)
    at ../../gcc/c-decl.c:6202
#13 0x000000012035f538 in cgraph_expand_function (node=0x200002fbc80)
    at ../../gcc/cgraphunit.c:497
#14 0x000000012035f6cc in cgraph_assemble_pending_functions ()
    at ../../gcc/cgraphunit.c:142
#15 0x0000000120360a00 in cgraph_finalize_function (decl=0x200002f9b20,
    nested=false) at ../../gcc/cgraphunit.c:221
#16 0x0000000120021da0 in finish_function () at ../../gcc/c-decl.c:6158
#17 0x000000012000446c in yyparse () at c-parse.y:386
#18 0x000000012000bd28 in c_parse_file () at c-parse.y:3033
#19 0x0000000120059d90 in c_common_parse_file (set_yydebug=541413352)
    at ../../gcc/c-opts.c:1221
#20 0x0000000120311dd8 in toplev_main (argc=541832248, argv=0x11ffff665)
    at ../../gcc/toplev.c:1876
#21 0x0000000120093e38 in main (argc=541413352, argv=0x122)
    at ../../gcc/main.c:35
(gdb) 
Comment 5 Steven Bosscher 2003-11-13 23:35:47 UTC
May be a 64 bit thing, I can't reproduce this on i686-pc-linux-gnu 
Comment 6 Andrew Pinski 2003-11-13 23:42:53 UTC
I cannot reproduce this on powerpc-apple-darwin either.
Comment 7 Daniel Berlin 2003-11-14 05:54:06 UTC
Subject: Re:  [tree-ssa] compiler fails to build gdb

> May be a 64 bit thing, I can't reproduce this on i686-pc-linux-gnu


I'll give it a whirl on ppc64 sometime this weekend.

Comment 8 Andrew Pinski 2003-12-05 00:08:31 UTC
Here is a case where it fails on powerpc (from an email from Fariborz Jahanian):
float (*x)[];
void a_tether( ) {
 (*x)[20] = 3.0;
}
Comment 9 Fariborz Jahanian 2003-12-05 19:39:30 UTC
This bug was introduced when the second conditional in routine build_array_ref was removed in 
the tree-ssa branch.
Was this intentional or a merge mishap?

Thanks, Fariborz

  if (TREE_CODE (TREE_TYPE (array)) == ARRAY_TYPE
      && TREE_CODE (array) != INDIRECT_REF)
	   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^    <- condition removed in tree-ssa
Comment 10 Andrew Pinski 2003-12-05 19:50:14 UTC
It was intentational removed:
        * builtins.c (fold_builtin): Use get_callee_fndecl.

        * attribs.c (decl_attributes): Rebuild the function pointer type after
        changing the target type.
        * tree.c (get_qualified_type): Also check that the attributes match.

        * c-typeck.c (build_array_ref): Also build ARRAY_REFs from
        INDIRECT_REFs of ARRAY_TYPE.

        * tree-ssa.c (tree_ssa_useless_type_conversion): Also strip
        conversions between pointer and reference types.

        * tree-dfa.c (get_stmt_operands): Just mark non-GIMPLE statements
        as unmodified.
        (find_referenced_vars): So we don't need to mark them here.

        * tree-inline.c (inline_data): Add retvar field.
        (declare_return_variable): Set it.
        (remap_decls): Use it.
        (expand_call_inline): Tweak.
cp/
        * typeck.c (build_array_ref): Also build ARRAY_REFs from
        INDIRECT_REFs of ARRAY_TYPE.

        * semantics.c (finish_id_expression): Unshare aliases.
Comment 11 Andrew Pinski 2003-12-05 19:53:04 UTC
Here is the patch <http://gcc.gnu.org/ml/gcc-patches/2003-08/msg01135.html>.

The problem is really is in the Tree to RTL converters.
Comment 12 Andrew Pinski 2003-12-08 23:54:04 UTC
Jason could you look into this, your patch caused it.
Comment 13 GCC Commits 2003-12-17 05:40:33 UTC
Subject: Bug 12920

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	tree-ssa-20020619-branch
Changes by:	jason@gcc.gnu.org	2003-12-17 05:40:23

Modified files:
	gcc            : ChangeLog.tree-ssa stor-layout.c c-decl.c 
	gcc/cp         : ChangeLog.tree-ssa decl.c 

Log message:
	PR middle-end/12920
	* stor-layout.c (layout_type): Just return if type is
	error_mark_node.
	* c-decl.c (grokdeclarator): Immediately layout an
	ARRAY_TYPE used in a pointer-to-array declarator.
	* cp/decl.c (grokdeclarator): Immediately layout an
	ARRAY_TYPE used in a pointer-to-array declarator.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.tree-ssa.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.1018&r2=1.1.2.1019
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/stor-layout.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.126.2.25&r2=1.126.2.26
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.334.2.72&r2=1.334.2.73
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.tree-ssa.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.59&r2=1.1.2.60
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.911.2.57&r2=1.911.2.58

Comment 14 Andrew Pinski 2003-12-17 07:11:58 UTC
Fixed.