From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 89790385801E; Mon, 1 Aug 2022 21:11:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 89790385801E From: "qinzhao at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/106457] array_at_struct_end_p returns TRUE for a two-dimension array which is not inside any structure Date: Mon, 01 Aug 2022 21:11:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: qinzhao at gcc dot gnu.org X-Bugzilla-Status: REOPENED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: resolution bug_status Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Aug 2022 21:11:37 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106457 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=3D0xfffff57a2bc0) at ../../latest_gcc/gcc/tree.cc:12690 12690 if (TREE_CODE (ref) =3D=3D ARRAY_REF (gdb) call debug_tree(ref) unit-size align:32 warn_if_not_align:0 symtab:0 alias-set 1 canonical-type 0xfffff57f05e8 precision:32 min max pointer_to_this > sizes-gimplified type_6 BLK size used unsigned ignored TI t.C:8:7 size unit-size align:128 warn_if_not_align:0 context > unit-size used unsigned ignored DI t.C:8:7 size unit-size align:64 warn_if_not_align:0 context > align:32 warn_if_not_align:0 symtab:0 alias-set -1 structural-equal= ity domain sizes-gimplified type_6 DI size unit-size align:64 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality precision:64 min max >> arg:0 sizes-gimplified type_6 BLK size unit-size align:32 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality domain pointer_to_this > nothrow arg:0 arg:0 > arg:1 t.C:9:9 start: t.C:9:3 finish: t.C:9:9> arg:1 constant 0> arg:3 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=3D0xfffff5771a70) at ../../latest_gcc/gcc/tree.cc:12782 12782 if (DECL_P (ref_to_array)) (gdb) call debug_tree(ref) unit-size align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0xfffff59f7f50 precision:8 min max > SI size unit-size align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0xfffff59f80a0 domain DI size unit-size align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-ty= pe 0xfffff59f7ff8 precision:64 min max > pointer_to_this > addressable used ignored SI t.C:8:7 size unit-size align:32 warn_if_not_align:0 context > (gdb) call debug_tree(ref_to_array) sizes-gimplified type_6 BLK size unit-size align:32 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality domain > sizes-gimplified type_6 BLK size used unsigned ignored TI t.C:8:7 size unit-size align:128 warn_if_not_align:0 context > unit-size used unsigned ignored DI t.C:8:7 size unit-size align:64 warn_if_not_align:0 context > align:32 warn_if_not_align:0 symtab:0 alias-set -1 structural-equal= ity domain sizes-gimplified type_6 DI size unit-size align:64 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality precision:64 min max > pointer_to_this > nothrow arg:0 unsigned DI size unit-size align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-ty= pe 0xfffff59f8d18> arg:0 addressable used ignored SI t.C:8:7 size unit-size align:32 warn_if_not_align:0 context >> arg:1 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))) !=3D INTEG= ER_CST (gdb) n 12790 || TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (atype))) !=3D INTEGER_CST) (gdb) n 12788 if (TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (atype))) !=3D INTEG= ER_CST (gdb) n 12791 return true; (gdb) n So, it still return TRUE for this array access.=