From: Richard Biener Date: Mon, 8 Jan 2018 13:24:38 +0000 (+0000) Subject: re PR c++/83713 (ICE in do_narrow at gcc/convert.c:474) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=87c4dace919a404c10521061af2bad6e4752810e;p=gcc.git re PR c++/83713 (ICE in do_narrow at gcc/convert.c:474) 2018-01-08 Richard Biener PR middle-end/83713 * convert.c (do_narrow): Properly guard TYPE_OVERFLOW_WRAPS checks. * g++.dg/torture/pr83713.C: New testcase. From-SVN: r256341 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cbd431aed83..b91925a7128 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-01-08 Richard Biener + + PR middle-end/83713 + * convert.c (do_narrow): Properly guard TYPE_OVERFLOW_WRAPS checks. + 2018-01-08 Richard Biener PR tree-optimization/83685 diff --git a/gcc/convert.c b/gcc/convert.c index e168a266ff4..8c8931f40ed 100644 --- a/gcc/convert.c +++ b/gcc/convert.c @@ -471,8 +471,10 @@ do_narrow (location_t loc, type in case the operation in outprec precision could overflow. Otherwise, we would introduce signed-overflow undefinedness. */ - || ((!TYPE_OVERFLOW_WRAPS (TREE_TYPE (arg0)) - || !TYPE_OVERFLOW_WRAPS (TREE_TYPE (arg1))) + || ((!(INTEGRAL_TYPE_P (TREE_TYPE (arg0)) + && TYPE_OVERFLOW_WRAPS (TREE_TYPE (arg0))) + || !(INTEGRAL_TYPE_P (TREE_TYPE (arg1)) + && TYPE_OVERFLOW_WRAPS (TREE_TYPE (arg1)))) && ((TYPE_PRECISION (TREE_TYPE (arg0)) * 2u > outprec) || (TYPE_PRECISION (TREE_TYPE (arg1)) * 2u diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 133e8e98cef..d5fd96d05c1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-01-08 Richard Biener + + PR middle-end/83713 + * g++.dg/torture/pr83713.C: New testcase. + 2018-01-08 Tom de Vries * gcc.dg/tree-ssa/ssa-dom-cse-2.c: Xfail scan for nvptx. diff --git a/gcc/testsuite/g++.dg/torture/pr83713.C b/gcc/testsuite/g++.dg/torture/pr83713.C new file mode 100644 index 00000000000..ca6af04406d --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr83713.C @@ -0,0 +1,12 @@ +// { dg-do compile } + +class a +{ + char b; + void c (); +}; +void +a::c () +{ + &b + ((long long) &b & 0); +}