* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@79127
138bc75d-0d04-0410-961f-
82ee72b054a4
+2004-03-08 Roger Sayle <roger@eyesopen.com>
+
+ 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.
+
2004-03-08 Ulrich Weigand <uweigand@de.ibm.com>
* config/s390/s390.md ("*extendqidi2_short_displ"): Add CC clobber.
if (DECL_REGISTER (x) && !TREE_ADDRESSABLE (x)
&& DECL_NONLOCAL (x))
{
- if (TREE_PUBLIC (x))
+ if (TREE_PUBLIC (x) || TREE_STATIC (x) || DECL_EXTERNAL (x))
{
error ("global register variable `%s' used in nested function",
IDENTIFIER_POINTER (DECL_NAME (x)));
}
else if (DECL_REGISTER (x) && !TREE_ADDRESSABLE (x))
{
- if (TREE_PUBLIC (x))
+ if (TREE_PUBLIC (x) || TREE_STATIC (x) || DECL_EXTERNAL (x))
{
error ("address of global register variable `%s' requested",
IDENTIFIER_POINTER (DECL_NAME (x)));
static void
put_reg_into_stack (struct function *function, rtx reg, tree type,
- enum machine_mode promoted_mode, enum machine_mode decl_mode,
- int volatile_p, unsigned int original_regno, int used_p, htab_t ht)
+ enum machine_mode promoted_mode,
+ enum machine_mode decl_mode, int volatile_p,
+ unsigned int original_regno, int used_p, htab_t ht)
{
struct function *func = function ? function : cfun;
rtx new = 0;
regno = REGNO (reg);
if (regno < func->x_max_parm_reg)
- new = func->x_parm_reg_stack_loc[regno];
+ {
+ if (!func->x_parm_reg_stack_loc)
+ abort ();
+ new = func->x_parm_reg_stack_loc[regno];
+ }
if (new == 0)
new = assign_stack_local_1 (decl_mode, GET_MODE_SIZE (decl_mode), 0, func);
+2004-03-08 Roger Sayle <roger@eyesopen.com>
+
+ PR middle-end/14289
+ * gcc.dg/pr14289-1.c: New test case.
+ * gcc.dg/pr14289-2.c: Likewise.
+ * gcc.dg/pr14289-3.c: Likewise.
+
2004-03-08 Eric Botcazou <ebotcazou@act-europe.fr>
* gcc.c-torture/execute/20040308-1.c: New test.
--- /dev/null
+/* PR middle-end/14289 */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O0" } */
+
+register int a[2] asm("ebx");
+
+void Nase(void)
+{
+ int i=6;
+ a[i]=5; /* { dg-error "address of global" } */
+}
+
--- /dev/null
+/* PR middle-end/14289 */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O0" } */
+
+static register int a[2] asm("ebx"); /* { dg-error "multiple storage" } */
+
+void Nase(void)
+{
+ int i=6;
+ a[i]=5; /* { dg-error "address of global" } */
+}
+
--- /dev/null
+/* PR middle-end/14289 */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O0" } */
+
+extern register int a[2] asm("ebx"); /* { dg-error "multiple storage" } */
+
+void Nase(void)
+{
+ int i=6;
+ a[i]=5; /* { dg-error "address of global" } */
+}
+