diff options
author | Jakub Jelinek <jakub@redhat.com> | 2020-06-24 10:40:02 +0200 |
---|---|---|
committer | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-17 13:14:39 -0300 |
commit | 22e7511d4d2979c70fb700f6a8d87dc316413068 (patch) | |
tree | 7940b807f9d345baa915b9f0ab82b14f0c33a79b /gcc/fortran/iresolve.c | |
parent | 0d151cf71a4be3fc0c915c626c9734ce52a7ca24 (diff) | |
download | gcc-22e7511d4d2979c70fb700f6a8d87dc316413068.zip gcc-22e7511d4d2979c70fb700f6a8d87dc316413068.tar.gz gcc-22e7511d4d2979c70fb700f6a8d87dc316413068.tar.bz2 |
fold-const: Fix A <= 0 ? A : -A folding [PR95810]
We folded A <= 0 ? A : -A into -ABS (A), which is for signed integral types
incorrect - can invoke on INT_MIN UB twice, once on ABS and once on its
negation.
The following patch fixes it by instead folding it to (type)-ABSU (A).
2020-06-24 Jakub Jelinek <jakub@redhat.com>
PR middle-end/95810
* fold-const.c (fold_cond_expr_with_comparison): Optimize
A <= 0 ? A : -A into (type)-absu(A) rather than -abs(A).
* gcc.dg/ubsan/pr95810.c: New test.
Diffstat (limited to 'gcc/fortran/iresolve.c')
0 files changed, 0 insertions, 0 deletions