re PR ipa/86271 (ICE due to size mismatch when inlining)
authorRichard Biener <rguenther@suse.de>
Tue, 26 Jun 2018 06:40:43 +0000 (06:40 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 26 Jun 2018 06:40:43 +0000 (06:40 +0000)
2018-06-26  Richard Biener  <rguenther@suse.de>

PR middle-end/86271
* fold-const.c (fold_convertible_p): Pointer extension
isn't valid.

* gcc.dg/pr86271.c: New testcase.

From-SVN: r262131

gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr86271.c [new file with mode: 0644]

index d420310e07310076aa063cf5b9b11c08ebbe081d..342c69b124073ad17688d3e6e8e86da1a130c0c3 100644 (file)
@@ -1,3 +1,9 @@
+2018-06-26  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/86271
+       * fold-const.c (fold_convertible_p): Pointer extension
+       isn't valid.
+
 2018-06-26  Alexandre Oliva <aoliva@redhat.com>
 
        PR debug/86064
index 4568e1e2b5744cf7a2f8895422cafa5a0a509bba..8476c223e4f2de35f7a4c1773d81eb65d3a97dba 100644 (file)
@@ -2358,7 +2358,9 @@ fold_convertible_p (const_tree type, const_tree arg)
     case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE:
     case POINTER_TYPE: case REFERENCE_TYPE:
     case OFFSET_TYPE:
-      return (INTEGRAL_TYPE_P (orig) || POINTER_TYPE_P (orig)
+      return (INTEGRAL_TYPE_P (orig)
+             || (POINTER_TYPE_P (orig)
+                 && TYPE_PRECISION (type) <= TYPE_PRECISION (orig))
              || TREE_CODE (orig) == OFFSET_TYPE);
 
     case REAL_TYPE:
index 5d5ed667afc715e4b2135f89c17fb5afeb9e9acf..eb782ff5dd67ed53365eb26f3b2fa4a7c9e430eb 100644 (file)
@@ -1,3 +1,8 @@
+2018-06-26  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/86271
+       * gcc.dg/pr86271.c: New testcase.
+
 2018-06-26  Alexandre Oliva <aoliva@redhat.com>
 
        PR debug/86064
diff --git a/gcc/testsuite/gcc.dg/pr86271.c b/gcc/testsuite/gcc.dg/pr86271.c
new file mode 100644 (file)
index 0000000..1200533
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int main ()
+{
+  int i;
+  foobar (i, &i); /* { dg-warning "implicit declaration" } */
+}
+
+int foobar (int a, long long b)
+{
+  int c;
+
+  c = a % b;
+  a = a / b;
+  return a + b;
+}