From: Marek Polacek Date: Tue, 28 Mar 2017 08:13:04 +0000 (+0000) Subject: re PR sanitizer/80067 (ICE in fold_comparison with -fsanitize=undefined) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=72785f26600ba08db98c6f169e59e66fe09a81f3;p=gcc.git re PR sanitizer/80067 (ICE in fold_comparison with -fsanitize=undefined) PR sanitizer/80067 * fold-const.c (fold_comparison): Use protected_set_expr_location instead of SET_EXPR_LOCATION. * c-c++-common/ubsan/shift-10.c: New test. From-SVN: r246521 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 062afce6669..691785926be 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-03-28 Marek Polacek + + PR sanitizer/80067 + * fold-const.c (fold_comparison): Use protected_set_expr_location + instead of SET_EXPR_LOCATION. + 2017-03-28 Markus Trippelsdorf * tree.c (add_expr): Avoid name lookup warning. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 1a9a264fc26..6db16b514f1 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -8704,7 +8704,7 @@ fold_comparison (location_t loc, enum tree_code code, tree type, if (save_p) { tem = save_expr (build2 (code, type, cval1, cval2)); - SET_EXPR_LOCATION (tem, loc); + protected_set_expr_location (tem, loc); return tem; } return fold_build2_loc (loc, code, type, cval1, cval2); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 086be297bd3..93c9f9efed4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-03-28 Marek Polacek + + PR sanitizer/80067 + * c-c++-common/ubsan/shift-10.c: New test. + 2017-03-27 Jeff Law PR tree-optimization/80216 diff --git a/gcc/testsuite/c-c++-common/ubsan/shift-10.c b/gcc/testsuite/c-c++-common/ubsan/shift-10.c new file mode 100644 index 00000000000..9202fccc465 --- /dev/null +++ b/gcc/testsuite/c-c++-common/ubsan/shift-10.c @@ -0,0 +1,10 @@ +/* PR sanitizer/80067 */ +/* { dg-do compile } */ +/* { dg-options "-fsanitize=shift" } */ + +extern signed char a; +void +foo () +{ + 0 << ((647 > a) - 1); +}