From f3ef18ffa0d5facc961caab9c0244b6390e66096 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 8 Jan 2013 09:32:12 +0100 Subject: [PATCH] re PR middle-end/55851 (ICE in size_binop_loc, at fold-const.c:1385) PR middle-end/55851 * fold-const.c (int_binop_types_match_p): Allow all INTEGRAL_TYPE_P types instead of just INTEGER_TYPE types. * gcc.c-torture/compile/pr55851.c: New test. Co-Authored-By: Richard Biener From-SVN: r195006 --- gcc/ChangeLog | 7 +++++++ gcc/fold-const.c | 4 ++-- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.c-torture/compile/pr55851.c | 12 ++++++++++++ 4 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr55851.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 688d8c2..25e60e3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2013-01-08 Jakub Jelinek + Richard Biener + + PR middle-end/55851 + * fold-const.c (int_binop_types_match_p): Allow all INTEGRAL_TYPE_P + types instead of just INTEGER_TYPE types. + 2013-01-07 Mark Kettenis * config/i386/openbsdelf.h (LIBGCC2_HAS_TF_MODE, LIBGCC2_TF_CEXT, diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 7e619d6..a0b4036 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -900,9 +900,9 @@ associate_trees (location_t loc, tree t1, tree t2, enum tree_code code, tree typ static bool int_binop_types_match_p (enum tree_code code, const_tree type1, const_tree type2) { - if (TREE_CODE (type1) != INTEGER_TYPE && !POINTER_TYPE_P (type1)) + if (!INTEGRAL_TYPE_P (type1) && !POINTER_TYPE_P (type1)) return false; - if (TREE_CODE (type2) != INTEGER_TYPE && !POINTER_TYPE_P (type2)) + if (!INTEGRAL_TYPE_P (type2) && !POINTER_TYPE_P (type2)) return false; switch (code) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a61f705..c0159bc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2013-01-08 Jakub Jelinek + PR middle-end/55851 + * gcc.c-torture/compile/pr55851.c: New test. + PR sanitizer/55844 * c-c++-common/asan/null-deref-1.c: Add -fno-shrink-wrap to dg-options. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr55851.c b/gcc/testsuite/gcc.c-torture/compile/pr55851.c new file mode 100644 index 0000000..6198a73 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr55851.c @@ -0,0 +1,12 @@ +/* PR middle-end/55851 */ + +enum { A = 1UL, B = -1UL } var = A; +void foo (char *); + +void +test (void) +{ + char vla[1][var]; + vla[0][0] = 1; + foo (&vla[0][0]); +} -- 2.7.4