https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78363
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |openmp, wrong-debug CC| |jakub at gcc dot gnu.org --- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- So we emit late debug for <function_decl 0x7ffff6a06400 operator()> we didn't emit early debug for. But we pruned its (type) context already. So the bug is that we fail to emit early debug for the above decl. (gdb) p decl $8 = <function_decl 0x7ffff6a06400 operator()> (gdb) p decl_function_context(decl) $7 = (tree_node *) 0x7ffff6a06300 (gdb) p debug_tree ($7) <function_decl 0x7ffff6a06300 main ... I believe the issue is that the contexts are bogus when the OMP blocks are outlined. We have Breakpoint 5, dwarf2out_early_global_decl (decl= <function_decl 0x7ffff6a06c00 main._omp_fn.0>) at /space/rguenther/src/svn/trunk/gcc/dwarf2out.c:25227 25227 set_early_dwarf s; Missing separate debuginfos, use: zypper install libgmp10-debuginfo-6.0.0-71.1.x86_64 libisl15-debuginfo-0.16.1-0.x86_64 libmpc3-debuginfo-1.0.2-38.2.x86_64 libmpfr4-debuginfo-3.1.2-3.1.2.x86_64 (gdb) p debug_tree (decl->decl_common.initial) <block 0x7ffff6a0fc60 used ... align 32 context <function_decl 0x7ffff6a06c00 main._omp_fn.0> chain <type_decl 0x7ffff6a02e40 __lambda0>> supercontext <block 0x7ffff6a0fc60> subblocks <block 0x7ffff6a0fcc0 used vars <var_decl 0x7ffff6a23870 retval.2> supercontext <block 0x7ffff6a0fb40>>>> $1 = void (gdb) p debug_tree (0x7ffff6a02e40) <type_decl 0x7ffff6a02e40 __lambda0 type <record_type 0x7ffff6a03738 __lambda0 type_5 QI ... decl_2 decl_5 VOID file t.ii line 5 col 23 align 8 context <function_decl 0x7ffff6a06300 main>> so whenever dwarf2out looks at contexts of __lambda0 it ends up at main rather tha at main._omp_fn.0. This is an artifact of move_sese_region_to_fn not copying anything but just "rewiring" stuff. It already replaces BLOCK_VARS by "duplicates" but fails to handle non-vars.