public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/103329] [11/12 Regression] Code divergence in debug info with -fdump-tree-original since r11-291-g0f50f6daa140186a Date: Mon, 22 Nov 2021 17:40:20 +0000 [thread overview] Message-ID: <bug-103329-4-GGV0nNQn35@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-103329-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103329 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The problem seems that in order to print the *.original dump (but apparently also in order to emit some warnings), we trigger: #0 used_types_insert (t=<enumeral_type 0x7fffea1d4b28 ._anon_0>) at ../../gcc/function.c:6422 #1 0x0000000000c26eb6 in mark_used (decl=<const_decl 0x7fffea1c2380 __value>, complain=0) at ../../gcc/cp/decl2.c:5681 #2 0x0000000000dee6f0 in tsubst_qualified_id (qualified_id=<scope_ref 0x7fffea1c4258>, args=<tree_vec 0x7fffea1dbe38>, complain=0, in_decl=<type_decl 0x7fffea1c5130 __promote_2>, done=true, address_p=false) at ../../gcc/cp/pt.c:16460 #3 0x0000000000e03d01 in tsubst_copy_and_build (t=<scope_ref 0x7fffea1c4258>, args=<tree_vec 0x7fffea1dbe38>, complain=0, in_decl=<type_decl 0x7fffea1c5130 __promote_2>, function_p=false, integral_constant_expression_p=true) at ../../gcc/cp/pt.c:20046 #4 0x0000000000e0041a in tsubst_expr (t=<scope_ref 0x7fffea1c4258>, args=<tree_vec 0x7fffea1dbe38>, complain=0, in_decl=<type_decl 0x7fffea1c5130 __promote_2>, integral_constant_expression_p=true) at ../../gcc/cp/pt.c:19228 #5 0x0000000000dd88cf in tsubst_template_arg (t=<scope_ref 0x7fffea1c4258>, args=<tree_vec 0x7fffea1dbe38>, complain=0, in_decl=<type_decl 0x7fffea1c5130 __promote_2>) at ../../gcc/cp/pt.c:12342 #6 0x0000000000ddcca6 in tsubst_template_args (t=<tree_vec 0x7fffea1c41e0>, args=<tree_vec 0x7fffea1dbe38>, complain=0, in_decl=<type_decl 0x7fffea1c5130 __promote_2>) at ../../gcc/cp/pt.c:13433 #7 0x0000000000ddd9e7 in tsubst_aggr_type (t=<record_type 0x7fffea1ab7e0 __promote>, args=<tree_vec 0x7fffea1dbe38>, complain=0, in_decl=<type_decl 0x7fffea1c5130 __promote_2>, entering_scope=0) at ../../gcc/cp/pt.c:13637 #8 0x0000000000deaa22 in tsubst (t=<record_type 0x7fffea1ab7e0 __promote>, args=<tree_vec 0x7fffea1dbe38>, complain=0, in_decl=<type_decl 0x7fffea1c5130 __promote_2>) at ../../gcc/cp/pt.c:15527 #9 0x0000000000de7c32 in tsubst_decl (t=<type_decl 0x7fffea1c5130 __promote_2>, args=<tree_vec 0x7fffea1dbe38>, complain=0) at ../../gcc/cp/pt.c:14825 #10 0x0000000000dea26e in tsubst (t=<type_decl 0x7fffea1c5130 __promote_2>, args=<tree_vec 0x7fffea1dbe38>, complain=0, in_decl=<template_decl 0x7fffea1c1380 __promote_2>) at ../../gcc/cp/pt.c:15447 #11 0x0000000000e0ac1c in instantiate_template_1 (tmpl=<template_decl 0x7fffea1c1380 __promote_2>, orig_args=<tree_vec 0x7fffea1dbe38>, complain=0) at ../../gcc/cp/pt.c:21337 #12 0x0000000000e0b2f2 in instantiate_template (tmpl=<template_decl 0x7fffea1c1380 __promote_2>, orig_args=<tree_vec 0x7fffea1dbe38>, complain=0) at ../../gcc/cp/pt.c:21396 #13 0x0000000000e0b466 in instantiate_alias_template (tmpl=<template_decl 0x7fffea1c1380 __promote_2>, args=<tree_vec 0x7fffea1dbe38>, complain=0) at ../../gcc/cp/pt.c:21434 #14 0x0000000000dea49d in tsubst (t=<record_type 0x7fffea1aba80 __promote_2>, args=<tree_vec 0x7fffea1d08e8>, complain=0, in_decl=<tree 0x0>) at ../../gcc/cp/pt.c:15472 #15 0x0000000000c2e7e1 in dump_template_bindings (pp=0x3e0c5a0 <actual_pretty_printer>, parms=<tree 0x0>, args=<tree_vec 0x7fffea1d08e8>, typenames=0x7fffea1dbd98 = {...}) at ../../gcc/cp/error.c:482 #16 0x0000000000c34a2f in dump_substitution (pp=0x3e0c5a0 <actual_pretty_printer>, t=<template_decl 0x7fffea1c1500 pow>, template_parms=<tree_list 0x7fffea1c44b0>, template_args=<tree_vec 0x7fffea1d08e8>, flags=4) at ../../gcc/cp/error.c:1638 #17 0x0000000000c365d1 in dump_function_decl (pp=0x3e0c5a0 <actual_pretty_printer>, t=<template_decl 0x7fffea1c1500 pow>, flags=4) at ../../gcc/cp/error.c:1797 #18 0x0000000000c33917 in dump_decl (pp=0x3e0c5a0 <actual_pretty_printer>, t=<function_decl 0x7fffea1d7000 pow>, flags=4) at ../../gcc/cp/error.c:1369 #19 0x0000000000c3cf88 in decl_as_string (decl=<function_decl 0x7fffea1d7000 pow>, flags=4) at ../../gcc/cp/error.c:3118 #20 0x0000000000c3d060 in lang_decl_name (decl=<function_decl 0x7fffea1d7000 pow>, v=2, translate=false) at ../../gcc/cp/error.c:3153 #21 0x0000000000e8b59f in cxx_printable_name_internal (decl=<function_decl 0x7fffea1d7000 pow>, v=2, translate=false) at ../../gcc/cp/tree.c:2678 #22 0x0000000000e8b63c in cxx_printable_name (decl=<function_decl 0x7fffea1d7000 pow>, v=2) at ../../gcc/cp/tree.c:2687 #23 0x0000000000f4f4c3 in c_genericize (fndecl=<function_decl 0x7fffea1d7000 pow>) at ../../gcc/c-family/c-gimplify.c:587 where when trying to print the pow decl into the dump file, we instantiate the template and that leads to adding the anonymous enum to types_used_by_cur_var_decl vector (or attached to current function). Later on we do in cp_finish_decl 8260 /* So decl is a global variable or a static member of a 8261 non local class. Record the types it uses 8262 so that we can decide later to emit debug info for them. */ 8263 record_types_used_by_current_var_decl (decl); and attach those types to a random unrelated decl (a guard variable in this case). Similarly, without -fdump-tree-original and without -w, we trigger it during: #0 used_types_insert (t=<enumeral_type 0x7fffea1d4b28 ._anon_0>) at ../../gcc/function.c:6422 #1 0x0000000000c26eb6 in mark_used (decl=<const_decl 0x7fffea1c2380 __value>, complain=0) at ../../gcc/cp/decl2.c:5681 #2 0x0000000000dee6f0 in tsubst_qualified_id (qualified_id=<scope_ref 0x7fffea1c4258>, args=<tree_vec 0x7fffea1dbe38>, complain=0, in_decl=<type_decl 0x7fffea1c5130 __promote_2>, done=true, address_p=false) at ../../gcc/cp/pt.c:16460 #3 0x0000000000e03d01 in tsubst_copy_and_build (t=<scope_ref 0x7fffea1c4258>, args=<tree_vec 0x7fffea1dbe38>, complain=0, in_decl=<type_decl 0x7fffea1c5130 __promote_2>, function_p=false, integral_constant_expression_p=true) at ../../gcc/cp/pt.c:20046 #4 0x0000000000e0041a in tsubst_expr (t=<scope_ref 0x7fffea1c4258>, args=<tree_vec 0x7fffea1dbe38>, complain=0, in_decl=<type_decl 0x7fffea1c5130 __promote_2>, integral_constant_expression_p=true) at ../../gcc/cp/pt.c:19228 #5 0x0000000000dd88cf in tsubst_template_arg (t=<scope_ref 0x7fffea1c4258>, args=<tree_vec 0x7fffea1dbe38>, complain=0, in_decl=<type_decl 0x7fffea1c5130 __promote_2>) at ../../gcc/cp/pt.c:12342 #6 0x0000000000ddcca6 in tsubst_template_args (t=<tree_vec 0x7fffea1c41e0>, args=<tree_vec 0x7fffea1dbe38>, complain=0, in_decl=<type_decl 0x7fffea1c5130 __promote_2>) at ../../gcc/cp/pt.c:13433 #7 0x0000000000ddd9e7 in tsubst_aggr_type (t=<record_type 0x7fffea1ab7e0 __promote>, args=<tree_vec 0x7fffea1dbe38>, complain=0, in_decl=<type_decl 0x7fffea1c5130 __promote_2>, entering_scope=0) at ../../gcc/cp/pt.c:13637 #8 0x0000000000deaa22 in tsubst (t=<record_type 0x7fffea1ab7e0 __promote>, args=<tree_vec 0x7fffea1dbe38>, complain=0, in_decl=<type_decl 0x7fffea1c5130 __promote_2>) at ../../gcc/cp/pt.c:15527 #9 0x0000000000de7c32 in tsubst_decl (t=<type_decl 0x7fffea1c5130 __promote_2>, args=<tree_vec 0x7fffea1dbe38>, complain=0) at ../../gcc/cp/pt.c:14825 #10 0x0000000000dea26e in tsubst (t=<type_decl 0x7fffea1c5130 __promote_2>, args=<tree_vec 0x7fffea1dbe38>, complain=0, in_decl=<template_decl 0x7fffea1c1380 __promote_2>) at ../../gcc/cp/pt.c:15447 #11 0x0000000000e0ac1c in instantiate_template_1 (tmpl=<template_decl 0x7fffea1c1380 __promote_2>, orig_args=<tree_vec 0x7fffea1dbe38>, complain=0) at ../../gcc/cp/pt.c:21337 #12 0x0000000000e0b2f2 in instantiate_template (tmpl=<template_decl 0x7fffea1c1380 __promote_2>, orig_args=<tree_vec 0x7fffea1dbe38>, complain=0) at ../../gcc/cp/pt.c:21396 #13 0x0000000000e0b466 in instantiate_alias_template (tmpl=<template_decl 0x7fffea1c1380 __promote_2>, args=<tree_vec 0x7fffea1dbe38>, complain=0) at ../../gcc/cp/pt.c:21434 #14 0x0000000000dea49d in tsubst (t=<record_type 0x7fffea1aba80 __promote_2>, args=<tree_vec 0x7fffea1d08e8>, complain=0, in_decl=<tree 0x0>) at ../../gcc/cp/pt.c:15472 #15 0x0000000000c2e7e1 in dump_template_bindings (pp=0x3e0c5a0 <actual_pretty_printer>, parms=<tree 0x0>, args=<tree_vec 0x7fffea1d08e8>, typenames=0x7fffea1dbd98 = {...}) at ../../gcc/cp/error.c:482 #16 0x0000000000c34a2f in dump_substitution (pp=0x3e0c5a0 <actual_pretty_printer>, t=<template_decl 0x7fffea1c1500 pow>, template_parms=<tree_list 0x7fffea1c44b0>, template_args=<tree_vec 0x7fffea1d08e8>, flags=132) at ../../gcc/cp/error.c:1638 #17 0x0000000000c365d1 in dump_function_decl (pp=0x3e0c5a0 <actual_pretty_printer>, t=<template_decl 0x7fffea1c1500 pow>, flags=132) at ../../gcc/cp/error.c:1797 #18 0x0000000000c33917 in dump_decl (pp=0x3e0c5a0 <actual_pretty_printer>, t=<function_decl 0x7fffea1d7000 pow>, flags=132) at ../../gcc/cp/error.c:1369 #19 0x0000000000c3d5ab in decl_to_string (decl=<function_decl 0x7fffea1d7000 pow>, verbose=1) at ../../gcc/cp/error.c:3217 #20 0x0000000000c41255 in cp_printer (pp=0x3fff130, text=0x7fffffffce90, spec=0x4001452 "D", precision=0, wide=false, set_locus=false, verbose=true, quoted=0x7fffffffcaaf, buffer_ptr=0x4001240) at ../../gcc/cp/error.c:4388 #21 0x0000000002d5af22 in pp_format (pp=0x3fff130, text=0x7fffffffce90) at ../../gcc/pretty-print.c:1475 #22 0x0000000002d5b2fa in pp_format_verbatim (pp=0x3fff130, text=0x7fffffffce90) at ../../gcc/pretty-print.c:1536 #23 0x0000000002d5bb4e in pp_verbatim (pp=0x3fff130, msg=0x2e32238 "%s: In instantiation of %q#D:\n") at ../../gcc/pretty-print.c:1790 #24 0x0000000000c3f369 in print_instantiation_full_context (context=0x3f9bf40 <global_diagnostic_context>) at ../../gcc/cp/error.c:3627 #25 0x0000000000c3f86e in maybe_print_instantiation_context (context=0x3f9bf40 <global_diagnostic_context>) at ../../gcc/cp/error.c:3775 #26 0x0000000000c3deb3 in cp_diagnostic_starter (context=0x3f9bf40 <global_diagnostic_context>, diagnostic=0x7fffffffd0a0) at ../../gcc/cp/error.c:3466 #27 0x0000000002d316bb in diagnostic_report_diagnostic (context=0x3f9bf40 <global_diagnostic_context>, diagnostic=0x7fffffffd0a0) at ../../gcc/diagnostic.c:1347 #28 0x0000000002d31d9c in diagnostic_impl (richloc=0x7fffffffd270, metadata=0x0, opt=714, gmsgid=0x2e2b9a8 "no return statement in function returning non-void", ap=0x7fffffffd170, kind=DK_WARNING) at ../../gcc/diagnostic.c:1508 #29 0x0000000002d3277e in warning_at (richloc=0x7fffffffd270, opt=714, gmsgid=0x2e2b9a8 "no return statement in function returning non-void") at ../../gcc/diagnostic.c:1660 I wonder if the error.c spots that trigger tsubst shouldn't temporarily set some FE global flag that would either cause if (TREE_CODE (decl) == CONST_DECL) used_types_insert (DECL_CONTEXT (decl)); in mark_used not to happen, or perhaps the whole mark_used not to be done altogether?
next prev parent reply other threads:[~2021-11-22 17:40 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-11-19 10:40 [Bug c++/103329] New: " marxin at gcc dot gnu.org 2021-11-19 10:41 ` [Bug c++/103329] " marxin at gcc dot gnu.org 2021-11-19 13:00 ` rguenth at gcc dot gnu.org 2021-11-22 17:40 ` jakub at gcc dot gnu.org [this message] 2021-12-31 15:56 ` jakub at gcc dot gnu.org 2022-01-18 14:27 ` rguenth at gcc dot gnu.org 2022-04-05 16:46 ` jason at gcc dot gnu.org 2022-04-05 19:16 ` jason at gcc dot gnu.org 2022-04-05 19:16 ` jason at gcc dot gnu.org 2022-04-06 8:47 ` marxin 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-103329-4-GGV0nNQn35@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: linkBe 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).