re PR middle-end/55851 (ICE in size_binop_loc, at fold-const.c:1385)
authorJakub Jelinek <jakub@redhat.com>
Tue, 8 Jan 2013 08:32:12 +0000 (09:32 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 8 Jan 2013 08:32:12 +0000 (09:32 +0100)
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 <rguenther@suse.de>
From-SVN: r195006

gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr55851.c [new file with mode: 0644]

index 688d8c2..25e60e3 100644 (file)
@@ -1,3 +1,10 @@
+2013-01-08  Jakub Jelinek  <jakub@redhat.com>
+           Richard Biener  <rguenther@suse.de>
+
+       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  <kettenis@openbsd.org>
 
        * config/i386/openbsdelf.h (LIBGCC2_HAS_TF_MODE, LIBGCC2_TF_CEXT,
index 7e619d6..a0b4036 100644 (file)
@@ -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)
index a61f705..c0159bc 100644 (file)
@@ -1,5 +1,8 @@
 2013-01-08  Jakub Jelinek  <jakub@redhat.com>
 
+       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 (file)
index 0000000..6198a73
--- /dev/null
@@ -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]);
+}