public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94147] New: mangling of lambdas in initializers is wrong
@ 2020-03-11 16:33 nathan at gcc dot gnu.org
2020-03-11 16:33 ` [Bug c++/94147] " nathan at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: nathan at gcc dot gnu.org @ 2020-03-11 16:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94147
Bug ID: 94147
Summary: mangling of lambdas in initializers is wrong
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: nathan at gcc dot gnu.org
Target Milestone: ---
inline auto var = [] (int) {};
should mangle the lambda as _ZN3varMUlE_clEv
likewise for static member variables
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/94147] mangling of lambdas in initializers is wrong
2020-03-11 16:33 [Bug c++/94147] New: mangling of lambdas in initializers is wrong nathan at gcc dot gnu.org
@ 2020-03-11 16:33 ` nathan at gcc dot gnu.org
2020-03-18 12:17 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: nathan at gcc dot gnu.org @ 2020-03-11 16:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94147
Nathan Sidwell <nathan at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |nathan at gcc dot gnu.org
Ever confirmed|0 |1
Last reconfirmed| |2020-03-11
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/94147] mangling of lambdas in initializers is wrong
2020-03-11 16:33 [Bug c++/94147] New: mangling of lambdas in initializers is wrong nathan at gcc dot gnu.org
2020-03-11 16:33 ` [Bug c++/94147] " nathan at gcc dot gnu.org
@ 2020-03-18 12:17 ` cvs-commit at gcc dot gnu.org
2020-03-18 12:17 ` nathan at gcc dot gnu.org
2022-11-28 22:29 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-03-18 12:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94147
--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nathan Sidwell <nathan@gcc.gnu.org>:
https://gcc.gnu.org/g:11cf25c40e3f586d19474108c78a2dfad7925902
commit r10-7243-g11cf25c40e3f586d19474108c78a2dfad7925902
Author: Nathan Sidwell <nathan@acm.org>
Date: Wed Mar 18 05:16:28 2020 -0700
PR c++/94147 - mangling of lambdas assigned to globals
This patch implements Jason's suggestion of pushing a lambda scope
when parsing a global variable initializer. That bit worked fine, but
happened to cause g++.dg/opt/dump1.C to not give any
used-but-not-defined warnings.
The reason was no_linkage_check, which considers any lambda that has
an extra-scope to have linkage. Which is technically correct. Except
that we think that all types that have linkage have external linkage.
Our representation of linkage and visibility is somewhat inaccurate,
particularly when it comes to types. We have TREE_PUBLIC,
DECL_EXTERNAL, DECL_VISIBILITY, DECL_COMDAT, DECL_NOT_REALLY_EXTERN.
It could really do with a through cleanup, but that won't be a simple
task.
The best I could come up with was seeing if the extra scope was a
VAR_DECL, and if that was TREE_PUBLIC and the var was inline (its
COMDATness is sadly not set at that point) or a template
instantiation, then the lambda had linkage. Otherwise it's as-if it
has no-linkage from the POV of compiler internals.
This is an ABI change (so we should document it), but it's changing
mangling from an unpredictable (in practice) counter, to something the
ABI defines. So I'm not concerned about mangling-changed warnings, or
preserving the broken mangling under some ABI selection flag. Code
that did this worked by accident within a single TU. It'll continue
to work by design there, and across TUs.
* parser.c (cp_parser_init_declarator): Namespace-scope variables
provide a lambda scope.
* tree.c (no_linkage_check): Lambdas with a variable for extra
scope have a linkage from the variable.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/94147] mangling of lambdas in initializers is wrong
2020-03-11 16:33 [Bug c++/94147] New: mangling of lambdas in initializers is wrong nathan at gcc dot gnu.org
2020-03-11 16:33 ` [Bug c++/94147] " nathan at gcc dot gnu.org
2020-03-18 12:17 ` cvs-commit at gcc dot gnu.org
@ 2020-03-18 12:17 ` nathan at gcc dot gnu.org
2022-11-28 22:29 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: nathan at gcc dot gnu.org @ 2020-03-18 12:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94147
Nathan Sidwell <nathan at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #2 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
Fixed 11cf25c40e3f586d19474108c78a2dfad7925902
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/94147] mangling of lambdas in initializers is wrong
2020-03-11 16:33 [Bug c++/94147] New: mangling of lambdas in initializers is wrong nathan at gcc dot gnu.org
` (2 preceding siblings ...)
2020-03-18 12:17 ` nathan at gcc dot gnu.org
@ 2022-11-28 22:29 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-28 22:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94147
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |10.0
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-11-28 22:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-11 16:33 [Bug c++/94147] New: mangling of lambdas in initializers is wrong nathan at gcc dot gnu.org
2020-03-11 16:33 ` [Bug c++/94147] " nathan at gcc dot gnu.org
2020-03-18 12:17 ` cvs-commit at gcc dot gnu.org
2020-03-18 12:17 ` nathan at gcc dot gnu.org
2022-11-28 22:29 ` pinskia at gcc dot gnu.org
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).