re PR tree-optimization/80612 (ICE in get_range_info, at tree-ssanames.c:375)
authorMarek Polacek <polacek@redhat.com>
Thu, 4 May 2017 10:35:58 +0000 (10:35 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Thu, 4 May 2017 10:35:58 +0000 (10:35 +0000)
PR tree-optimization/80612
* calls.c (get_size_range): Check for INTEGRAL_TYPE_P.

* gcc.dg/torture/pr80612.c: New test.

From-SVN: r247586

gcc/ChangeLog
gcc/calls.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr80612.c [new file with mode: 0644]

index 67a97c84ca01bc155a76c4488883a05764672ba0..84c1f68574408dbffa2b3afd726d865e3fdaf56c 100644 (file)
@@ -1,3 +1,8 @@
+2017-05-04  Marek Polacek  <polacek@redhat.com>
+
+       PR tree-optimization/80612
+       * calls.c (get_size_range): Check for INTEGRAL_TYPE_P.
+
 2017-05-04  Prakhar Bahuguna  <prakhar.bahuguna@arm.com>
            Andre Simoes Dias Vieira  <andre.simoesdiasvieira@arm.com>
 
index c26f157b0b11cf2b991a55c3aa29e508d0498532..bd081ccf46c3a3c5e6dab72bca1156ba4767b2f0 100644 (file)
@@ -1270,7 +1270,7 @@ get_size_range (tree exp, tree range[2])
 
   wide_int min, max;
   enum value_range_type range_type
-    = (TREE_CODE (exp) == SSA_NAME
+    = ((TREE_CODE (exp) == SSA_NAME && INTEGRAL_TYPE_P (TREE_TYPE (exp)))
        ? get_range_info (exp, &min, &max) : VR_VARYING);
 
   if (range_type == VR_VARYING)
index d3fc7396653d30f1c69d3d1e43b644c4ab447d15..b93975d07a44cbbae21ffc30c85f184087dd1b2a 100644 (file)
@@ -1,3 +1,8 @@
+2017-05-04  Marek Polacek  <polacek@redhat.com>
+
+       PR tree-optimization/80612
+       * gcc.dg/torture/pr80612.c: New test.
+
 2017-05-04  Prakhar Bahuguna  <prakhar.bahuguna@arm.com>
            Andre Simoes Dias Vieira  <andre.simoesdiasvieira@arm.com>
 
diff --git a/gcc/testsuite/gcc.dg/torture/pr80612.c b/gcc/testsuite/gcc.dg/torture/pr80612.c
new file mode 100644 (file)
index 0000000..225b811
--- /dev/null
@@ -0,0 +1,15 @@
+/* PR tree-optimization/80612 */
+/* { dg-do compile } */
+
+struct obstack *a;
+struct obstack {
+  union {
+    void *plain;
+    void (*extra)();
+  } chunkfun;
+} fn1(void p4()) {
+  a->chunkfun.plain = p4;
+  a->chunkfun.extra(a);
+}
+void fn2(int) __attribute__((__alloc_size__(1)));
+void fn3() { fn1(fn2); }