Bug 14289 - [3.3 Regression] ICE in a register array
Summary: [3.3 Regression] ICE in a register array
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 3.3.2
: P2 normal
Target Milestone: 3.3.4
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-invalid-code
: 14487 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-02-25 11:04 UTC by ilaria meccoli
Modified: 2004-10-30 21:10 UTC (History)
2 users (show)

See Also:
Host: linux 2.4 on i386
Target: linux 2.4 on i386
Build:
Known to work: 2.95.3 3.4.0 4.0.0
Known to fail: 3.0.4 3.3.1
Last reconfirmed: 2004-02-25 15:35:05


Attachments
preprocessed file (118 bytes, text/plain)
2004-02-25 11:09 UTC, ilaria meccoli
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ilaria meccoli 2004-02-25 11:04:37 UTC
should it be a compilation error???

COMMAND:
gcc -S -O0 -save-temps pippo.c

OUTPUT:
pippo.c: In function `Nase':
pippo.c:5: warning: address of register variable `a' requested
pippo.c:5: internal compiler error: Segmentation fault

PREPROCESSED FILE:
# 1 "pippo.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "pippo.c"
register int a[2] asm("ebx");
void Nase(void)
{
        int i=6;
        a[i]=5;
}
Comment 1 ilaria meccoli 2004-02-25 11:09:25 UTC
Created attachment 5795 [details]
preprocessed file
Comment 2 Andrew Pinski 2004-02-25 15:35:04 UTC
Confirmed, a regression from 2.95.3.
Comment 3 Falk Hueffner 2004-02-25 16:35:16 UTC
Should this really be valid code? I can't imagine any reasonable semantics for 
it...
Comment 4 Mark Mitchell 2004-03-01 00:08:49 UTC
This code is not valid, despite being accepted by GCC 2.95.3.

While we should certainly issue a better error message, this is not a
showstopper; I have moved the target milestone to 3.4.1.
Comment 5 GCC Commits 2004-03-08 21:56:46 UTC
Subject: Bug 14289

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	sayle@gcc.gnu.org	2004-03-08 21:56:37

Modified files:
	gcc            : ChangeLog c-typeck.c function.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: pr14289-1.c pr14289-2.c pr14289-3.c 

Log message:
	PR middle-end/14289
	* c-typeck.c (c_mark_addressable): A register variable should
	be considered global if its not automatic, i.e. TREE_PUBLIC,
	TREE_STATIC or DECL_EXTERNAL.
	* function.c (put_var_into_stack): Call abort when placing a
	hard register into the stack, if x_parm_reg_stack_loc is NULL.
	
	* gcc.dg/pr14289-1.c: New test case.
	* gcc.dg/pr14289-2.c: Likewise.
	* gcc.dg/pr14289-3.c: Likewise.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.3097&r2=2.3098
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&r1=1.282&r2=1.283
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/function.c.diff?cvsroot=gcc&r1=1.501&r2=1.502
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3581&r2=1.3582
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pr14289-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pr14289-2.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pr14289-3.c.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 6 Andrew Pinski 2004-03-08 22:02:28 UTC
*** Bug 14487 has been marked as a duplicate of this bug. ***
Comment 7 Andrew Pinski 2004-03-08 22:03:35 UTC
Been fixed on the mainline now.
Comment 8 GCC Commits 2004-03-09 17:44:19 UTC
Subject: Bug 14289

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	sayle@gcc.gnu.org	2004-03-09 17:44:14

Modified files:
	gcc            : ChangeLog c-typeck.c function.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: pr14289-1.c pr14289-2.c pr14289-3.c 

Log message:
	PR middle-end/14289
	* c-typeck.c (c_mark_addressable): A register variable should
	be considered global if its not automatic, i.e. TREE_PUBLIC,
	TREE_STATIC or DECL_EXTERNAL.
	* function.c (put_var_into_stack): Call abort when placing a
	hard register into the stack, if x_parm_reg_stack_loc is NULL.
	
	* gcc.dg/pr14289-1.c: New test case.
	* gcc.dg/pr14289-2.c: Likewise.
	* gcc.dg/pr14289-3.c: Likewise.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.317&r2=2.2326.2.318
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.272.2.3&r2=1.272.2.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/function.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.483.4.7&r2=1.483.4.8
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.135&r2=1.3389.2.136
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pr14289-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pr14289-2.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pr14289-3.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1

Comment 9 Andrew Pinski 2004-03-09 18:43:48 UTC
Fixed in 3.4.0 also.
Comment 10 GCC Commits 2004-03-10 18:37:31 UTC
Subject: Bug 14289

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	sayle@gcc.gnu.org	2004-03-10 18:37:26

Modified files:
	gcc            : ChangeLog c-typeck.c function.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: pr14289-1.c pr14289-2.c pr14289-3.c 

Log message:
	PR middle-end/14289
	* c-typeck.c (c_mark_addressable): A register variable should
	be considered global if its not automatic, i.e. TREE_PUBLIC,
	TREE_STATIC or DECL_EXTERNAL.
	* function.c (put_var_into_stack): Call abort when placing a
	hard register into the stack, if x_parm_reg_stack_loc is NULL.
	
	* gcc.dg/pr14289-1.c: New test case.
	* gcc.dg/pr14289-2.c: Likewise.
	* gcc.dg/pr14289-3.c: Likewise.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.929&r2=1.16114.2.930
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.213.2.11&r2=1.213.2.12
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/function.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.389.2.14&r2=1.389.2.15
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.364&r2=1.2261.2.365
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pr14289-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pr14289-2.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pr14289-3.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.4.1

Comment 11 Andrew Pinski 2004-03-10 18:41:48 UTC
Fixed for 3.3.4, 3.4.0, and 3.5.0.