https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80153
amker at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu.org
--- Comment #2 from amker at gcc dot gnu.org ---
Hmm, for tree affine:
(gdb) call debug_aff(&aff)
{
type = unsigned int
offset = 6
elements = {
[0] = "oops!\n" * 1,
[1] = ivtmp.37_10 * 0xffffffffffffffffffffffffffffffffffffffffffffffff
}
}
aff_combination_to_tree returns a pointer_plus expression with chanr * type:
(gdb) call debug_generic_expr(arg)
"oops!\n" + (6 - (sizetype) ivtmp.37_10)
(gdb) call debug_tree(arg)
<pointer_plus_expr 0x7ffff6d2d488
type <pointer_type 0x7ffff6ce5e70
type <array_type 0x7ffff6ce5dc8 type <integer_type 0x7ffff6c323f0 char>
BLK
size <integer_cst 0x7ffff6d1a480 constant 56>
unit size <integer_cst 0x7ffff6d1a450 constant 7>
align 8 symtab 0 alias set -1 canonical type 0x7ffff6ce5dc8 domain
<integer_type 0x7ffff6ce5a80>
pointer_to_this <pointer_type 0x7ffff6ce5e70>>
public unsigned SI
size <integer_cst 0x7ffff6c24918 constant 32>
unit size <integer_cst 0x7ffff6c24930 constant 4>
align 32 symtab 0 alias set -1 canonical type 0x7ffff6ce5e70>
arg 0 <addr_expr 0x7ffff6d54360 type <pointer_type 0x7ffff6ce5e70>
readonly constant
arg 0 <string_cst 0x7ffff6d17e20 type <array_type 0x7ffff6ce5dc8>
readonly constant static "oops!\012\000">>
arg 1 <minus_expr 0x7ffff6d2d460
type <integer_type 0x7ffff6c32000 sizetype public unsigned SI size
<integer_cst 0x7ffff6c24918 32> unit size <integer_cst 0x7ffff6c24930 4>
align 32 symtab 0 alias set -1 canonical type 0x7ffff6c32000
precision 32 min <integer_cst 0x7ffff6c24948 0> max <integer_cst 0x7ffff6c24000
4294967295>>
arg 0 <integer_cst 0x7ffff6d1a438 constant 6>
arg 1 <nop_expr 0x7ffff6d54380 type <integer_type 0x7ffff6c32000
sizetype>
arg 0 <ssa_name 0x7ffff6d0ecf0 type <integer_type 0x7ffff6c393f0>
var <var_decl 0x7ffff6d41a20 ivtmp.37>
def_stmt ivtmp.37_10 = PHI <ivtmp.37_19(2), ivtmp.37_3(3)>
version 10>>>>
But, it really should be:
(unsigned int)"oops!\n" + (6 - (sizetype) ivtmp.37_10)
So, when the expression should be ZERO, GCC proves "oops!\n" + (6 - (sizetype)
ivtmp.37_10) can never be ZERO based on pointer semantics.
CCing Richard for further comments.
In function add_elt_to_tree, there is:
if (!expr)
{
if (POINTER_TYPE_P (TREE_TYPE (elt)))
return elt;
else
return fold_convert (type1, elt);
}
which means we return pointer type expr even it is requested to generate
unsigned type expr.