public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug d/96157] New: d: No NRVO when returning an array of a non-POD struct
@ 2020-07-10 15:26 ibuclaw at gdcproject dot org
2020-07-10 15:30 ` [Bug d/96157] " ibuclaw at gdcproject dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: ibuclaw at gdcproject dot org @ 2020-07-10 15:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96157
Bug ID: 96157
Summary: d: No NRVO when returning an array of a non-POD struct
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: d
Assignee: ibuclaw at gdcproject dot org
Reporter: ibuclaw at gdcproject dot org
Target Milestone: ---
struct S
{
@disable this(this); // triggers nrvo
int v;
}
__gshared void* p;
S[1000] foo() nothrow
{
typeof(return) d;
p = &d;
return d;
}
extern(C) void main() nothrow
{
auto d = foo();
assert(p == &d);
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug d/96157] d: No NRVO when returning an array of a non-POD struct
2020-07-10 15:26 [Bug d/96157] New: d: No NRVO when returning an array of a non-POD struct ibuclaw at gdcproject dot org
@ 2020-07-10 15:30 ` ibuclaw at gdcproject dot org
2020-08-26 8:04 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: ibuclaw at gdcproject dot org @ 2020-07-10 15:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96157
--- Comment #1 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
If I were to propagate TREE_ADDRESSABLE from S to the static array, then the
assert doesn't trigger.
However, there lots of breakages that occur elsewhere within the front-end, so
a little more extra handling needs to be done.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug d/96157] d: No NRVO when returning an array of a non-POD struct
2020-07-10 15:26 [Bug d/96157] New: d: No NRVO when returning an array of a non-POD struct ibuclaw at gdcproject dot org
2020-07-10 15:30 ` [Bug d/96157] " ibuclaw at gdcproject dot org
@ 2020-08-26 8:04 ` cvs-commit at gcc dot gnu.org
2020-08-26 8:05 ` ibuclaw at gdcproject dot org
2020-08-30 14:24 ` cvs-commit at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-08-26 8:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96157
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain Buclaw <ibuclaw@gcc.gnu.org>:
https://gcc.gnu.org/g:312ad889e99ff9458c01518325775e75ab57f272
commit r11-2863-g312ad889e99ff9458c01518325775e75ab57f272
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date: Tue Aug 25 00:39:17 2020 +0200
d: Fix no NRVO when returning an array of a non-POD struct
TREE_ADDRESSABLE was not propagated from the RECORD_TYPE to the ARRAY_TYPE,
so
NRVO code generation was not being triggered.
gcc/d/ChangeLog:
PR d/96157
* d-codegen.cc (d_build_call): Handle TREE_ADDRESSABLE static
arrays.
* types.cc (make_array_type): Propagate TREE_ADDRESSABLE from base
type to static array.
gcc/testsuite/ChangeLog:
PR d/96157
* gdc.dg/pr96157a.d: New test.
* gdc.dg/pr96157b.d: New test.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug d/96157] d: No NRVO when returning an array of a non-POD struct
2020-07-10 15:26 [Bug d/96157] New: d: No NRVO when returning an array of a non-POD struct ibuclaw at gdcproject dot org
2020-07-10 15:30 ` [Bug d/96157] " ibuclaw at gdcproject dot org
2020-08-26 8:04 ` cvs-commit at gcc dot gnu.org
@ 2020-08-26 8:05 ` ibuclaw at gdcproject dot org
2020-08-30 14:24 ` cvs-commit at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: ibuclaw at gdcproject dot org @ 2020-08-26 8:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96157
Iain Buclaw <ibuclaw at gdcproject dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED
--- Comment #3 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
Done.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug d/96157] d: No NRVO when returning an array of a non-POD struct
2020-07-10 15:26 [Bug d/96157] New: d: No NRVO when returning an array of a non-POD struct ibuclaw at gdcproject dot org
` (2 preceding siblings ...)
2020-08-26 8:05 ` ibuclaw at gdcproject dot org
@ 2020-08-30 14:24 ` cvs-commit at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-08-30 14:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96157
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Iain Buclaw
<ibuclaw@gcc.gnu.org>:
https://gcc.gnu.org/g:b30aeaa173b6886cda15570a2e23eac1136665bf
commit r10-8689-gb30aeaa173b6886cda15570a2e23eac1136665bf
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date: Tue Aug 25 00:39:17 2020 +0200
d: Fix no NRVO when returning an array of a non-POD struct
TREE_ADDRESSABLE was not propagated from the RECORD_TYPE to the ARRAY_TYPE,
so
NRVO code generation was not being triggered.
gcc/d/ChangeLog:
PR d/96157
* d-codegen.cc (d_build_call): Handle TREE_ADDRESSABLE static
arrays.
* types.cc (make_array_type): Propagate TREE_ADDRESSABLE from base
type to static array.
gcc/testsuite/ChangeLog:
PR d/96157
* gdc.dg/pr96157a.d: New test.
* gdc.dg/pr96157b.d: New test.
(cherry picked from commit 312ad889e99ff9458c01518325775e75ab57f272)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-08-30 14:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-10 15:26 [Bug d/96157] New: d: No NRVO when returning an array of a non-POD struct ibuclaw at gdcproject dot org
2020-07-10 15:30 ` [Bug d/96157] " ibuclaw at gdcproject dot org
2020-08-26 8:04 ` cvs-commit at gcc dot gnu.org
2020-08-26 8:05 ` ibuclaw at gdcproject dot org
2020-08-30 14:24 ` cvs-commit 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).