From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C143C38708B9; Tue, 13 Oct 2020 17:01:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C143C38708B9 From: "hubicka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug bootstrap/97350] [11 Regression] Ada bootstrap fails with: self_referential_size, at stor-layout.c:172 Date: Tue, 13 Oct 2020 17:01:41 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: bootstrap X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: build, ice-on-valid-code, needs-bisection X-Bugzilla-Severity: normal X-Bugzilla-Who: hubicka at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 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, 13 Oct 2020 17:01:41 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97350 --- Comment #10 from Jan Hubicka --- OK, I was poking a bit about the problem and indeed the bootstrapped gnat w= ith -O3 and PGO ices, while gnat built normally does not. We fail: #2 0x00000000019b7dcb in _Z13variable_sizeP9tree_node (size=3D0x7ffff74489= 00) at ../../gcc/stor-layout.c:172 172 gcc_assert (self_refs.length () > 0); (gdb) l 167 if (TREE_CODE (t) =3D=3D CALL_EXPR || self_referential_component_= ref_p (t)) 168 return size; 169 170 /* Collect the list of self-references in the expression. */ 171 find_placeholder_in_expr (size, &self_refs); 172 gcc_assert (self_refs.length () > 0); 173 174 /* Obtain a private copy of the expression. */ 175 t =3D size; here the gcc_assert fires. Sadly self_refs has no debug info. Size is: unit-size align:128 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7ffff745f0a8 precision:128 min max > readonly arg:0 unit-size align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7ffff746ae70 precision:8 min max context RM size RM max > readonly visited arg:0 readonly visited arg:0 readonly nothrow visited arg:0 visited arg:0 visited> arg:1 = >> arg:1 > arg:1 readonly visited arg:0 arg:1 >> arg:1 readonly arg:0 readonly arg:0 readonly arg:0 readonly arg:0 readonly visited arg:0 > arg:1 readonly visited arg:0 >> arg:1 >> arg:1 > arg:2 constant 0>> .P_BOUNDS->UB0 >=3D .P_BOUNDS->LB0 ? (bitsizetype) (((sizetype) .P_BOUNDS->UB0 - (sizetype) .P_BOUNDS->LB0) + 1)= * 8 : 0; I am not expert on Ada type sizes but it seems like well formed expression. and backtrace is: #0 _Z14internal_errorPKcz (gmsgid=3D0xac ) at ../../gcc/diagnostic.c:1752 #1 0x00000000010ba114 in _Z11fancy_abortPKciS0_ (file=3D0x23a38a8 "in %s, = at %s:%d", line=3D172, function=3D0x1e507bb "self_referential_size") at ../../gcc/diagnostic.c:1824 #2 0x00000000019b7dcb in _Z13variable_sizeP9tree_node (size=3D0x7ffff74489= 00) at ../../gcc/stor-layout.c:172 #3 _Z13variable_sizeP9tree_node (size=3D0x7ffff7448900) at ../../gcc/stor-layout.c:67 #4 0x000000000128f4e0 in finalize_type_size (type=3D0x7ffff746c3f0) at ../../gcc/stor-layout.c:1967 #5 0x000000000128df40 in _Z11layout_typeP9tree_node (type=3D0x23a38a8) at ../../gcc/stor-layout.c:2625 #6 0x000000000190e307 in _ZL18build_array_type_1P9tree_nodeS0_bbb.lto_priv= .0 (elt_type=3D0x7ffff745f3f0, index_type=3D0x7ffff746c348, typeless_storage= =3D59, shared=3D172, set_canonical=3D59) at ../../gcc/tree.c:8194 #7 0x0000000001567bcc in _Z18gnat_to_gnu_entityiP9tree_nodeb (gnat_entity=3D37370024, gnu_expr=3D0x1e507bb, definition=3D59) at ../../gcc/ada/gcc-interface/decl.c:2366 #8 0x00000000015618f5 in _Z16gnat_to_gnu_typei (gnat_entity=3D37370024) at ../../gcc/ada/gcc-interface/decl.c:4887 #9 0x00000000015687a9 in _Z18gnat_to_gnu_entityiP9tree_nodeb (gnat_entity=3D37370024, gnu_expr=3D0x1e507bb, definition=3D59) at ../../gcc/ada/gcc-interface/decl.c:4814 #10 0x00000000015618f5 in _Z16gnat_to_gnu_typei (gnat_entity=3D37370024) at ../../gcc/ada/gcc-interface/decl.c:4887 #11 0x00000000019ea47c in gigi (gnat_root=3D37370024, max_gnat_node=3D31786= 939, number_name=3D30016059, nodes_ptr=3D0xac, flags_ptr=3D0x1ca023b, next_node_= ptr=3D0x73, prev_node_ptr=3D0x0,=20 elists_ptr=3D0x0, elmts_ptr=3D0x0, strings_ptr=3D0x0, string_chars_ptr= =3D0x0, list_headers_ptr=3D0x0, number_file=3D12, file_info_ptr=3D0x7fffffffe3c0, standard_boolean=3D16, standard_integer=3D37,=20 standard_character=3D107, standard_long_long_float=3D100, standard_exception_type=3D1704, gigi_operating_mode=3D0) at ../../gcc/ada/gcc-interface/trans.c:463 #12 0x00000000019e406d in back_end__call_back_end (mode=3D(unknown: 1704)) = at ../../gcc/ada/back_end.adb:155 #13 0x0000000001928eed in _ada_gnat1drv () at ../../gcc/ada/gnat1drv.adb:16= 08 #14 0x0000000001910a4b in _ZL15gnat_parse_filev.lto_priv.0 () at ../../gcc/ada/gcc-interface/misc.c:118 #15 0x00000000019107f4 in _ZL12compile_filev.lto_priv.0 () at ../../gcc/toplev.c:460 #16 0x00000000018f3296 in _ZN6toplev4mainEiPPc (this=3D0x7fffffffe63e, argc= =3D21, argv=3D0x7fffffffe728) at ../../gcc/toplev.c:2321 #17 0x00000000018f26ec in main (argc=3D30016059, argv=3D0x1ca023b) at ../../gcc/main.c:39 Breakpointing on 171 works and vector seems to be filled in. However the disasembly shows: 0x00000000019b7db2 <+98>: callq 0x1a1c050 <_Z24find_placeholder_in_exprP9tree_nodeP3vecIS0_7va_heap6vl_ptrE> =3D> 0x00000000019b7db7 <+103>: mov $0x1e507bb,%edx 0x00000000019b7dbc <+108>: mov $0xac,%esi 0x00000000019b7dc1 <+113>: mov $0x1ca0231,%edi 0x00000000019b7dc6 <+118>: callq 0x10ba0f0 <_Z11fancy_abortPKciS0_> so it seems that the vector length test is completely optimized out in func= tion _Z13variable_sizeP9tree_node (after call to _Z24find_placeholder_in_exprP9tree_nodeP3vecIS0_7va_heap6vl_ptrE).=