middle-end/4907: ICE on premature use of reference

Gert-jan Los los@rz.uni-mannheim.de
Thu Nov 8 02:06:00 GMT 2001


>Number:         4907
>Category:       middle-end
>Synopsis:       ICE if a reference is used during its own definition
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-illegal-code
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 19 13:26:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Gert-jan Los
>Release:        3.1 20011113 (experimental)
>Organization:
Universitaet Mannheim
>Environment:
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
>Description:
	
	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.

>How-To-Repeat:
	int foo(int const& x) { return int(&x); }

	int main() {
		int const& c = foo(c);
		return 0;
	}

>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list