diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-03-21 08:01:05 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-03-21 08:01:05 +0100 |
commit | 4d1b8e70fa5a3b4f305afdc977f02ae39761761b (patch) | |
tree | d274067bd324a26a0c968aa333e8bf901b40ed78 /gcc/c | |
parent | ece3b7e65aed085cfc73a7e84ceb4a25c2683054 (diff) | |
download | gcc-4d1b8e70fa5a3b4f305afdc977f02ae39761761b.zip gcc-4d1b8e70fa5a3b4f305afdc977f02ae39761761b.tar.gz gcc-4d1b8e70fa5a3b4f305afdc977f02ae39761761b.tar.bz2 |
re PR c/80097 (internal compiler error in c_fully_fold_internal with std=c89 and -fsanitize=float-divide-by-zero)
PR c/80097
* c-typeck.c (build_binary_op): Add EXCESS_PRECISION_EXPR only around
optional COMPOUND_EXPR with ubsan instrumentation.
* gcc.dg/ubsan/pr80097.c: New test.
From-SVN: r246302
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c/c-typeck.c | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index ac8db9b..218b804 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2017-03-21 Jakub Jelinek <jakub@redhat.com> + + PR c/80097 + * c-typeck.c (build_binary_op): Add EXCESS_PRECISION_EXPR only around + optional COMPOUND_EXPR with ubsan instrumentation. + 2017-03-17 Marek Polacek <polacek@redhat.com> * c-parser.c: Add C11 references. diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index b4f61b0..b283a21 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -11856,14 +11856,16 @@ build_binary_op (location_t location, enum tree_code code, else if (TREE_CODE (ret) != INTEGER_CST && int_operands && !in_late_binary_op) ret = note_integer_operands (ret); - if (semantic_result_type) - ret = build1 (EXCESS_PRECISION_EXPR, semantic_result_type, ret); protected_set_expr_location (ret, location); if (instrument_expr != NULL) ret = fold_build2 (COMPOUND_EXPR, TREE_TYPE (ret), instrument_expr, ret); + if (semantic_result_type) + ret = build1_loc (location, EXCESS_PRECISION_EXPR, + semantic_result_type, ret); + return ret; } |