+2014-08-26 Joseph Myers <joseph@codesourcery.com>
+
+ PR target/60606
+ PR target/61330
+ * varasm.c (make_decl_rtl): Clear DECL_ASSEMBLER_NAME and
+ DECL_HARD_REGISTER and return for invalid register specifications.
+ * cfgexpand.c (expand_one_var): If expand_one_hard_reg_var clears
+ DECL_HARD_REGISTER, call expand_one_error_var.
+ * config/arm/arm.c (arm_hard_regno_mode_ok): Do not allow
+ CC_REGNUM with non-MODE_CC modes.
+ (arm_regno_class): Return NO_REGS for PC_REGNUM.
+
2014-08-26 Marek Polacek <polacek@redhat.com>
PR c/61271
else if (TREE_CODE (var) == VAR_DECL && DECL_HARD_REGISTER (var))
{
if (really_expand)
- expand_one_hard_reg_var (var);
+ {
+ expand_one_hard_reg_var (var);
+ if (!DECL_HARD_REGISTER (var))
+ /* Invalid register specification. */
+ expand_one_error_var (var);
+ }
}
else if (use_register_for_decl (var))
{
|| (TARGET_HARD_FLOAT && TARGET_VFP
&& regno == VFPCC_REGNUM));
+ if (regno == CC_REGNUM && GET_MODE_CLASS (mode) != MODE_CC)
+ return false;
+
if (TARGET_THUMB1)
/* For the Thumb we only allow values bigger than SImode in
registers 0 - 6, so that there is always a second low
enum reg_class
arm_regno_class (int regno)
{
+ if (regno == PC_REGNUM)
+ return NO_REGS;
+
if (TARGET_THUMB1)
{
if (regno == STACK_POINTER_REGNUM)
+2014-08-26 Joseph Myers <joseph@codesourcery.com>
+
+ PR target/60606
+ PR target/61330
+ * gcc.dg/torture/pr60606-1.c, gcc.target/arm/pr60606-2.c,
+ gcc.target/arm/pr60606-3.c, gcc.target/arm/pr60606-4.c: New tests.
+
2014-08-26 Dominik Vogt <vogt@linux.vnet.ibm.com>
* gfortran.dg/bessel_7.f90: Bump allowed precision to avoid
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-ffat-lto-objects" } */
+
+int
+f (void)
+{
+ register unsigned int r asm ("no-such-register"); /* { dg-error "invalid register name" } */
+ return r;
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+int
+f (void)
+{
+ register unsigned pc asm ("pc"); /* { dg-error "not general enough" } */
+
+ return pc > 0x12345678;
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+int
+f (void)
+{
+ register unsigned int r asm ("cc"); /* { dg-error "not general enough|suitable for data type" } */
+ return r;
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+int
+f (void)
+{
+ register unsigned int r[50] asm ("r1"); /* { dg-error "suitable for a register" } */
+ return r[1];
+}
/* As a register variable, it has no section. */
return;
}
+ /* Avoid internal errors from invalid register
+ specifications. */
+ SET_DECL_ASSEMBLER_NAME (decl, NULL_TREE);
+ DECL_HARD_REGISTER (decl) = 0;
+ return;
}
/* Now handle ordinary static variables and functions (in memory).
Also handle vars declared register invalidly. */