Make sure that REAL_MODE_FORMAT aborts if it is passed an invalid mode,
rather than stepping beyond the bounds of an array. It turned out that
some code was passing non-float modes to the real.h routines.
Tested on x86_64-linux-gnu, arm-linux-gnueabi and aarch64-linux-gnu.
gcc/
* real.h (REAL_MODE_FORMAT): Abort if the mode isn't a
SCALAR_FLOAT_MODE_P.
From-SVN: r229579
+2015-10-30 Richard Sandiford <richard.sandiford@arm.com>
+
+ * real.h (REAL_MODE_FORMAT): Abort if the mode isn't a
+ SCALAR_FLOAT_MODE_P.
+
2015-10-30 Alan Lawrence <alan.lawrence@arm.com>
* tree-sra.c (scalarizable_type_p): Comment variable-length arrays.
(real_format_for_mode[DECIMAL_FLOAT_MODE_P (MODE) \
? (((MODE) - MIN_MODE_DECIMAL_FLOAT) \
+ (MAX_MODE_FLOAT - MIN_MODE_FLOAT + 1)) \
- : ((MODE) - MIN_MODE_FLOAT)])
+ : GET_MODE_CLASS (MODE) == MODE_FLOAT \
+ ? ((MODE) - MIN_MODE_FLOAT) \
+ : (gcc_unreachable (), 0)])
#define FLOAT_MODE_FORMAT(MODE) \
(REAL_MODE_FORMAT (SCALAR_FLOAT_MODE_P (MODE)? (MODE) \