re PR c/32796 (internal compiler error: tree check: expected integer_type or enumeral...
authorAndrew Pinski <andrew_pinski@playstation.sony.com>
Thu, 9 Aug 2007 21:39:08 +0000 (21:39 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Thu, 9 Aug 2007 21:39:08 +0000 (14:39 -0700)
2007-08-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR c/32796
        * c-typeck.c (build_binary_op): Check for non pointer types before
        calling int_fits_type_p.

2007-08-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR c/32796
        * gcc.c-torture/compile/pr32796.c: New test.

From-SVN: r127323

gcc/ChangeLog
gcc/c-typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr32796.c [new file with mode: 0644]

index 410cf5470cdb7338b38e55454086cac46d0d918c..25fb6ff0458b8d8ffb2f9bb54693d93197b444ab 100644 (file)
@@ -1,3 +1,9 @@
+2007-08-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
+
+       PR c/32796
+       * c-typeck.c (build_binary_op): Check for non pointer types before
+       calling int_fits_type_p.
+
 2007-08-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
 
        PR middle-end/32813
index 3e209e2cd701699175b0205d800bc33d7d56c49c..6964e757388c2f985c1ad567ed12ba3f679e1750 100644 (file)
@@ -8226,8 +8226,9 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
                       < TYPE_PRECISION (result_type))
                   && (type
                       = c_common_signed_or_unsigned_type (unsigned1,
-                                                          TREE_TYPE (arg1)),
-                      int_fits_type_p (arg0, type)))
+                                                          TREE_TYPE (arg1)))
+                  && !POINTER_TYPE_P (type)
+                  && int_fits_type_p (arg0, type))
            result_type = type;
          else if (TREE_CODE (arg1) == INTEGER_CST
                   && (unsigned0 || !uns)
@@ -8235,8 +8236,9 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
                       < TYPE_PRECISION (result_type))
                   && (type
                       = c_common_signed_or_unsigned_type (unsigned0,
-                                                          TREE_TYPE (arg0)),
-                      int_fits_type_p (arg1, type)))
+                                                          TREE_TYPE (arg0)))
+                  && !POINTER_TYPE_P (type)
+                  && int_fits_type_p (arg1, type))
            result_type = type;
        }
 
index 06b2fff2e7da48722957f5c9fa6886ee73f80240..2659bb23ecb41b09c4c1ff86885fb891539d8abb 100644 (file)
@@ -1,3 +1,8 @@
+2007-08-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
+
+       PR c/32796
+       * gcc.c-torture/compile/pr32796.c: New test.
+
 2007-08-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
 
        PR middle-end/32813
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr32796.c b/gcc/testsuite/gcc.c-torture/compile/pr32796.c
new file mode 100644 (file)
index 0000000..9e0abfb
--- /dev/null
@@ -0,0 +1,6 @@
+
+
+__SIZE_TYPE__ f (void *ptr)
+{
+  return ((__SIZE_TYPE__)(ptr)-1) | 1ULL;
+}