public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/110055] Dangling pointer warning inside std::vector on RISC-V
Date: Fri, 02 Jun 2023 07:25:58 +0000	[thread overview]
Message-ID: <bug-110055-4-ecgQE78yTJ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110055-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110055

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
The clobber is built by gimplify_target_expr and TARGET_EXPR_SLOT is changed
in place to the static variable.

Does the following fix the RISC-V issue?

diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index ade6e335da7..aece89a3e9b 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -7154,8 +7154,10 @@ gimplify_target_expr (tree *expr_p, gimple_seq *pre_p,
gimple_seq *post_p)
        gimplify_and_add (init, &init_pre_p);

       /* Add a clobber for the temporary going out of scope, like
-        gimplify_bind_expr.  */
+        gimplify_bind_expr.  But only if we did not promote the
+        temporary to static storage.  */
       if (gimplify_ctxp->in_cleanup_point_expr
+         && !TREE_STATIC (temp)
          && needs_to_live_in_memory (temp))
        {
          if (flag_stack_reuse == SR_ALL)

  parent reply	other threads:[~2023-06-02  7:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31 10:03 [Bug c++/110055] New: " spriteovo at gmail dot com
2023-05-31 10:05 ` [Bug c++/110055] " spriteovo at gmail dot com
2023-05-31 13:32 ` spriteovo at gmail dot com
2023-05-31 23:46 ` [Bug middle-end/110055] " pinskia at gcc dot gnu.org
2023-05-31 23:47 ` pinskia at gcc dot gnu.org
2023-06-01  0:07 ` pinskia at gcc dot gnu.org
2023-06-02  7:13 ` rguenth at gcc dot gnu.org
2023-06-02  7:25 ` rguenth at gcc dot gnu.org [this message]
2023-06-05 11:15 ` spriteovo at gmail dot com
2023-06-06  8:30 ` cvs-commit at gcc dot gnu.org
2023-06-06  8:41 ` [Bug middle-end/110055] [13 Regression] " rguenth at gcc dot gnu.org
2023-06-23 10:30 ` cvs-commit at gcc dot gnu.org
2023-06-23 10:30 ` rguenth at gcc dot gnu.org

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=bug-110055-4-ecgQE78yTJ@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).