aboutsummaryrefslogtreecommitdiff
path: root/gcc/analyzer
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2024-02-26 13:33:21 +0100
committerRichard Biener <rguenther@suse.de>2024-02-27 10:54:56 +0100
commita0b1798042d033fd2cc2c806afbb77875dd2909b (patch)
treed0ab495e1bc7966c45c330384ea800d5c8c3983a /gcc/analyzer
parentc3c44c01d20b00ab5228f32596153b7f4cbc6036 (diff)
downloadgcc-a0b1798042d033fd2cc2c806afbb77875dd2909b.zip
gcc-a0b1798042d033fd2cc2c806afbb77875dd2909b.tar.gz
gcc-a0b1798042d033fd2cc2c806afbb77875dd2909b.tar.bz2
tree-optimization/114074 - CHREC multiplication and undefined overflow
When folding a multiply CHRECs are handled like {a, +, b} * c is {a*c, +, b*c} but that isn't generally correct when overflow invokes undefined behavior. The following uses unsigned arithmetic unless either a is zero or a and b have the same sign. I've used simple early outs for INTEGER_CSTs and otherwise use a range-query since we lack a tree_expr_nonpositive_p and get_range_pos_neg isn't a good fit. PR tree-optimization/114074 * tree-chrec.h (chrec_convert_rhs): Default at_stmt arg to NULL. * tree-chrec.cc (chrec_fold_multiply): Canonicalize inputs. Handle poly vs. non-poly multiplication correctly with respect to undefined behavior on overflow. * gcc.dg/torture/pr114074.c: New testcase. * gcc.dg/pr68317.c: Adjust expected location of diagnostic. * gcc.dg/vect/vect-early-break_119-pr114068.c: Do not expect loop to be vectorized.
Diffstat (limited to 'gcc/analyzer')
0 files changed, 0 insertions, 0 deletions