public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r9-10086] dwarf2out: Handle COMPOUND_LITERAL_EXPR in loc_list_from_tree_1 [PR101266]
Date: Wed, 11 May 2022 06:21:08 +0000 (GMT)	[thread overview]
Message-ID: <20220511062108.9C7DB38425B1@sourceware.org> (raw)

https://gcc.gnu.org/g:1df7b899cd854fdda052fb6218c2ff9e8898df42

commit r9-10086-g1df7b899cd854fdda052fb6218c2ff9e8898df42
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Jul 1 09:45:02 2021 +0200

    dwarf2out: Handle COMPOUND_LITERAL_EXPR in loc_list_from_tree_1 [PR101266]
    
    In this case dwarf2out_decl is called from the FEs with GENERIC but not
    yet gimplified expressions in it.
    
    As loc_list_from_tree_1 has an exhaustive list of tree codes it wants to
    handle and for checking asserts no other codes makes it in, we should
    handle even GENERIC trees that shouldn't be valid in GIMPLE.
    
    The following patch handles COMPOUND_LITERAL_EXPR by hnadling it like the
    underlying VAR_DECL temporary.
    
    Verified the emitted DWARF is correct (but unoptimized, we emit
    DW_OP_lit1 DW_OP_lit1 DW_OP_minus for the upper bound).
    
    2021-07-01  Jakub Jelinek  <jakub@redhat.com>
    
            PR debug/101266
            * dwarf2out.c (loc_list_from_tree_1): Handle COMPOUND_LITERAL_EXPR.
    
            * gcc.dg/pr101266.c: New test.
    
    (cherry picked from commit b0ab968999c9af88d45acf552ca673ef3960306a)

Diff:
---
 gcc/dwarf2out.c                 | 4 ++++
 gcc/testsuite/gcc.dg/pr101266.c | 8 ++++++++
 2 files changed, 12 insertions(+)

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 6f2bfb919a9..5dc6171284c 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -18900,6 +18900,10 @@ loc_list_from_tree_1 (tree loc, int want_address,
     case FIX_TRUNC_EXPR:
       return 0;
 
+    case COMPOUND_LITERAL_EXPR:
+      return loc_list_from_tree_1 (COMPOUND_LITERAL_EXPR_DECL (loc),
+				   0, context);
+
     default:
       /* Leave front-end specific codes as simply unknown.  This comes
 	 up, for instance, with the C STMT_EXPR.  */
diff --git a/gcc/testsuite/gcc.dg/pr101266.c b/gcc/testsuite/gcc.dg/pr101266.c
new file mode 100644
index 00000000000..d1980891a01
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr101266.c
@@ -0,0 +1,8 @@
+/* PR debug/101266 */
+/* { dg-do compile } */
+/* { dg-options "-g -O2" } */
+
+void
+foo (int (*p)[(int){1}])
+{
+}


                 reply	other threads:[~2022-05-11  6:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220511062108.9C7DB38425B1@sourceware.org \
    --to=jakub@gcc.gnu.org \
    --cc=gcc-cvs@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).