Do that by doing the recursion to subblocks on the single subblock
of STMT. */
bool unwrap_one = false;
- if (BLOCK_SUBBLOCKS (stmt) && !BLOCK_CHAIN (BLOCK_SUBBLOCKS (stmt)))
+ tree sub = BLOCK_SUBBLOCKS (stmt);
+ if (sub)
{
- tree origin = block_ultimate_origin (BLOCK_SUBBLOCKS (stmt));
+ tree origin = block_ultimate_origin (sub);
if (origin
&& TREE_CODE (origin) == BLOCK
&& BLOCK_SUPERCONTEXT (origin) == decl)
unwrap_one = true;
+ for (tree next = BLOCK_CHAIN (sub); unwrap_one && next;
+ next = BLOCK_CHAIN (next))
+ if (BLOCK_FRAGMENT_ORIGIN (next) != sub)
+ unwrap_one = false;
}
decls_for_scope (stmt, subr_die, !unwrap_one);
if (unwrap_one)
- decls_for_scope (BLOCK_SUBBLOCKS (stmt), subr_die);
+ {
+ decls_for_scope (sub, subr_die);
+ for (sub = BLOCK_CHAIN (sub); sub; sub = BLOCK_CHAIN (sub))
+ gen_block_die (sub, subr_die);
+ }
}
/* Generate a DIE for a field in a record, or structure. CTX is required: see
--- /dev/null
+/* Verify that both inline instances have a DW_AT_ranges but
+ no extra DW_TAG_lexical_block. */
+/* { dg-options "-O -gdwarf -dA" } */
+/* { dg-do compile } */
+/* { dg-final { scan-assembler-times "\\(DIE \\(\[^\n\]*\\) DW_TAG_inlined_subroutine" 2 } } */
+/* { dg-final { scan-assembler-times " DW_AT_ranges" 2 } } */
+/* { dg-final { scan-assembler-times "\\(DIE \\(\[^\n\]*\\) DW_TAG_lexical_block" 0 } } */
+
+static int foo (int i)
+{
+ volatile int j = i + 3;
+ if (j == 3)
+ return 0;
+ return j - 2;
+}
+int main()
+{
+ volatile int z = foo (-2) && foo (-1);
+ return z;
+}