From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id 1F3D93892446; Sun, 18 Jul 2021 23:29:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1F3D93892446 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-8769] dwarf2out: Handle COMPOUND_LITERAL_EXPR in loc_list_from_tree_1 [PR101266] X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: 86a9718e162b08cd4263402bcbf0d17a557bfcf1 X-Git-Newrev: 135680bdce4577208daf0507089ac932abdbf5f9 Message-Id: <20210718232902.1F3D93892446@sourceware.org> Date: Sun, 18 Jul 2021 23:29:02 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jul 2021 23:29:02 -0000 https://gcc.gnu.org/g:135680bdce4577208daf0507089ac932abdbf5f9 commit r11-8769-g135680bdce4577208daf0507089ac932abdbf5f9 Author: Jakub Jelinek 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 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 079b617fd0c..7606371296e 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -19206,6 +19206,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}]) +{ +}