From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
To: gcc-help@gcc.gnu.org
Cc: rep.dot.nop@gmail.com, jason@redhat.com
Subject: Re: C++: missing result_decl loc of (member) functions
Date: Sun, 24 Apr 2022 16:09:12 +0200 [thread overview]
Message-ID: <20220424160912.5c1f1ba9@nbbrfq> (raw)
In-Reply-To: <20220420192024.4353ac8c@nbbrfq>
On Wed, 20 Apr 2022 19:20:24 +0200
Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> wrote:
> Hi!
>
> I'm having a hard time to set the correct location of the result decl of
> member functions in C++. Any hint on where to best fix the missing
> locus?
> TIA for any hint (or a fix :).
>
> Long version:
> ¹) C functions work out fine once fixed to have the correct loc.
> C++ functions worked fine once, but i now see that apparently
> "int my_main" on line 42 regressed again in the meantime:
This is due to decl1 having been ggc_freed here:
diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
index c136dbbba1a..38874bf1558 100644
--- a/gcc/cp/decl.cc
+++ b/gcc/cp/decl.cc
@@ -17373,7 +17375,18 @@ start_function (cp_decl_specifier_seq *declspecs,
gcc_assert (same_type_p (TREE_TYPE (TREE_TYPE (decl1)),
integer_type_node));
- return start_preparsed_function (decl1, attrs, /*flags=*/SF_DEFAULT);
+ ret = start_preparsed_function (decl1, attrs, /*flags=*/SF_DEFAULT);
+
+ /* decl1 might be ggc_freed here. */
+ //decl1 = current_function_decl;
+
which is why i previously had to use current_function_decl here.
>
>
> $ XXX=1 ../gcc/xg++ -B../gcc -c -o return-narrow.o return-narrow.cc -fdiagnostics-color=always
> return-narrow.cc: In function ‘int my_main(int, char**)’:
> return-narrow.cc:42:25: warning: result decl locus sample
> 42 | int my_main (int, char**) { return 0; }
> | ^
> | the return type
next prev parent reply other threads:[~2022-04-24 14:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-20 17:20 Bernhard Reutner-Fischer
2022-04-24 14:09 ` Bernhard Reutner-Fischer [this message]
2022-04-25 15:22 ` Jason Merrill
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=20220424160912.5c1f1ba9@nbbrfq \
--to=rep.dot.nop@gmail.com \
--cc=gcc-help@gcc.gnu.org \
--cc=jason@redhat.com \
/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).