public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/67746] New: Mangled name is accepted for variables in namespace-scope
@ 2015-09-28 12:40 roger.ferrer at bsc dot es
2015-09-28 12:44 ` [Bug c++/67746] " redi at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: roger.ferrer at bsc dot es @ 2015-09-28 12:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67746
Bug ID: 67746
Summary: Mangled name is accepted for variables in
namespace-scope
Product: gcc
Version: 5.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: roger.ferrer at bsc dot es
Target Milestone: ---
Hi,
this was discovered by accident.
g++ 5.2.0 accepts this
namespace N
{
int x;
}
void f(void)
{
_ZN1N1xE = 1; // somehow this is an alias to N::x at the eyes of the C++FE
}
but rejects other cases that have the same mangling (according to "nm") like
struct N
{
static int x;
};
void f(void)
{
_ZN1N1xE = 1; // rejected
}
The following case is not allowed either, which suggests that the mangled name
is added into some scope after the declarator has been processed.
namespace N
{
int x = _ZN1N1xE; // rejected
}
Next case is accepted, again suggesting that after the init-declarator 'x = 3'
has been consumed, the mangled name is added into some scope.
namespace N
{
int x = 3, y = _ZN1N1xE; // accepted
}
I understand that underscore-prefixed names may belong to the implementation,
but given that other similar cases are rejected, perhaps this one can be
rejected as well.
Kind regards,
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/67746] Mangled name is accepted for variables in namespace-scope
2015-09-28 12:40 [Bug c++/67746] New: Mangled name is accepted for variables in namespace-scope roger.ferrer at bsc dot es
@ 2015-09-28 12:44 ` redi at gcc dot gnu.org
2015-09-28 12:57 ` roger.ferrer at bsc dot es
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2015-09-28 12:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67746
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Your examples are undefined due to the use of reserved names, and the libstdc++
implementation actually relies on this in places, so I think changing it would
break things.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/67746] Mangled name is accepted for variables in namespace-scope
2015-09-28 12:40 [Bug c++/67746] New: Mangled name is accepted for variables in namespace-scope roger.ferrer at bsc dot es
2015-09-28 12:44 ` [Bug c++/67746] " redi at gcc dot gnu.org
@ 2015-09-28 12:57 ` roger.ferrer at bsc dot es
2021-08-13 7:17 ` pinskia at gcc dot gnu.org
2021-08-13 7:20 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: roger.ferrer at bsc dot es @ 2015-09-28 12:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67746
--- Comment #2 from Roger Ferrer Ibanez <roger.ferrer at bsc dot es> ---
(In reply to Jonathan Wakely from comment #1)
> Your examples are undefined due to the use of reserved names, and the
> libstdc++ implementation actually relies on this in places, so I think
> changing it would break things.
Ah ok, I didn't know this was used in the libstdc++.
Thanks,
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/67746] Mangled name is accepted for variables in namespace-scope
2015-09-28 12:40 [Bug c++/67746] New: Mangled name is accepted for variables in namespace-scope roger.ferrer at bsc dot es
2015-09-28 12:44 ` [Bug c++/67746] " redi at gcc dot gnu.org
2015-09-28 12:57 ` roger.ferrer at bsc dot es
@ 2021-08-13 7:17 ` pinskia at gcc dot gnu.org
2021-08-13 7:20 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-13 7:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67746
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |8.0
Known to work| |8.1.0
Keywords| |accepts-invalid
Known to fail| |7.5.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/67746] Mangled name is accepted for variables in namespace-scope
2015-09-28 12:40 [Bug c++/67746] New: Mangled name is accepted for variables in namespace-scope roger.ferrer at bsc dot es
` (2 preceding siblings ...)
2021-08-13 7:17 ` pinskia at gcc dot gnu.org
@ 2021-08-13 7:20 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-13 7:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67746
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
https://gcc.gnu.org/legacy-ml/gcc-patches/2017-10/msg00199.html
Fixed for GCC 8 by r8-3605.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-08-13 7:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-28 12:40 [Bug c++/67746] New: Mangled name is accepted for variables in namespace-scope roger.ferrer at bsc dot es
2015-09-28 12:44 ` [Bug c++/67746] " redi at gcc dot gnu.org
2015-09-28 12:57 ` roger.ferrer at bsc dot es
2021-08-13 7:17 ` pinskia at gcc dot gnu.org
2021-08-13 7:20 ` 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).