[Bug tree-optimization/106457] array_at_struct_end_p returns TRUE for a two-dimension array which is not inside any structure
qinzhao at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Aug 1 21:11:37 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106457
qinzhao at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|FIXED |---
Status|RESOLVED |REOPENED
--- Comment #4 from qinzhao at gcc dot gnu.org ---
(In reply to Richard Biener from comment #3)
> Should be fixed.
Just checked this in gdb, still not fixed.
Breakpoint 1, array_at_struct_end_p (ref=0xfffff57a2bc0) at
../../latest_gcc/gcc/tree.cc:12690
12690 if (TREE_CODE (ref) == ARRAY_REF
(gdb) call debug_tree(ref)
<array_ref 0xfffff57a2bc0
type <array_type 0xfffff59f7818
type <integer_type 0xfffff57f05e8 int sizes-gimplified public type_6 SI
size <integer_cst 0xfffff56c1248 constant 32>
unit-size <integer_cst 0xfffff56c1260 constant 4>
align:32 warn_if_not_align:0 symtab:0 alias-set 1 canonical-type
0xfffff57f05e8 precision:32 min <integer_cst 0xfffff56c1200 -2147483648> max
<integer_cst 0xfffff56c1218 2147483647>
pointer_to_this <pointer_type 0xfffff57f1a40>>
sizes-gimplified type_6 BLK
size <var_decl 0xfffff5771200 D.4037 type <integer_type 0xfffff57f00a8
bitsizetype>
used unsigned ignored TI t.C:8:7
size <integer_cst 0xfffff56c1050 constant 128>
unit-size <integer_cst 0xfffff56c1068 constant 16>
align:128 warn_if_not_align:0 context <function_decl 0xfffff5a84c00
foo>>
unit-size <var_decl 0xfffff5771290 D.4038 type <integer_type
0xfffff57f0000 sizetype>
used unsigned ignored DI t.C:8:7
size <integer_cst 0xfffff56c1008 constant 64>
unit-size <integer_cst 0xfffff56c1020 constant 8>
align:64 warn_if_not_align:0 context <function_decl 0xfffff5a84c00
foo>>
align:32 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality
domain <integer_type 0xfffff59f7620 type <integer_type 0xfffff57f0000
sizetype>
sizes-gimplified type_6 DI size <integer_cst 0xfffff56c1008 64>
unit-size <integer_cst 0xfffff56c1020 8>
align:64 warn_if_not_align:0 symtab:0 alias-set -1
structural-equality precision:64 min <integer_cst 0xfffff56c1038 0> max
<var_decl 0xfffff5771170 D.4036>>>
arg:0 <mem_ref 0xfffff5a7ccb0
type <array_type 0xfffff59f7b60 type <array_type 0xfffff59f7818>
sizes-gimplified type_6 BLK size <var_decl 0xfffff5771440 D.4041>
unit-size <var_decl 0xfffff57714d0 D.4042>
align:32 warn_if_not_align:0 symtab:0 alias-set -1
structural-equality domain <integer_type 0xfffff59f7a10>
pointer_to_this <pointer_type 0xfffff59f7c08>>
nothrow
arg:0 <addr_expr 0xfffff5a23980 type <pointer_type 0xfffff59f8d18>
arg:0 <var_decl 0xfffff5771a70 e.4>>
arg:1 <integer_cst 0xfffff56c7878 constant 0>
t.C:9:9 start: t.C:9:3 finish: t.C:9:9>
arg:1 <integer_cst 0xfffff56c1398 type <integer_type 0xfffff57f05e8 int>
constant 0>
arg:3 <integer_cst 0xfffff56c1110 type <integer_type 0xfffff57f0000
sizetype> constant 1>
t.C:9:6 start: t.C:9:3 finish: t.C:9:6>
(gdb) break 12782
Breakpoint 2 at 0x1d519d8: file ../../latest_gcc/gcc/tree.cc, line 12782.
(gdb) c
Continuing.
Breakpoint 2, array_at_struct_end_p (ref=0xfffff5771a70) at
../../latest_gcc/gcc/tree.cc:12782
12782 if (DECL_P (ref_to_array))
(gdb) call debug_tree(ref)
<var_decl 0xfffff5771a70 e.4
type <array_type 0xfffff59f80a0
type <integer_type 0xfffff59f7f50 public unsigned QI
size <integer_cst 0xfffff56c10f8 constant 8>
unit-size <integer_cst 0xfffff56c1110 constant 1>
align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0xfffff59f7f50 precision:8 min <integer_cst 0xfffff56c78c0 0> max <integer_cst
0xfffff56c56b8 255>>
SI
size <integer_cst 0xfffff56c1248 constant 32>
unit-size <integer_cst 0xfffff56c1260 constant 4>
align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0xfffff59f80a0
domain <integer_type 0xfffff59f7ff8 type <integer_type 0xfffff57f0000
sizetype>
DI
size <integer_cst 0xfffff56c1008 constant 64>
unit-size <integer_cst 0xfffff56c1020 constant 8>
align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0xfffff59f7ff8 precision:64 min <integer_cst 0xfffff56c1038 0> max <integer_cst
0xfffff56c78f0 3>>
pointer_to_this <pointer_type 0xfffff59f8d18>>
addressable used ignored SI t.C:8:7 size <integer_cst 0xfffff56c1248 32>
unit-size <integer_cst 0xfffff56c1260 4>
align:32 warn_if_not_align:0 context <function_decl 0xfffff5a84c00 foo>>
(gdb) call debug_tree(ref_to_array)
<mem_ref 0xfffff5a7ccb0
type <array_type 0xfffff59f7b60
type <array_type 0xfffff59f7818 type <integer_type 0xfffff57f05e8 int>
sizes-gimplified type_6 BLK size <var_decl 0xfffff5771200 D.4037>
unit-size <var_decl 0xfffff5771290 D.4038>
align:32 warn_if_not_align:0 symtab:0 alias-set -1
structural-equality domain <integer_type 0xfffff59f7620>>
sizes-gimplified type_6 BLK
size <var_decl 0xfffff5771440 D.4041 type <integer_type 0xfffff57f00a8
bitsizetype>
used unsigned ignored TI t.C:8:7
size <integer_cst 0xfffff56c1050 constant 128>
unit-size <integer_cst 0xfffff56c1068 constant 16>
align:128 warn_if_not_align:0 context <function_decl 0xfffff5a84c00
foo>>
unit-size <var_decl 0xfffff57714d0 D.4042 type <integer_type
0xfffff57f0000 sizetype>
used unsigned ignored DI t.C:8:7
size <integer_cst 0xfffff56c1008 constant 64>
unit-size <integer_cst 0xfffff56c1020 constant 8>
align:64 warn_if_not_align:0 context <function_decl 0xfffff5a84c00
foo>>
align:32 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality
domain <integer_type 0xfffff59f7a10 type <integer_type 0xfffff57f0000
sizetype>
sizes-gimplified type_6 DI size <integer_cst 0xfffff56c1008 64>
unit-size <integer_cst 0xfffff56c1020 8>
align:64 warn_if_not_align:0 symtab:0 alias-set -1
structural-equality precision:64 min <integer_cst 0xfffff56c1038 0> max
<var_decl 0xfffff57713b0 D.4040>>
pointer_to_this <pointer_type 0xfffff59f7c08>>
nothrow
arg:0 <addr_expr 0xfffff5a23980
type <pointer_type 0xfffff59f8d18 type <array_type 0xfffff59f80a0>
unsigned DI size <integer_cst 0xfffff56c1008 64> unit-size
<integer_cst 0xfffff56c1020 8>
align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0xfffff59f8d18>
arg:0 <var_decl 0xfffff5771a70 e.4 type <array_type 0xfffff59f80a0>
addressable used ignored SI t.C:8:7
size <integer_cst 0xfffff56c1248 constant 32>
unit-size <integer_cst 0xfffff56c1260 constant 4>
align:32 warn_if_not_align:0 context <function_decl 0xfffff5a84c00
foo>>>
arg:1 <integer_cst 0xfffff56c7878 type <pointer_type 0xfffff59f7c08>
constant 0>
t.C:9:9 start: t.C:9:3 finish: t.C:9:9>
(gdb) n
12787 poly_int64 offset;
(gdb) n
12788 if (TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (atype))) != INTEGER_CST
(gdb) n
12790 || TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (atype))) !=
INTEGER_CST)
(gdb) n
12788 if (TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (atype))) != INTEGER_CST
(gdb) n
12791 return true;
(gdb) n
So, it still return TRUE for this array access.
More information about the Gcc-bugs
mailing list