* [Bug c++/96690] [10/11 Regression] ICE in write_type since r10-6087
2020-08-18 20:03 [Bug c++/96690] New: [10/11 Regression] ICE in write_type since r10-6087 jakub at gcc dot gnu.org
@ 2020-08-18 20:12 ` jakub at gcc dot gnu.org
2020-08-18 20:13 ` jakub at gcc dot gnu.org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-08-18 20:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96690
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Target Milestone|--- |10.3
Last reconfirmed| |2020-08-18
CC| |hubicka at gcc dot gnu.org,
| |rguenth at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The problem is that free_lang_data marks the const qualified int type, but does
not mark the non-qualified int type and we then later try to mangle something
and ICE during the mangling, where mangler asserts that TYPE_MAIN_VARIANT of
the qualified types it is given are non-qualified (in particular different from
the qualified type).
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/96690] [10/11 Regression] ICE in write_type since r10-6087
2020-08-18 20:03 [Bug c++/96690] New: [10/11 Regression] ICE in write_type since r10-6087 jakub at gcc dot gnu.org
2020-08-18 20:12 ` [Bug c++/96690] " jakub at gcc dot gnu.org
@ 2020-08-18 20:13 ` jakub at gcc dot gnu.org
2020-08-18 20:14 ` mpolacek at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-08-18 20:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96690
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Maybe related to or same as PR93028, but that one is missing a test, so hard to
say.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/96690] [10/11 Regression] ICE in write_type since r10-6087
2020-08-18 20:03 [Bug c++/96690] New: [10/11 Regression] ICE in write_type since r10-6087 jakub at gcc dot gnu.org
2020-08-18 20:12 ` [Bug c++/96690] " jakub at gcc dot gnu.org
2020-08-18 20:13 ` jakub at gcc dot gnu.org
@ 2020-08-18 20:14 ` mpolacek at gcc dot gnu.org
2020-08-24 11:34 ` [Bug debug/96690] " rguenth at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-08-18 20:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96690
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |itchka at compuserve dot com
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
*** Bug 93028 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug debug/96690] [10/11 Regression] ICE in write_type since r10-6087
2020-08-18 20:03 [Bug c++/96690] New: [10/11 Regression] ICE in write_type since r10-6087 jakub at gcc dot gnu.org
` (2 preceding siblings ...)
2020-08-18 20:14 ` mpolacek at gcc dot gnu.org
@ 2020-08-24 11:34 ` rguenth at gcc dot gnu.org
2020-08-24 11:51 ` rguenth at gcc dot gnu.org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-08-24 11:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96690
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c++ |debug
Keywords| |ice-on-valid-code
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Hmm, but we're pushing TYPE_MAIN_VARIANT (). The issue seems to be that
we're mangling 'foo' via rtl_for_decl_init () which is the init of
a template value, &foo, that is only required from debug and FLD does not
walk those template trees we eventually generate this debug from.
That said, we're expecting to have mangled everything we have to eventually
mangle at the time FLD runs but here we're mangling things after the fact.
IMHO the template paramter DIE should have a more symbolic representation
and not use relocations to say 'foo'. Trying to bypass rtl_for_decl_init
via
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 9deca031fc2..4d652e594ad 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -19764,6 +19793,9 @@ reference_to_unused (tree * tp, int * walk_subtrees,
if (!node || !node->definition)
return *tp;
}
+ else if (TREE_CODE (*tp) == FUNCTION_DECL
+ && !DECL_ASSEMBLER_NAME_SET_P (*tp))
+ return *tp;
else if (TREE_CODE (*tp) == FUNCTION_DECL
&& (!DECL_EXTERNAL (*tp) || DECL_DECLARED_INLINE_P (*tp)))
{
turns this into the very same issue via
0xfe0d36 cst_pool_loc_descr
../../src/gcc/gcc/dwarf2out.c:17485
0xfe21e9 loc_list_from_tree_1
../../src/gcc/gcc/dwarf2out.c:18305
0xfe4823 loc_list_from_tree
../../src/gcc/gcc/dwarf2out.c:19042
0xfe4881 loc_descriptor_from_tree
../../src/gcc/gcc/dwarf2out.c:19055
0xffb29d gen_remaining_tmpl_value_param_die_attribute
../../src/gcc/gcc/dwarf2out.c:27168
where loc_list_from_tree_1 doesn't seem to have the same "protection"
against referencing unused symbols as rtl_for_decl_init has.
Note without -flto we do not appear to output a DIE refering to 'foo'.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug debug/96690] [10/11 Regression] ICE in write_type since r10-6087
2020-08-18 20:03 [Bug c++/96690] New: [10/11 Regression] ICE in write_type since r10-6087 jakub at gcc dot gnu.org
` (3 preceding siblings ...)
2020-08-24 11:34 ` [Bug debug/96690] " rguenth at gcc dot gnu.org
@ 2020-08-24 11:51 ` rguenth at gcc dot gnu.org
2020-08-24 11:58 ` jakub at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-08-24 11:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96690
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Forcing the mangling via generating garbage RTL early doesn't work since
the
/* ??? The C++ FE emits debug information for using decls, so
putting gcc_unreachable here falls over. See PR31899. For now
be conservative. */
else if (!symtab->global_info_ready && VAR_OR_FUNCTION_DECL_P (*tp))
return *tp;
check in reference_to_unused triggers during the early debug pass over
template params and thus no RTL is generated from there. But the late
pass looks phishy:
else if (TREE_CODE (*tp) == FUNCTION_DECL
&& (!DECL_EXTERNAL (*tp) || DECL_DECLARED_INLINE_P (*tp)))
{
/* The call graph machinery must have finished analyzing,
optimizing and gimplifying the CU by now.
So if *TP has no call graph node associated
to it, it means *TP will not be emitted. */
if (!cgraph_node::get (*tp))
return *tp;
but 'foo' is DECL_EXTERNAL and TREE_PUBLIC. The following works on this
testcase though:
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 9deca031fc2..29e011a296d 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -19756,7 +19785,7 @@ reference_to_unused (tree * tp, int * walk_subtrees,
/* ??? The C++ FE emits debug information for using decls, so
putting gcc_unreachable here falls over. See PR31899. For now
be conservative. */
- else if (!symtab->global_info_ready && VAR_OR_FUNCTION_DECL_P (*tp))
+ else if (!symtab->global_info_ready && VAR_P (*tp))
return *tp;
else if (VAR_P (*tp))
{
@@ -19771,7 +19800,7 @@ reference_to_unused (tree * tp, int * walk_subtrees,
optimizing and gimplifying the CU by now.
So if *TP has no call graph node associated
to it, it means *TP will not be emitted. */
- if (!cgraph_node::get (*tp))
+ if (!symtab->global_info_ready || !cgraph_node::get (*tp))
return *tp;
}
else if (TREE_CODE (*tp) == STRING_CST && !TREE_ASM_WRITTEN (*tp))
@@ -20295,12 +20324,11 @@ tree_add_const_value_attribute (dw_die_ref die, tree
t)
return true;
}
}
- if (! early_dwarf)
- {
- rtl = rtl_for_decl_init (init, type);
- if (rtl)
- return add_const_value_attribute (die, rtl);
- }
+ /* Generate the RTL even if early_dwarf to force mangling of all refered to
+ symbols. */
+ rtl = rtl_for_decl_init (init, type);
+ if (rtl && !early_dwarf)
+ return add_const_value_attribute (die, rtl);
/* If the host and target are sane, try harder. */
if (CHAR_BIT == 8 && BITS_PER_UNIT == 8
&& initializer_constant_valid_p (init, type))
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug debug/96690] [10/11 Regression] ICE in write_type since r10-6087
2020-08-18 20:03 [Bug c++/96690] New: [10/11 Regression] ICE in write_type since r10-6087 jakub at gcc dot gnu.org
` (4 preceding siblings ...)
2020-08-24 11:51 ` rguenth at gcc dot gnu.org
@ 2020-08-24 11:58 ` jakub at gcc dot gnu.org
2020-08-24 12:20 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-08-24 11:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96690
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Without LTO, gen_remaining_tmpl_value_param_die_attribute will try to get it,
and will mangle the foo decl, but shortly after will throw it away due to
const_ok_for_output failing on it.
Your patch makes sense to me.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug debug/96690] [10/11 Regression] ICE in write_type since r10-6087
2020-08-18 20:03 [Bug c++/96690] New: [10/11 Regression] ICE in write_type since r10-6087 jakub at gcc dot gnu.org
` (5 preceding siblings ...)
2020-08-24 11:58 ` jakub at gcc dot gnu.org
@ 2020-08-24 12:20 ` rguenth at gcc dot gnu.org
2020-08-25 7:06 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-08-24 12:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96690
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Testing the patch.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug debug/96690] [10/11 Regression] ICE in write_type since r10-6087
2020-08-18 20:03 [Bug c++/96690] New: [10/11 Regression] ICE in write_type since r10-6087 jakub at gcc dot gnu.org
` (6 preceding siblings ...)
2020-08-24 12:20 ` rguenth at gcc dot gnu.org
@ 2020-08-25 7:06 ` cvs-commit at gcc dot gnu.org
2020-08-25 7:06 ` [Bug debug/96690] [10 " rguenth at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-08-25 7:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96690
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:7fe2cec41bb2ccb499b6b6c513e00da1a270370f
commit r11-2834-g7fe2cec41bb2ccb499b6b6c513e00da1a270370f
Author: Richard Biener <rguenther@suse.de>
Date: Mon Aug 24 14:12:01 2020 +0200
debug/96690 - mangle symbols eventually used by late dwarf output
The following makes sure to, at early debug generation time, mangle
symbols we eventually end up outputting during late finish.
2020-08-24 Richard Biener <rguenther@suse.de>
PR debug/96690
* dwarf2out.c (reference_to_unused): Make FUNCTION_DECL
processing more consistent with respect to
symtab->global_info_ready.
(tree_add_const_value_attribute): Unconditionally call
rtl_for_decl_init to do all mangling early but throw
away the result if early_dwarf.
* g++.dg/lto/pr96690_0.C: New testcase.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug debug/96690] [10 Regression] ICE in write_type since r10-6087
2020-08-18 20:03 [Bug c++/96690] New: [10/11 Regression] ICE in write_type since r10-6087 jakub at gcc dot gnu.org
` (7 preceding siblings ...)
2020-08-25 7:06 ` cvs-commit at gcc dot gnu.org
@ 2020-08-25 7:06 ` rguenth at gcc dot gnu.org
2020-09-15 8:23 ` cvs-commit at gcc dot gnu.org
2020-09-15 8:24 ` rguenth at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-08-25 7:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96690
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |11.0
Priority|P3 |P2
Summary|[10/11 Regression] ICE in |[10 Regression] ICE in
|write_type since r10-6087 |write_type since r10-6087
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug debug/96690] [10 Regression] ICE in write_type since r10-6087
2020-08-18 20:03 [Bug c++/96690] New: [10/11 Regression] ICE in write_type since r10-6087 jakub at gcc dot gnu.org
` (8 preceding siblings ...)
2020-08-25 7:06 ` [Bug debug/96690] [10 " rguenth at gcc dot gnu.org
@ 2020-09-15 8:23 ` cvs-commit at gcc dot gnu.org
2020-09-15 8:24 ` rguenth at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-15 8:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96690
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:bfe7bfbd068ee752f9d264473f974883ec6a21e6
commit r10-8764-gbfe7bfbd068ee752f9d264473f974883ec6a21e6
Author: Richard Biener <rguenther@suse.de>
Date: Mon Aug 24 14:12:01 2020 +0200
debug/96690 - mangle symbols eventually used by late dwarf output
The following makes sure to, at early debug generation time, mangle
symbols we eventually end up outputting during late finish.
2020-08-24 Richard Biener <rguenther@suse.de>
PR debug/96690
* dwarf2out.c (reference_to_unused): Make FUNCTION_DECL
processing more consistent with respect to
symtab->global_info_ready.
(tree_add_const_value_attribute): Unconditionally call
rtl_for_decl_init to do all mangling early but throw
away the result if early_dwarf.
* g++.dg/lto/pr96690_0.C: New testcase.
(cherry picked from commit 7fe2cec41bb2ccb499b6b6c513e00da1a270370f)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug debug/96690] [10 Regression] ICE in write_type since r10-6087
2020-08-18 20:03 [Bug c++/96690] New: [10/11 Regression] ICE in write_type since r10-6087 jakub at gcc dot gnu.org
` (9 preceding siblings ...)
2020-09-15 8:23 ` cvs-commit at gcc dot gnu.org
@ 2020-09-15 8:24 ` rguenth at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-09-15 8:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96690
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
Known to work| |10.2.1
Known to fail| |10.2.0
--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 12+ messages in thread