public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/93711] ICE: [[no_unique_address] when constructing via template helper
[not found] <bug-93711-4@http.gcc.gnu.org/bugzilla/>
@ 2020-06-17 16:55 ` leni536 at gmail dot com
2020-06-17 23:37 ` [Bug c++/93711] [9/10/11 Regression] " mpolacek at gcc dot gnu.org
` (13 subsequent siblings)
14 siblings, 0 replies; 15+ messages in thread
From: leni536 at gmail dot com @ 2020-06-17 16:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93711
Lénárd Szolnoki <leni536 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |leni536 at gmail dot com
--- Comment #3 from Lénárd Szolnoki <leni536 at gmail dot com> ---
A smaller example:
struct S {
S(S&&) = delete;
};
S foo();
struct A {
[[no_unique_address]] S s = foo();
};
A a{};
Version:
11.0.0 20200616
Command line options:
-std=c++20 -Wall -Wextra -pedantic
Diagnostics:
during RTL pass: expand
<source>: In function 'void __static_initialization_and_destruction_0(int,
int)':
<source>:11:5: internal compiler error: in assign_temp, at function.c:984
11 | A a{};
| ^
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/93711] [9/10/11 Regression] ICE: [[no_unique_address] when constructing via template helper
[not found] <bug-93711-4@http.gcc.gnu.org/bugzilla/>
2020-06-17 16:55 ` [Bug c++/93711] ICE: [[no_unique_address] when constructing via template helper leni536 at gmail dot com
@ 2020-06-17 23:37 ` mpolacek at gcc dot gnu.org
2020-06-24 18:45 ` mpolacek at gcc dot gnu.org
` (12 subsequent siblings)
14 siblings, 0 replies; 15+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-06-17 23:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93711
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|ICE: [[no_unique_address] |[9/10/11 Regression] ICE:
|when constructing via |[[no_unique_address] when
|template helper |constructing via template
| |helper
CC| |mpolacek at gcc dot gnu.org
Last reconfirmed| |2020-06-17
Status|UNCONFIRMED |NEW
Target Milestone|--- |9.4
Ever confirmed|0 |1
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Same backtrace as bug 90254 but it didn't start with the same revision. This
one started with r264813.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/93711] [9/10/11 Regression] ICE: [[no_unique_address] when constructing via template helper
[not found] <bug-93711-4@http.gcc.gnu.org/bugzilla/>
2020-06-17 16:55 ` [Bug c++/93711] ICE: [[no_unique_address] when constructing via template helper leni536 at gmail dot com
2020-06-17 23:37 ` [Bug c++/93711] [9/10/11 Regression] " mpolacek at gcc dot gnu.org
@ 2020-06-24 18:45 ` mpolacek at gcc dot gnu.org
2020-06-24 18:45 ` mpolacek at gcc dot gnu.org
` (11 subsequent siblings)
14 siblings, 0 replies; 15+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-06-24 18:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93711
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |boris.staletic at gmail dot com
--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
*** Bug 95878 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/93711] [9/10/11 Regression] ICE: [[no_unique_address] when constructing via template helper
[not found] <bug-93711-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2020-06-24 18:45 ` mpolacek at gcc dot gnu.org
@ 2020-06-24 18:45 ` mpolacek at gcc dot gnu.org
2020-07-01 15:45 ` boris.staletic at gmail dot com
` (10 subsequent siblings)
14 siblings, 0 replies; 15+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-06-24 18:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93711
--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Another test:
struct istream_iterator {
istream_iterator() {}
istream_iterator(const istream_iterator&) {}
};
istream_iterator next(istream_iterator&& bound) {
return static_cast<istream_iterator>(bound);
}
struct copy_result {
[[no_unique_address]] istream_iterator in;
};
int main() {
copy_result result{next(istream_iterator{})};
}
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/93711] [9/10/11 Regression] ICE: [[no_unique_address] when constructing via template helper
[not found] <bug-93711-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2020-06-24 18:45 ` mpolacek at gcc dot gnu.org
@ 2020-07-01 15:45 ` boris.staletic at gmail dot com
2020-08-07 16:01 ` redi at gcc dot gnu.org
` (9 subsequent siblings)
14 siblings, 0 replies; 15+ messages in thread
From: boris.staletic at gmail dot com @ 2020-07-01 15:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93711
--- Comment #7 from Boris Staletic <boris.staletic at gmail dot com> ---
I don't know if this is the same problem, since the actual
`std::istream_iterator<int>` isn't empty, unlike in the other test cases. If
the following is a different problem, sorry up front for the noise.
https://godbolt.org/z/XAM9o7
This is the actual thing I've come across during a pull request for NanoRange
library.
DIfferences from the above test cases:
- ICE is there even at `-Og`, as well as `-O0`
- The bottom example shows that wrapping the call to `fn()` in `std::move()`
avoids the ICE.
If this is a separate issue and thus noise, I'll open a separate issue.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/93711] [9/10/11 Regression] ICE: [[no_unique_address] when constructing via template helper
[not found] <bug-93711-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2020-07-01 15:45 ` boris.staletic at gmail dot com
@ 2020-08-07 16:01 ` redi at gcc dot gnu.org
2020-08-07 16:04 ` redi at gcc dot gnu.org
` (8 subsequent siblings)
14 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2020-08-07 16:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93711
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hewillk at gmail dot com
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 96408 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/93711] [9/10/11 Regression] ICE: [[no_unique_address] when constructing via template helper
[not found] <bug-93711-4@http.gcc.gnu.org/bugzilla/>
` (5 preceding siblings ...)
2020-08-07 16:01 ` redi at gcc dot gnu.org
@ 2020-08-07 16:04 ` redi at gcc dot gnu.org
2020-08-11 21:57 ` jason at gcc dot gnu.org
` (7 subsequent siblings)
14 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2020-08-07 16:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93711
--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Another one:
struct A { A(const A&) = delete; };
A f();
struct C
{
[[no_unique_address]] A a;
};
C c{f()};
during RTL pass: expand
ice.C: In function 'void __static_initialization_and_destruction_0(int, int)':
ice.C:10:8: internal compiler error: in assign_temp, at function.c:984
10 | C c{f()};
| ^
0x6f9772 assign_temp(tree_node*, int, int)
/home/jwakely/src/gcc/gcc/gcc/function.c:984
0xb56653 expand_call(tree_node*, rtx_def*, int)
/home/jwakely/src/gcc/gcc/gcc/calls.c:3750
0xc87aaa expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
/home/jwakely/src/gcc/gcc/gcc/expr.c:11240
0xc9a133 expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier,
rtx_def**, bool)
/home/jwakely/src/gcc/gcc/gcc/expr.c:8474
0xc9a133 expand_normal
/home/jwakely/src/gcc/gcc/gcc/expr.h:288
0xc9a133 store_field
/home/jwakely/src/gcc/gcc/gcc/expr.c:7213
0xc966d6 expand_assignment(tree_node*, tree_node*, bool)
/home/jwakely/src/gcc/gcc/gcc/expr.c:5448
0xb66553 expand_call_stmt
/home/jwakely/src/gcc/gcc/gcc/cfgexpand.c:2701
0xb66553 expand_gimple_stmt_1
/home/jwakely/src/gcc/gcc/gcc/cfgexpand.c:3682
0xb66553 expand_gimple_stmt
/home/jwakely/src/gcc/gcc/gcc/cfgexpand.c:3847
0xb6bd9a expand_gimple_basic_block
/home/jwakely/src/gcc/gcc/gcc/cfgexpand.c:5888
0xb6d846 execute
/home/jwakely/src/gcc/gcc/gcc/cfgexpand.c:6572
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/93711] [9/10/11 Regression] ICE: [[no_unique_address] when constructing via template helper
[not found] <bug-93711-4@http.gcc.gnu.org/bugzilla/>
` (6 preceding siblings ...)
2020-08-07 16:04 ` redi at gcc dot gnu.org
@ 2020-08-11 21:57 ` jason at gcc dot gnu.org
2020-08-14 16:58 ` cvs-commit at gcc dot gnu.org
` (6 subsequent siblings)
14 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu.org @ 2020-08-11 21:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93711
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
Status|NEW |ASSIGNED
CC| |jason at gcc dot gnu.org
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/93711] [9/10/11 Regression] ICE: [[no_unique_address] when constructing via template helper
[not found] <bug-93711-4@http.gcc.gnu.org/bugzilla/>
` (7 preceding siblings ...)
2020-08-11 21:57 ` jason at gcc dot gnu.org
@ 2020-08-14 16:58 ` cvs-commit at gcc dot gnu.org
2020-08-14 17:06 ` [Bug c++/93711] [9/10 " jason at gcc dot gnu.org
` (5 subsequent siblings)
14 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-08-14 16:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93711
--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
https://gcc.gnu.org/g:320054784250e572cb75d6f69ab44b2330d61d8b
commit r11-2704-g320054784250e572cb75d6f69ab44b2330d61d8b
Author: Jason Merrill <jason@redhat.com>
Date: Wed Aug 12 05:45:02 2020 -0400
c++: Copy elision and [[no_unique_address]]. [PR93711]
We don't elide a copy from a function returning a class by value into a
base
because that can overwrite data laid out in the tail padding of the base
class; we need to handle [[no_unique_address]] fields the same way, or we
ICE when the middle-end wants to create a temporary object of a
TYPE_NEEDS_CONSTRUCTING type.
This means that we can't always express initialization of a field with
INIT_EXPR from a TARGET_EXPR the way we usually do, so I needed
to change several places that were assuming that was sufficient.
This also fixes 90254, the same problem with C++17 aggregate initialization
of a base.
gcc/cp/ChangeLog:
PR c++/90254
PR c++/93711
* cp-tree.h (unsafe_return_slot_p): Declare.
* call.c (is_base_field_ref): Rename to unsafe_return_slot_p.
(build_over_call): Check unsafe_return_slot_p.
(build_special_member_call): Likewise.
* init.c (expand_default_init): Likewise.
* typeck2.c (split_nonconstant_init_1): Likewise.
gcc/testsuite/ChangeLog:
PR c++/90254
PR c++/93711
* g++.dg/cpp1z/aggr-base10.C: New test.
* g++.dg/cpp2a/no_unique_address7.C: New test.
* g++.dg/cpp2a/no_unique_address7a.C: New test.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/93711] [9/10 Regression] ICE: [[no_unique_address] when constructing via template helper
[not found] <bug-93711-4@http.gcc.gnu.org/bugzilla/>
` (8 preceding siblings ...)
2020-08-14 16:58 ` cvs-commit at gcc dot gnu.org
@ 2020-08-14 17:06 ` jason at gcc dot gnu.org
2020-12-23 22:11 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
14 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu.org @ 2020-08-14 17:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93711
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[9/10/11 Regression] ICE: |[9/10 Regression] ICE:
|[[no_unique_address] when |[[no_unique_address] when
|constructing via template |constructing via template
|helper |helper
--- Comment #11 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for GCC 11 so far.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/93711] [9/10 Regression] ICE: [[no_unique_address] when constructing via template helper
[not found] <bug-93711-4@http.gcc.gnu.org/bugzilla/>
` (9 preceding siblings ...)
2020-08-14 17:06 ` [Bug c++/93711] [9/10 " jason at gcc dot gnu.org
@ 2020-12-23 22:11 ` cvs-commit at gcc dot gnu.org
2021-03-29 11:19 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
14 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-12-23 22:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93711
--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:
https://gcc.gnu.org/g:97014e4ada448aa8978b3cd14ed95e0e56f375d9
commit r10-9168-g97014e4ada448aa8978b3cd14ed95e0e56f375d9
Author: Jason Merrill <jason@redhat.com>
Date: Wed Aug 12 05:45:02 2020 -0400
c++: Copy elision and [[no_unique_address]]. [PR93711]
We don't elide a copy from a function returning a class by value into a
base
because that can overwrite data laid out in the tail padding of the base
class; we need to handle [[no_unique_address]] fields the same way, or we
ICE when the middle-end wants to create a temporary object of a
TYPE_NEEDS_CONSTRUCTING type.
This means that we can't always express initialization of a field with
INIT_EXPR from a TARGET_EXPR the way we usually do, so I needed
to change several places that were assuming that was sufficient.
This also fixes 90254, the same problem with C++17 aggregate initialization
of a base.
gcc/cp/ChangeLog:
PR c++/90254
PR c++/93711
* cp-tree.h (unsafe_return_slot_p): Declare.
* call.c (is_base_field_ref): Rename to unsafe_return_slot_p.
(build_over_call): Check unsafe_return_slot_p.
(build_special_member_call): Likewise.
* init.c (expand_default_init): Likewise.
* typeck2.c (split_nonconstant_init_1): Likewise.
gcc/testsuite/ChangeLog:
PR c++/90254
PR c++/93711
* g++.dg/cpp1z/aggr-base10.C: New test.
* g++.dg/cpp2a/no_unique_address7.C: New test.
* g++.dg/cpp2a/no_unique_address7a.C: New test.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/93711] [9/10 Regression] ICE: [[no_unique_address] when constructing via template helper
[not found] <bug-93711-4@http.gcc.gnu.org/bugzilla/>
` (10 preceding siblings ...)
2020-12-23 22:11 ` cvs-commit at gcc dot gnu.org
@ 2021-03-29 11:19 ` rguenth at gcc dot gnu.org
2021-04-30 8:00 ` [Bug c++/93711] [9 " rguenth at gcc dot gnu.org
` (2 subsequent siblings)
14 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-29 11:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93711
Bug 93711 depends on bug 98642, which changed state.
Bug 98642 Summary: [10 Regression] wrong "use of deleted function" error
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98642
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/93711] [9 Regression] ICE: [[no_unique_address] when constructing via template helper
[not found] <bug-93711-4@http.gcc.gnu.org/bugzilla/>
` (11 preceding siblings ...)
2021-03-29 11:19 ` rguenth at gcc dot gnu.org
@ 2021-04-30 8:00 ` rguenth at gcc dot gnu.org
2021-06-01 8:16 ` rguenth at gcc dot gnu.org
2021-12-22 18:29 ` jason at gcc dot gnu.org
14 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-30 8:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93711
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |10.2.0
Known to work| |10.2.1
Priority|P3 |P2
Summary|[9/10 Regression] ICE: |[9 Regression] ICE:
|[[no_unique_address] when |[[no_unique_address] when
|constructing via template |constructing via template
|helper |helper
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/93711] [9 Regression] ICE: [[no_unique_address] when constructing via template helper
[not found] <bug-93711-4@http.gcc.gnu.org/bugzilla/>
` (12 preceding siblings ...)
2021-04-30 8:00 ` [Bug c++/93711] [9 " rguenth at gcc dot gnu.org
@ 2021-06-01 8:16 ` rguenth at gcc dot gnu.org
2021-12-22 18:29 ` jason at gcc dot gnu.org
14 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-01 8:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93711
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|9.4 |9.5
--- Comment #13 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9.4 is being released, retargeting bugs to GCC 9.5.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug c++/93711] [9 Regression] ICE: [[no_unique_address] when constructing via template helper
[not found] <bug-93711-4@http.gcc.gnu.org/bugzilla/>
` (13 preceding siblings ...)
2021-06-01 8:16 ` rguenth at gcc dot gnu.org
@ 2021-12-22 18:29 ` jason at gcc dot gnu.org
14 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu.org @ 2021-12-22 18:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93711
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #14 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed in 10.2 and later.
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2021-12-22 18:29 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-93711-4@http.gcc.gnu.org/bugzilla/>
2020-06-17 16:55 ` [Bug c++/93711] ICE: [[no_unique_address] when constructing via template helper leni536 at gmail dot com
2020-06-17 23:37 ` [Bug c++/93711] [9/10/11 Regression] " mpolacek at gcc dot gnu.org
2020-06-24 18:45 ` mpolacek at gcc dot gnu.org
2020-06-24 18:45 ` mpolacek at gcc dot gnu.org
2020-07-01 15:45 ` boris.staletic at gmail dot com
2020-08-07 16:01 ` redi at gcc dot gnu.org
2020-08-07 16:04 ` redi at gcc dot gnu.org
2020-08-11 21:57 ` jason at gcc dot gnu.org
2020-08-14 16:58 ` cvs-commit at gcc dot gnu.org
2020-08-14 17:06 ` [Bug c++/93711] [9/10 " jason at gcc dot gnu.org
2020-12-23 22:11 ` cvs-commit at gcc dot gnu.org
2021-03-29 11:19 ` rguenth at gcc dot gnu.org
2021-04-30 8:00 ` [Bug c++/93711] [9 " rguenth at gcc dot gnu.org
2021-06-01 8:16 ` rguenth at gcc dot gnu.org
2021-12-22 18:29 ` jason 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).