[Bug tree-optimization/97960] [8/9/10/11 Regression] Wrong code at -O3 since r8-6511-g3ae129323d
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Nov 24 15:12:31 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97960
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Creating dr for b[_7]
base_address: &b
offset from base address: (ssizetype) ((sizetype) (signed char) _5 * 4)
constant offset from base address: -1012
step: 4
base alignment: 32
base misalignment: 0
offset alignment: 4
step alignment: 4
base_object: b
Access function 0: {(int) h_20, +, 1}_2
looks like the wrong sign for the constant offset.
#0 split_constant_offset_1 (type=<integer_type 0x7ffff68252a0 signed char>,
op0=<ssa_name 0x7ffff6816f78 6>, code=NOP_EXPR, op1=<tree 0x0>,
var=0x7fffffffba10, off=0x7fffffffba08, cache=..., limit=0x7fffffffc19c)
now, var_min/max is UNSIGNED -3 / -1 (precision 8), woff is 3
we compute -3 + 3 == 0 and overflow to true (UNSIGNED arithmetic)
_5 = (unsigned char) _35;
_6 = _5 + 3;
h_20 = (signed char) _6;
but then we continue with
/* Calculate (ssizetype) OP0 - (ssizetype) TMP_VAR. */
widest_int diff = (widest_int::from (op0_min, sgn)
- widest_int::from (var_min, sgn));
getting -253. I remember this place has changed quite some times and
wide (sign-extended) vs. widest (signed) ints do not make it easier
to see what's correct ...
I'm defering to Richard here. The C testcase trips at this point just
twice (ldist and vectorizer) so it's easy enough to 'catch' in a debugger.
More information about the Gcc-bugs
mailing list