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; }
Created attachment 5795 [details] preprocessed file
Confirmed, a regression from 2.95.3.
Should this really be valid code? I can't imagine any reasonable semantics for it...
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.
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
*** Bug 14487 has been marked as a duplicate of this bug. ***
Been fixed on the mainline now.
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
Fixed in 3.4.0 also.
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
Fixed for 3.3.4, 3.4.0, and 3.5.0.