public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH][nvptx] Fix dummy location in gen_comment
Date: Wed, 23 Feb 2022 12:14:57 +0100	[thread overview]
Message-ID: <4f7dbb4e-1586-4a95-5588-794d739b6125@suse.de> (raw)
In-Reply-To: <20220222135337.GA1196@delia.home>

[-- Attachment #1: Type: text/plain, Size: 795 bytes --]

[ Re: [committed][nvptx] Add -mptx-comment ]

On 2/22/22 14:53, Tom de Vries wrote:
> Hi,
> 
> Add functionality that indicates which insns are added by -minit-regs, such
> that for instance we have for pr53465.s:
> ...
>          // #APP
> // 9 "gcc/testsuite/gcc.c-torture/execute/pr53465.c" 1
>          // Start: Added by -minit-regs=3:
>          // #NO_APP
>                  mov.u32 %r26, 0;
>          // #APP
> // 9 "gcc/testsuite/gcc.c-torture/execute/pr53465.c" 1
>          // End: Added by -minit-regs=3:
>          // #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, currently testing attached 
fix.

Thanks,
- Tom

[-- Attachment #2: 0001-nvptx-Fix-dummy-location-in-gen_comment.patch --]
[-- Type: text/x-patch, Size: 1538 bytes --]

[nvptx] Fix dummy location in gen_comment

I committed "[nvptx] Add -mptx-comment", but tested it in combination with 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 fault)
FAIL: gcc.dg/pr101223.c (internal compiler error: Segmentation fault)
FAIL: gcc.dg/torture/pr80764.c   -O2  (internal compiler error: Segmentation fault)
...

There are due to cfun->function_start_locus == 0.

Fix these by using DECL_SOURCE_LOCATION (cfun->decl) instead.

Tested on nvptx.

gcc/ChangeLog:

2022-02-23  Tom de Vries  <tdevries@suse.de>

	* config/nvptx/nvptx.cc (gen_comment): Use
	DECL_SOURCE_LOCATION (cfun->decl) instead of cfun->function_start_locus.

---
 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 = (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.

  reply	other threads:[~2022-02-23 11:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-22 13:53 [committed][nvptx] Add -mptx-comment Tom de Vries
2022-02-23 11:14 ` Tom de Vries [this message]
2022-02-23 11:58   ` [PATCH][nvptx] Fix dummy location in gen_comment Thomas Schwinge
2022-02-24  8:23     ` [committed][nvptx] " Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4f7dbb4e-1586-4a95-5588-794d739b6125@suse.de \
    --to=tdevries@suse.de \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).