summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2013-01-08 08:32:12 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2013-01-08 08:32:12 +0000
commit100d7996c45240b04b7458f33615030d0d1da6ea (patch)
treeddef6bb86fc27a607b3cf386774ca7f5dc73a25e
parenta3d7412d7fb3d076296b0ff4a78f4c85a35e071f (diff)
downloadgcc-100d7996c45240b04b7458f33615030d0d1da6ea.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@195006 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/fold-const.c4
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr55851.c12
4 files changed, 24 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 688d8c20fce..25e60e3721d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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,
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 7e619d6d1e5..a0b403645b6 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 a61f7054011..c0159bcc6ad 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 00000000000..6198a7339cc
--- /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]);
+}