Bug 4907 - [3.3/3.4 regression] ICE in make_decl_rtl, at varasm.c:797 if a reference is used during its own definition
Summary: [3.3/3.4 regression] ICE in make_decl_rtl, at varasm.c:797 if a reference is ...
Status: RESOLVED DUPLICATE of bug 11041
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 3.1
: P3 normal
Target Milestone: 3.3.1
Assignee: Not yet assigned to anyone
Keywords: ice-on-valid-code
Depends on:
Reported: 2001-11-19 13:26 UTC by los
Modified: 2004-01-17 04:22 UTC (History)
1 user (show)

See Also:
Host: *-*-*
Target: *-*-*
Build: *-*-*
Known to work:
Known to fail:
Last reconfirmed: 2003-06-02 09:04:32


Note You need to log in before you can comment on or make changes to this bug.
Description los 2001-11-19 13:26:01 UTC
 Compiling the presumably invalid code below gives an ICE on mainline
 and 2.95.x.

 gcc version 3.1 20011113 (experimental)
 : In function `int main()':
 :4: Internal compiler error in make_decl_rtl, at varasm.c:834

 gcc version 2.95.4 20011006 (Debian prerelease)
 : In function `int main()':
 :4: Internal compiler error:
 :4: Internal compiler error in `expand_expr', at expr.c:5852

 gcc version 3.0.2 (Debian)
 Compiles OK.  The value of c is 0 (zero).  Changing the code to return
 'x' instead '&x' results in a segmentation fault at runtime.

3.1 20011113 (experimental)

System: Linux snoopy 2.2.19 #1 Thu May 31 15:16:55 CEST 2001 sparc unknown
Architecture: sparc

host: sparc-unknown-linux-gnu
build: sparc-unknown-linux-gnu
target: sparc-unknown-linux-gnu
configured with: /users/los/admin/software/gcc/snapshot/configure --prefix=/opt/devel --with-as=/opt/devel/bin/as --with-ld=/opt/devel/bin/ld --disable-threads --disable-nls --enable-languages=c,c++ --enable-long-long

 int foo(int const& x) { return int(&x); }

 int main() {
  int const& c = foo(c);
  return 0;
Comment 1 Wolfgang Bangerth 2002-12-03 11:30:34 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed. Happens with every version I have.
Comment 2 Volker Reichelt 2003-06-02 17:46:52 UTC
I think the code is well-formed (although a warning would be nice).
The code actually compiles with gcc 3.0.x, but ICE's with gcc 2.95.x
and since 3.1.
Thus, we have a regression.

The problem is probably related to PR 11041.
Comment 3 Eric Botcazou 2003-06-18 10:02:42 UTC
Confirmed on x86 too.
Comment 4 Volker Reichelt 2003-06-19 19:39:37 UTC
The bug (also PR 11041) is fixed on the tree-ssa-branch.
Comment 5 Andrew Pinski 2003-06-19 19:50:05 UTC
Changing this to the middle end because the ICE is in varasm.c or expr.c which is in the middle-
Comment 6 Mark Mitchell 2003-06-20 01:23:50 UTC

*** This bug has been marked as a duplicate of 11041 ***