From 7d0c13523ca0896a160881c9701b020172fb67fd Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 26 Jun 2018 06:40:43 +0000 Subject: [PATCH] re PR ipa/86271 (ICE due to size mismatch when inlining) 2018-06-26 Richard Biener 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 | 6 ++++++ gcc/fold-const.c | 4 +++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr86271.c | 17 +++++++++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr86271.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d420310e073..342c69b1240 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-06-26 Richard Biener + + PR middle-end/86271 + * fold-const.c (fold_convertible_p): Pointer extension + isn't valid. + 2018-06-26 Alexandre Oliva PR debug/86064 diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 4568e1e2b57..8476c223e4f 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -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: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5d5ed667afc..eb782ff5dd6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-06-26 Richard Biener + + PR middle-end/86271 + * gcc.dg/pr86271.c: New testcase. + 2018-06-26 Alexandre Oliva PR debug/86064 diff --git a/gcc/testsuite/gcc.dg/pr86271.c b/gcc/testsuite/gcc.dg/pr86271.c new file mode 100644 index 00000000000..1200533d4d9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr86271.c @@ -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; +} -- 2.30.2