public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108474] New: static structured binding undefined reference
@ 2023-01-20 0:09 pinskia at gcc dot gnu.org
2023-01-20 0:23 ` [Bug c++/108474] " pinskia at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-20 0:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108474
Bug ID: 108474
Summary: static structured binding undefined reference
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Keywords: link-failure, wrong-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Take this c++20 (-std=c++20):
```
struct t
{
int i, j;
};
t y;
static auto [i, j] = y;
int &r = i;
int s = i;
int *t = &i;
int main() {}
```
This fails in a similar way as PR 53932 but this is for structued bindings
rather than static anonymous unions.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/108474] static structured binding undefined reference
2023-01-20 0:09 [Bug c++/108474] New: static structured binding undefined reference pinskia at gcc dot gnu.org
@ 2023-01-20 0:23 ` pinskia at gcc dot gnu.org
2023-01-20 10:06 ` jakub at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-20 0:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108474
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-valid-code
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
And yes it ICEs with LTO too.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/108474] static structured binding undefined reference
2023-01-20 0:09 [Bug c++/108474] New: static structured binding undefined reference pinskia at gcc dot gnu.org
2023-01-20 0:23 ` [Bug c++/108474] " pinskia at gcc dot gnu.org
@ 2023-01-20 10:06 ` jakub at gcc dot gnu.org
2023-01-24 10:32 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-20 10:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108474
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2023-01-20
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
CC| |jakub at gcc dot gnu.org
Status|UNCONFIRMED |ASSIGNED
Ever confirmed|0 |1
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 54315
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54315&action=edit
gcc13-pr108474.patch
Untested fix.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/108474] static structured binding undefined reference
2023-01-20 0:09 [Bug c++/108474] New: static structured binding undefined reference pinskia at gcc dot gnu.org
2023-01-20 0:23 ` [Bug c++/108474] " pinskia at gcc dot gnu.org
2023-01-20 10:06 ` jakub at gcc dot gnu.org
@ 2023-01-24 10:32 ` cvs-commit at gcc dot gnu.org
2023-02-10 17:47 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-24 10:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108474
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:b84e21115700523b4d0ac44275443f7b9c670344
commit r13-5323-gb84e21115700523b4d0ac44275443f7b9c670344
Author: Jakub Jelinek <jakub@redhat.com>
Date: Tue Jan 24 11:28:00 2023 +0100
c++: Handle structured bindings like anon unions in initializers [PR108474]
As reported by Andrew Pinski, structured bindings (with the exception
of the ones using std::tuple_{size,element} and get which are really
standalone variables in addition to the binding one) also use
DECL_VALUE_EXPR and needs the same treatment in static initializers.
On Sun, Jan 22, 2023 at 07:19:07PM -0500, Jason Merrill wrote:
> Though, actually, why not instead fix expand_expr_real_1 (and staticp) to
> look through DECL_VALUE_EXPR?
Doing it when emitting the initializers seems to be too late to me,
we in various spots try to put parts of the static var DECL_INITIAL
expressions
into the IL, or e.g. for varpool purposes remember which vars are
referenced
there.
This patch moves it to record_reference, which is called from
varpool_node::analyze
and so about the same time as gimplification of the bodies which also
replaces DECL_VALUE_EXPRs.
2023-01-24 Jakub Jelinek <jakub@redhat.com>
PR c++/108474
* cgraphbuild.cc: Include gimplify.h.
(record_reference): Replace VAR_DECLs with DECL_HAS_VALUE_EXPR_P
with
their corresponding DECL_VALUE_EXPR expressions after unsharing.
* cp-gimplify.cc (cp_fold_r): Revert 2023-01-19 changes.
* g++.dg/cpp1z/decomp57.C: New test.
* g++.dg/cpp1z/decomp58.C: New test.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/108474] static structured binding undefined reference
2023-01-20 0:09 [Bug c++/108474] New: static structured binding undefined reference pinskia at gcc dot gnu.org
` (2 preceding siblings ...)
2023-01-24 10:32 ` cvs-commit at gcc dot gnu.org
@ 2023-02-10 17:47 ` cvs-commit at gcc dot gnu.org
2023-05-02 20:14 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-10 17:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108474
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:c153fb6a5bda225fcfb34e17994a31b65616a6db
commit r12-9159-gc153fb6a5bda225fcfb34e17994a31b65616a6db
Author: Jakub Jelinek <jakub@redhat.com>
Date: Tue Jan 24 11:28:00 2023 +0100
c++: Handle structured bindings like anon unions in initializers [PR108474]
As reported by Andrew Pinski, structured bindings (with the exception
of the ones using std::tuple_{size,element} and get which are really
standalone variables in addition to the binding one) also use
DECL_VALUE_EXPR and needs the same treatment in static initializers.
On Sun, Jan 22, 2023 at 07:19:07PM -0500, Jason Merrill wrote:
> Though, actually, why not instead fix expand_expr_real_1 (and staticp) to
> look through DECL_VALUE_EXPR?
Doing it when emitting the initializers seems to be too late to me,
we in various spots try to put parts of the static var DECL_INITIAL
expressions
into the IL, or e.g. for varpool purposes remember which vars are
referenced
there.
This patch moves it to record_reference, which is called from
varpool_node::analyze
and so about the same time as gimplification of the bodies which also
replaces DECL_VALUE_EXPRs.
2023-01-24 Jakub Jelinek <jakub@redhat.com>
PR c++/108474
* cp-gimplify.cc (cp_fold_r): Handle structured bindings
vars like anon union artificial vars.
* g++.dg/cpp1z/decomp57.C: New test.
* g++.dg/cpp1z/decomp58.C: New test.
(cherry picked from commit b84e21115700523b4d0ac44275443f7b9c670344)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/108474] static structured binding undefined reference
2023-01-20 0:09 [Bug c++/108474] New: static structured binding undefined reference pinskia at gcc dot gnu.org
` (3 preceding siblings ...)
2023-02-10 17:47 ` cvs-commit at gcc dot gnu.org
@ 2023-05-02 20:14 ` cvs-commit at gcc dot gnu.org
2023-05-03 15:21 ` cvs-commit at gcc dot gnu.org
2023-05-04 7:23 ` jakub at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-02 20:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108474
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:bc75dd303c8f8aa6191670ce3725d26e8011f5ac
commit r11-10712-gbc75dd303c8f8aa6191670ce3725d26e8011f5ac
Author: Jakub Jelinek <jakub@redhat.com>
Date: Tue Jan 24 11:28:00 2023 +0100
c++: Handle structured bindings like anon unions in initializers [PR108474]
As reported by Andrew Pinski, structured bindings (with the exception
of the ones using std::tuple_{size,element} and get which are really
standalone variables in addition to the binding one) also use
DECL_VALUE_EXPR and needs the same treatment in static initializers.
On Sun, Jan 22, 2023 at 07:19:07PM -0500, Jason Merrill wrote:
> Though, actually, why not instead fix expand_expr_real_1 (and staticp) to
> look through DECL_VALUE_EXPR?
Doing it when emitting the initializers seems to be too late to me,
we in various spots try to put parts of the static var DECL_INITIAL
expressions
into the IL, or e.g. for varpool purposes remember which vars are
referenced
there.
This patch moves it to record_reference, which is called from
varpool_node::analyze
and so about the same time as gimplification of the bodies which also
replaces DECL_VALUE_EXPRs.
2023-01-24 Jakub Jelinek <jakub@redhat.com>
PR c++/108474
* cp-gimplify.c (cp_fold_r): Handle structured bindings
vars like anon union artificial vars.
* g++.dg/cpp1z/decomp57.C: New test.
* g++.dg/cpp1z/decomp58.C: New test.
(cherry picked from commit b84e21115700523b4d0ac44275443f7b9c670344)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/108474] static structured binding undefined reference
2023-01-20 0:09 [Bug c++/108474] New: static structured binding undefined reference pinskia at gcc dot gnu.org
` (4 preceding siblings ...)
2023-05-02 20:14 ` cvs-commit at gcc dot gnu.org
@ 2023-05-03 15:21 ` cvs-commit at gcc dot gnu.org
2023-05-04 7:23 ` jakub at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-03 15:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108474
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:8776316329f34ba87cca64622e93c05ff36890bb
commit r10-11366-g8776316329f34ba87cca64622e93c05ff36890bb
Author: Jakub Jelinek <jakub@redhat.com>
Date: Tue Jan 24 11:28:00 2023 +0100
c++: Handle structured bindings like anon unions in initializers [PR108474]
As reported by Andrew Pinski, structured bindings (with the exception
of the ones using std::tuple_{size,element} and get which are really
standalone variables in addition to the binding one) also use
DECL_VALUE_EXPR and needs the same treatment in static initializers.
On Sun, Jan 22, 2023 at 07:19:07PM -0500, Jason Merrill wrote:
> Though, actually, why not instead fix expand_expr_real_1 (and staticp) to
> look through DECL_VALUE_EXPR?
Doing it when emitting the initializers seems to be too late to me,
we in various spots try to put parts of the static var DECL_INITIAL
expressions
into the IL, or e.g. for varpool purposes remember which vars are
referenced
there.
This patch moves it to record_reference, which is called from
varpool_node::analyze
and so about the same time as gimplification of the bodies which also
replaces DECL_VALUE_EXPRs.
2023-01-24 Jakub Jelinek <jakub@redhat.com>
PR c++/108474
* cp-gimplify.c (cp_fold_r): Handle structured bindings
vars like anon union artificial vars.
* g++.dg/cpp1z/decomp57.C: New test.
* g++.dg/cpp1z/decomp58.C: New test.
(cherry picked from commit b84e21115700523b4d0ac44275443f7b9c670344)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/108474] static structured binding undefined reference
2023-01-20 0:09 [Bug c++/108474] New: static structured binding undefined reference pinskia at gcc dot gnu.org
` (5 preceding siblings ...)
2023-05-03 15:21 ` cvs-commit at gcc dot gnu.org
@ 2023-05-04 7:23 ` jakub at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-05-04 7:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108474
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 10.5 too.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-05-04 7:23 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-20 0:09 [Bug c++/108474] New: static structured binding undefined reference pinskia at gcc dot gnu.org
2023-01-20 0:23 ` [Bug c++/108474] " pinskia at gcc dot gnu.org
2023-01-20 10:06 ` jakub at gcc dot gnu.org
2023-01-24 10:32 ` cvs-commit at gcc dot gnu.org
2023-02-10 17:47 ` cvs-commit at gcc dot gnu.org
2023-05-02 20:14 ` cvs-commit at gcc dot gnu.org
2023-05-03 15:21 ` cvs-commit at gcc dot gnu.org
2023-05-04 7:23 ` jakub 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).