From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id AA393385BF81 for ; Wed, 23 Feb 2022 11:58:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AA393385BF81 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: pA0MNua4n+PHddkba1KXSm07RwS89Nwn22j5gc+B5CFFMCBw+1LvWlCV4zQ1f3tWNv7vmzMchq leNJaZkPmJJfWVF79P1dvel+Lj76vk609JLVZEhWH/lV6R4vXvn78hEWzjRljqFFNp5gvmP5Z0 O/JEzEKXbZD++QfStZvoeatAaAC2Ij7jEqyo43br3r4b2f6gX4kC6EhVg/mdHezlcYoC0u4m27 UtqVITW3CvzhK+WHA/AcEq9gcV3v+ZUjI/MstPmG6jdW5HbDFYs80FoQLeZgOwVxgUasOgEiRD emTVtVZlSiox6iW65M/2xHX/ X-IronPort-AV: E=Sophos;i="5.88,390,1635235200"; d="scan'208";a="72298578" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 23 Feb 2022 03:58:55 -0800 IronPort-SDR: sCSCl8q3m3cosFrfMixfiVe1/Z6ll/VV3JWwOkPhnYS4jxG+Xx5isy4NXu0vG5k/z8fp2lm6F+ sgLTFTuvyfTFh36q/aweGvS3c9FozlLW8WKQ1uc94cKr8NMq82NTk1SStfgnVO7i+nJ7OPuO17 iP4oLL5Hn9IEXFVMBfDzJ6vkuQDXacjqsENTgJahPEUgd0iDBxMLlLwXRR1enJs65rH2l9gVit e77/gteo1XcXU5a87P2xBcPX7+kABrHqeYrgFmDsfZeJFVt2V7A5q0mocrZ8AoceaZMo9S4alr 6NA= From: Thomas Schwinge To: Tom de Vries CC: Subject: Re: [PATCH][nvptx] Fix dummy location in gen_comment In-Reply-To: <4f7dbb4e-1586-4a95-5588-794d739b6125@suse.de> References: <20220222135337.GA1196@delia.home> <4f7dbb4e-1586-4a95-5588-794d739b6125@suse.de> User-Agent: Notmuch/0.29.3+94~g74c3f1b (https://notmuchmail.org) Emacs/27.1 (x86_64-pc-linux-gnu) Date: Wed, 23 Feb 2022 12:58:42 +0100 Message-ID: <87pmndokul.fsf@euler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-02.mgc.mentorg.com (139.181.222.2) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Feb 2022 11:58:58 -0000 Hi! On 2022-02-23T12:14:57+0100, Tom de Vries via Gcc-patches wrote: > [ Re: [committed][nvptx] Add -mptx-comment ] > > On 2/22/22 14:53, Tom de Vries wrote: >> Add functionality that indicates which insns are added by -minit-regs, s= uch >> that for instance we have for pr53465.s: >> ... >> // #APP >> // 9 "gcc/testsuite/gcc.c-torture/execute/pr53465.c" 1 >> // Start: Added by -minit-regs=3D3: >> // #NO_APP >> mov.u32 %r26, 0; >> // #APP >> // 9 "gcc/testsuite/gcc.c-torture/execute/pr53465.c" 1 >> // End: Added by -minit-regs=3D3: >> // #NO_APP >> ... >> >> Can be switched off using -mno-ptx-comment. >> >> Tested on nvptx. > > But tested in combination with another patch, which is still waiting for > review. > > This patch by itself caused some regressions I'd just begun analyzing and determined that it was commit c2b23aaaf4457278403c01cd145cd3936683384e "[nvptx] Add -mptx-comment" that causes a load of FAILs in nvptx offloading testing: Program received signal SIGSEGV, Segmentation fault. 0x000000000084abad in final_scan_insn_1 (insn=3Dinsn@entry=3D0x7ffff738= 0940, file=3Dfile@entry=3D0x1f50c40, optimize_p=3Doptimize_p@entry=3D0, nop= eepholes=3Dnopeepholes@entry=3D0, seen=3Dseen@entry=3D0x7fffffffd07c) at [.= ..]/source-gcc/gcc/final.cc:2650 2650 if (*loc.file && loc.line) (gdb) print loc $1 =3D {file =3D 0x0, line =3D 0, column =3D 0, data =3D 0x0, sysp =3D = false} (gdb) bt #0 0x000000000084abad in final_scan_insn_1 (insn=3Dinsn@entry=3D0x7fff= f7380940, file=3Dfile@entry=3D0x1f50c40, optimize_p=3Doptimize_p@entry=3D0,= nopeepholes=3Dnopeepholes@entry=3D0, seen=3Dseen@entry=3D0x7fffffffd07c) a= t [...]/source-gcc/gcc/final.cc:2650 #1 0x000000000084b86a in final_scan_insn (insn=3Dinsn@entry=3D0x7ffff7= 380940, file=3Dfile@entry=3D0x1f50c40, optimize_p=3Doptimize_p@entry=3D0, n= opeepholes=3Dnopeepholes@entry=3D0, seen=3Dseen@entry=3D0x7fffffffd07c) at = [...]/source-gcc/gcc/final.cc:2942 #2 0x000000000084823a in final_1 (first=3D0x7ffff74631c0, file=3D0x1f5= 0c40, seen=3D1, optimize_p=3D0) at [...]/source-gcc/gcc/final.cc:1999 #3 0x000000000085091a in rest_of_handle_final () at [...]/source-gcc/g= cc/final.cc:4287 #4 0x0000000000850de4 in (anonymous namespace)::pass_final::execute (t= his=3D0x1f4bd00) at [...]/source-gcc/gcc/final.cc:4365 #5 0x0000000000b781b1 in execute_one_pass (pass=3Dpass@entry=3D0x1f4bd= 00) at [...]/source-gcc/gcc/passes.cc:2639 #6 0x0000000000b7855a in execute_pass_list_1 (pass=3D0x1f4bd00) at [..= .]/source-gcc/gcc/passes.cc:2739 #7 0x0000000000b7858d in execute_pass_list_1 (pass=3D0x1f4b820) at [..= .]/source-gcc/gcc/passes.cc:2740 #8 0x0000000000b7858d in execute_pass_list_1 (pass=3D0x1f49d20, pass@e= ntry=3D0x1f45780) at [...]/source-gcc/gcc/passes.cc:2740 #9 0x0000000000b785e9 in execute_pass_list (fn=3D0x7ffff72e1e40, pass= =3D0x1f45780) at [...]/source-gcc/gcc/passes.cc:2750 #10 0x0000000000732a66 in cgraph_node::expand (this=3D0x7ffff72efbb0) a= t [...]/source-gcc/gcc/cgraphunit.cc:1836 #11 0x000000000073336a in cgraph_order_sort::process (this=3D0x20730f8)= at [...]/source-gcc/gcc/cgraphunit.cc:2075 #12 0x00000000007336f4 in output_in_order () at [...]/source-gcc/gcc/cg= raphunit.cc:2143 #13 0x0000000000733dbe in symbol_table::compile (this=3D0x7ffff7542000)= at [...]/source-gcc/gcc/cgraphunit.cc:2347 #14 0x000000000065d79b in lto_main () at [...]/source-gcc/gcc/lto/lto.c= c:655 #15 0x0000000000c709e6 in compile_file () at [...]/source-gcc/gcc/tople= v.cc:454 #16 0x0000000000c73abb in do_compile (no_backend=3Dno_backend@entry=3Df= alse) at [...]/source-gcc/gcc/toplev.cc:2160 #17 0x0000000000c73ea6 in toplev::main (this=3Dthis@entry=3D0x7fffffffd= 4b0, argc=3Dargc@entry=3D16, argv=3D0x1f1db40, argv@entry=3D0x7fffffffd5b8)= at [...]/source-gcc/gcc/toplev.cc:2312 #18 0x000000000174fe5f in main (argc=3D16, argv=3D0x7fffffffd5b8) at [.= ..]/source-gcc/gcc/main.cc:41 > currently testing attached > fix. Per the test results that I've got so far (but is still running), your proposed fix does resolve the SIGSEGVs, thanks. Gr=C3=BC=C3=9Fe Thomas > [nvptx] Fix dummy location in gen_comment > > I committed "[nvptx] Add -mptx-comment", but tested it in combination wit= h the > proposed "[final] Handle compiler-generated asm insn" ( > https://gcc.gnu.org/pipermail/gcc-patches/2022-February/590721.html ), so > by itself the commit introduced some regressions: > ... > FAIL: gcc.dg/20020426-2.c (internal compiler error: Segmentation fault) > FAIL: gcc.dg/analyzer/zlib-3.c (internal compiler error: Segmentation fau= lt) > FAIL: gcc.dg/pr101223.c (internal compiler error: Segmentation fault) > FAIL: gcc.dg/torture/pr80764.c -O2 (internal compiler error: Segmentat= ion fault) > ... > > There are due to cfun->function_start_locus =3D=3D 0. > > Fix these by using DECL_SOURCE_LOCATION (cfun->decl) instead. > > Tested on nvptx. > > gcc/ChangeLog: > > 2022-02-23 Tom de Vries > > * config/nvptx/nvptx.cc (gen_comment): Use > DECL_SOURCE_LOCATION (cfun->decl) instead of cfun->function_start_l= ocus. > > --- > gcc/config/nvptx/nvptx.cc | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc > index 858789e6df76..6f6d592e4621 100644 > --- a/gcc/config/nvptx/nvptx.cc > +++ b/gcc/config/nvptx/nvptx.cc > @@ -5382,7 +5382,7 @@ gen_comment (const char *s) > char *comment =3D (char *) alloca (len); > snprintf (comment, len, "%s%s%s", ASM_COMMENT_START, sep, s); > return gen_rtx_ASM_INPUT_loc (VOIDmode, ggc_strdup (comment), > - cfun->function_start_locus); > + DECL_SOURCE_LOCATION (cfun->decl)); > } > > /* Initialize all declared regs at function entry. ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe 201= , 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch=C3= =A4ftsf=C3=BChrer: Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellschaf= t: M=C3=BCnchen; Registergericht M=C3=BCnchen, HRB 106955