This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Check for missing registers in target initializer macros
- From: Bernardo Innocenti <bernie at develer dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 05 Jun 2004 10:35:39 +0200
- Subject: [patch] Check for missing registers in target initializer macros
- Organization: Develer S.r.l.
Hello,
such a check would have immediately catched the error in m68k.h that
drove us crazy three months ago.
The test condition is constant so it's actually compiled out in optimized
builds.
Built cc1 and executed it once on i386-linux and m68k-uclinux.
OK for mainline?
2004-06-05 Bernardo Innocenti <bernie@develer.com>
* regclass.c (init_reg_sets): Check for missing registers in target
initializer macros FIXED_REGISTERS and CALL_USED_REGISTERS.
diff -u -p -r1.186 regclass.c
--- gcc-HEAD.orig/gcc/regclass.c 3 Mar 2004 08:34:33 -0000 1.186
+++ gcc-HEAD/gcc/regclass.c 5 Jun 2004 08:21:10 -0000
@@ -278,6 +278,12 @@ init_reg_sets (void)
SET_HARD_REG_BIT (reg_class_contents[i], j);
}
+ /* Sanity check: make sure the target macros FIXED_REGISTERS and
+ CALL_USED_REGISTERS had the right number of initializers. */
+ if (sizeof fixed_regs != sizeof initial_fixed_regs
+ || sizeof call_used_regs != sizeof initial_call_used_regs)
+ abort();
+
memcpy (fixed_regs, initial_fixed_regs, sizeof fixed_regs);
memcpy (call_used_regs, initial_call_used_regs, sizeof call_used_regs);
memset (global_regs, 0, sizeof global_regs);
--
// Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/ http://www.develer.com/