This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
mode_mask_array not initialized for EXTRA_CC_MODES
- To: egcs-patches at cygnus dot com
- Subject: mode_mask_array not initialized for EXTRA_CC_MODES
- From: Richard Earnshaw <rearnsha at arm dot com>
- Date: Tue, 20 Oct 1998 17:18:37 +0100
- Cc: richard dot earnshaw at arm dot com
- Organization: ARM Ltd.
- Reply-To: richard dot earnshaw at arm dot com
The recent change to add mode_mask_array doesn't initialize the array for
EXTRA_CC_MODES -- these are then used by nonzero_bits and like functions,
but contain garbage, causing the ARM port to perform incorrect
optimizations. Patch below:
<date> Richard Earnshaw <rearnsha@arm.com>
* machmode.h (mode_mask_array): No longer const.
* rtl.c (init_rtl): Fully initialize it if EXTRA_CC_MODES defined.
Index: machmode.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/machmode.h,v
retrieving revision 1.6
diff -p -r1.6 machmode.h
*** machmode.h 1998/10/09 15:50:23 1.6
--- machmode.h 1998/10/20 16:07:31
*************** extern int mode_unit_size[];
*** 196,202 ****
/* Get a bitmask containing 1 for all bits in a word
that fit within mode MODE. */
! extern const unsigned HOST_WIDE_INT mode_mask_array[];
#define GET_MODE_MASK(MODE) mode_mask_array[(int) (MODE)]
--- 196,202 ----
/* Get a bitmask containing 1 for all bits in a word
that fit within mode MODE. */
! extern unsigned HOST_WIDE_INT mode_mask_array[];
#define GET_MODE_MASK(MODE) mode_mask_array[(int) (MODE)]
Index: rtl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/rtl.c,v
retrieving revision 1.21
diff -p -r1.21 rtl.c
*** rtl.c 1998/10/14 10:37:05 1.21
--- rtl.c 1998/10/20 16:07:31
*************** unsigned char mode_wider_mode[(int) MAX_
*** 122,128 ****
/* Indexed by machine mode, gives mask of significant bits in mode. */
! const unsigned HOST_WIDE_INT mode_mask_array[(int) MAX_MACHINE_MODE] = {
#include "machmode.def"
};
--- 122,128 ----
/* Indexed by machine mode, gives mask of significant bits in mode. */
! unsigned HOST_WIDE_INT mode_mask_array[(int) MAX_MACHINE_MODE] = {
#include "machmode.def"
};
*************** init_rtl ()
*** 901,906 ****
--- 901,907 ----
for (i = (int) CCmode + 1; i < (int) MAX_MACHINE_MODE; i++)
{
mode_class[i] = MODE_CC;
+ mode_mask_array[i] = mode_mask_array[(int) CCmode];
mode_size[i] = mode_size[(int) CCmode];
mode_unit_size[i] = mode_unit_size[(int) CCmode];
mode_wider_mode[i - 1] = i;