From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7F9823861800; Tue, 7 Jul 2020 11:51:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7F9823861800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1594122687; bh=htB7dJCJcSxicMMtTmHjAWdQjmgFglaNhaxlzmT3vrg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ie7/uZ60QiQQSlDHOO/THiz5JIPXCiNz/tXVplITenRA+QAKKOB4iH9LJqr4JGlCr 7aLipmF3pOS4An1/kwigAPmsOw+dNNR4sy2yR/U9BN/OL261zvQzxf4ooWjtOFKoS4 FgqmEfSn9FAWzRrmdRiUIJNhY6V2s+KeMI3tGzCE= From: "marxin at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/96058] ICE in c_getstr at gcc/fold-const.c:15475 Date: Tue, 07 Jul 2020 11:51:27 +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: 11.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: marxin at gcc dot gnu.org X-Bugzilla-Status: NEW 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: 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: Tue, 07 Jul 2020 11:51:27 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96058 --- Comment #5 from Martin Li=C5=A1ka --- So the corrupted STRING_CST is created in LTRANS here: gcc/expr.c: =E2=94=8211714 if (TREE_CODE (init) =3D=3D CONSTRUCTOR && initia= lizer_zerop (init))=20=20 =E2=94=8211715 {=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 =E2=94=8211716 /* Fold an empty/zero constructor for an impl= icitly initialized=20 =E2=94=8211717 object or subobject into the empty string.= */=20=20=20=20=20=20=20=20=20 =E2=94=8211718=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20 =E2=94=8211719 /* Determine the character type from that of = the original=20 =E2=94=8211720 expression. */=20=20 B+ =E2=94=8211721 tree chartype =3D argtype; =E2=94=8211722 if (POINTER_TYPE_P (chartype)) =E2=94=8211723 chartype =3D TREE_TYPE (chartype); =E2=94=8211724 while (TREE_CODE (chartype) =3D=3D ARRAY_TYPE) =E2=94=8211725 chartype =3D TREE_TYPE (chartype); =E2=94=8211726 /* Convert a char array to an empty STRING_CS= T having an array (gdb) p debug_tree(init) unit-size align:64 warn_if_not_align:0 symtab:0 alias-set 407 canonical-type 0x7ffff4514000 fields readonly unsigned nonlocal DI ../../ui/gfx/vector_icon_types.h:102:0 size unit-size align:64 warn_if_not_align:0 offset_align 128 offset bit-offset context chain > context pointer_to_this > constant length:3 idx readonly unsigned DI size unit-= size align:64 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality> readonly unsigned nonlocal DI ../../ui/gfx/vector_icon_types.h:102:0 size unit-size align:64 warn_if_not_align:0 offset_align 128 offset bit-offset context chain unsigned nonlocal DI ../../ui/gfx/vector_icon_types.h:103:0 size unit-size align:64 warn_if_not_align:0 offset_align 128 offset bit-offset context chain >> val cons= tant 0> idx unit-size align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-ty= pe 0x7ffff781b738 precision:64 min max pointer_to_this reference_to_this > unsigned nonlocal DI ../../ui/gfx/vector_icon_types.h:103:0 size unit-size align:64 warn_if_not_align:0 offset_align 128 offset bit-offset context chain unsigned nonlocal DI ../../ui/gfx/vector_icon_types.h:108:0 size unit-size align:64 warn_if_not_align:0 offset_align 128 offset bit-offset context >> val constant 0> idx public unsigned DI size unit-si= ze align:64 warn_if_not_align:0 symtab:0 alias-set 409 structural-equality pointer_to_this reference_to_this > unsigned nonlocal DI ../../ui/gfx/vector_icon_types.h:108:0 size unit-size align:64 warn_if_not_align:0 offset_align 128 offset bit-offset context > val cons= tant 0>> $18 =3D void (gdb) p debug_tree(argtype) pointer_to_this reference_to_this > public unsigned DI size constant 64> unit-size constant 8> align:64 warn_if_not_align:0 symtab:0 alias-set 1025 structural-equalit= y> (gdb) p debug_tree(chartype) pointer_to_this reference_to_this > $21 =3D void @Martin: Can you please take a look?=