aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIlya Leoshkevich <iii@linux.ibm.com>2018-09-25 06:38:20 +0000
committerIlya Leoshkevich <iii@gcc.gnu.org>2018-09-25 06:38:20 +0000
commitd5c4f75ddbf2994b6c462ed4b624ab5fcf23674f (patch)
treedfab1d5f8d007337eaf612fa53c320d10aa138c9 /gcc
parent75902396e6dbed2a3cacb42452992db156c6f32f (diff)
downloadgcc-d5c4f75ddbf2994b6c462ed4b624ab5fcf23674f.zip
gcc-d5c4f75ddbf2994b6c462ed4b624ab5fcf23674f.tar.gz
gcc-d5c4f75ddbf2994b6c462ed4b624ab5fcf23674f.tar.bz2
Fix EQ_ATTR_ALT size calculation (PR bootstrap/87417)
"r264537: Change EQ_ATTR_ALT to support up to 64 alternatives" changed the format of EQ_ATTR_ALT from ii to ww. This broke the bootstrap on 32-bit systems, because the formula for rtx_code_size assumed that only certain codes contain HOST_WIDE_INTs. This did not surface on 64-bit systems, because rtunion is 8 bytes anyway, but on 32-bit systems it's only 4 bytes. This resulted in out-of-bounds writes and memory corruptions in genattrtab. gcc/ChangeLog: 2018-09-25 Ilya Leoshkevich <iii@linux.ibm.com> PR bootstrap/87417 * rtl.c (rtx_code_size): Take into account that EQ_ATTR_ALT contains HOST_WIDE_INTs when computing its size. From-SVN: r264556
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/rtl.c3
2 files changed, 7 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c6b3167..84f4c5a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2018-09-25 Ilya Leoshkevich <iii@linux.ibm.com>
+
+ PR bootstrap/87417
+ * rtl.c (rtx_code_size): Take into account that EQ_ATTR_ALT
+ contains HOST_WIDE_INTs when computing its size.
+
2018-09-24 Jim Wilson <jimw@sifive.com>
PR target/87391
diff --git a/gcc/rtl.c b/gcc/rtl.c
index f9146af..ca5c25c 100644
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -110,8 +110,7 @@ const enum rtx_class rtx_class[NUM_RTX_CODE] = {
const unsigned char rtx_code_size[NUM_RTX_CODE] = {
#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) \
- (((ENUM) == CONST_INT || (ENUM) == CONST_DOUBLE \
- || (ENUM) == CONST_FIXED || (ENUM) == CONST_WIDE_INT) \
+ ((FORMAT)[0] == 'w' \
? RTX_HDR_SIZE + (sizeof FORMAT - 1) * sizeof (HOST_WIDE_INT) \
: (ENUM) == REG \
? RTX_HDR_SIZE + sizeof (reg_info) \