* [Bug c++/96282] internal compiler error: in output_constructor_regular_field
2020-07-22 12:13 [Bug c++/96282] New: internal compiler error: in output_constructor_regular_field terra at gnome dot org
@ 2020-07-22 12:14 ` terra at gnome dot org
2020-07-22 14:13 ` [Bug c++/96282] [8/9/10/11 Regression] " rguenth at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: terra at gnome dot org @ 2020-07-22 12:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96282
--- Comment #1 from M Welinder <terra at gnome dot org> ---
Created attachment 48916
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48916&action=edit
preprocessed test program
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/96282] [8/9/10/11 Regression] internal compiler error: in output_constructor_regular_field
2020-07-22 12:13 [Bug c++/96282] New: internal compiler error: in output_constructor_regular_field terra at gnome dot org
2020-07-22 12:14 ` [Bug c++/96282] " terra at gnome dot org
@ 2020-07-22 14:13 ` rguenth at gcc dot gnu.org
2020-07-22 15:35 ` jakub at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-22 14:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96282
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2020-07-22
Known to work| |7.3.0
Summary|internal compiler error: in |[8/9/10/11 Regression]
|output_constructor_regular_ |internal compiler error: in
|field |output_constructor_regular_
| |field
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Known to fail| |10.1.0, 7.4.0
Target Milestone|--- |8.5
Keywords| |ice-on-valid-code,
| |needs-bisection,
| |needs-reduction
Priority|P3 |P2
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Needs -std=c++14, works with 7.3, ICEs with 7.4.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/96282] [8/9/10/11 Regression] internal compiler error: in output_constructor_regular_field
2020-07-22 12:13 [Bug c++/96282] New: internal compiler error: in output_constructor_regular_field terra at gnome dot org
2020-07-22 12:14 ` [Bug c++/96282] " terra at gnome dot org
2020-07-22 14:13 ` [Bug c++/96282] [8/9/10/11 Regression] " rguenth at gcc dot gnu.org
@ 2020-07-22 15:35 ` jakub at gcc dot gnu.org
2020-07-29 9:07 ` marxin at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-07-22 15:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96282
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r257580.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/96282] [8/9/10/11 Regression] internal compiler error: in output_constructor_regular_field
2020-07-22 12:13 [Bug c++/96282] New: internal compiler error: in output_constructor_regular_field terra at gnome dot org
` (2 preceding siblings ...)
2020-07-22 15:35 ` jakub at gcc dot gnu.org
@ 2020-07-29 9:07 ` marxin at gcc dot gnu.org
2020-07-31 20:33 ` ppalka at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-07-29 9:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96282
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|needs-bisection, |
|needs-reduction |
CC| |marxin at gcc dot gnu.org
--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
Reduced test-case:
#include <array>
template <typename T, typename Ix, Ix Size>
class Pen : std::array<T, Size> {
typedef std::array<T, Size> arr;
public:
// Removing either "constexpr" or ": arr()" from the following
// line seems to work around the problem.
constexpr Pen() : arr() { }
};
class Farm {
public:
enum Sheep { BAA, ZZZ };
template<typename T>
using SheepPen = Pen<T, Sheep, ZZZ>;
};
class Fence {
public:
constexpr Fence() { length = 12; }
int length = 0;
};
void
cull() {
static Farm::SheepPen<Fence> s;
}
Will you look at it Richi?
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/96282] [8/9/10/11 Regression] internal compiler error: in output_constructor_regular_field
2020-07-22 12:13 [Bug c++/96282] New: internal compiler error: in output_constructor_regular_field terra at gnome dot org
` (3 preceding siblings ...)
2020-07-29 9:07 ` marxin at gcc dot gnu.org
@ 2020-07-31 20:33 ` ppalka at gcc dot gnu.org
2020-08-05 19:08 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-07-31 20:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96282
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
CC| |ppalka at gcc dot gnu.org
--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Investigating.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/96282] [8/9/10/11 Regression] internal compiler error: in output_constructor_regular_field
2020-07-22 12:13 [Bug c++/96282] New: internal compiler error: in output_constructor_regular_field terra at gnome dot org
` (4 preceding siblings ...)
2020-07-31 20:33 ` ppalka at gcc dot gnu.org
@ 2020-08-05 19:08 ` cvs-commit at gcc dot gnu.org
2020-08-07 12:40 ` [Bug c++/96282] [8/9/10 " ppalka at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-08-05 19:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96282
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:d21252de6c81ed236d8981d47b9a57dc4f1c6d57
commit r11-2580-gd21252de6c81ed236d8981d47b9a57dc4f1c6d57
Author: Patrick Palka <ppalka@redhat.com>
Date: Wed Aug 5 15:05:30 2020 -0400
c++: cxx_eval_vec_init after zero-initialization [PR96282]
In the first testcase below, expand_aggr_init_1 sets up t's default
constructor such that the ctor first zero-initializes the entire base b,
followed by calling b's default constructor, the latter of which just
default-initializes the array member b::m via a VEC_INIT_EXPR.
So upon constexpr evaluation of this latter VEC_INIT_EXPR, ctx->ctor is
nonempty due to the prior zero-initialization, and we proceed in
cxx_eval_vec_init to append new constructor_elts to the end of ctx->ctor
without first checking if a matching constructor_elt already exists.
This leads to ctx->ctor having two matching constructor_elts for each
index.
This patch fixes this issue by truncating a zero-initialized array
CONSTRUCTOR in cxx_eval_vec_init_1 before we begin appending array
elements to it. We propagate its zeroed out state during evaluation by
clearing CONSTRUCTOR_NO_CLEARING on each new appended aggregate element.
gcc/cp/ChangeLog:
PR c++/96282
* constexpr.c (cxx_eval_vec_init_1): Truncate ctx->ctor and
then clear CONSTRUCTOR_NO_CLEARING on each appended element
initializer if we're initializing a previously zero-initialized
array object.
gcc/testsuite/ChangeLog:
PR c++/96282
* g++.dg/cpp0x/constexpr-array26.C: New test.
* g++.dg/cpp0x/constexpr-array27.C: New test.
* g++.dg/cpp2a/constexpr-init18.C: New test.
Co-authored-by: Jason Merrill <jason@redhat.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/96282] [8/9/10 Regression] internal compiler error: in output_constructor_regular_field
2020-07-22 12:13 [Bug c++/96282] New: internal compiler error: in output_constructor_regular_field terra at gnome dot org
` (5 preceding siblings ...)
2020-08-05 19:08 ` cvs-commit at gcc dot gnu.org
@ 2020-08-07 12:40 ` ppalka at gcc dot gnu.org
2021-02-01 13:41 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-08-07 12:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96282
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[8/9/10/11 Regression] |[8/9/10 Regression]
|internal compiler error: in |internal compiler error: in
|output_constructor_regular_ |output_constructor_regular_
|field |field
--- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 11 so far.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/96282] [8/9/10 Regression] internal compiler error: in output_constructor_regular_field
2020-07-22 12:13 [Bug c++/96282] New: internal compiler error: in output_constructor_regular_field terra at gnome dot org
` (6 preceding siblings ...)
2020-08-07 12:40 ` [Bug c++/96282] [8/9/10 " ppalka at gcc dot gnu.org
@ 2021-02-01 13:41 ` cvs-commit at gcc dot gnu.org
2021-04-21 21:09 ` [Bug c++/96282] [8/9 " cvs-commit at gcc dot gnu.org
2021-05-14 14:01 ` [Bug c++/96282] [8 " jakub at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-02-01 13:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96282
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:f426e4f63451e937c943606d3142b1ac6b70467a
commit r10-9331-gf426e4f63451e937c943606d3142b1ac6b70467a
Author: Patrick Palka <ppalka@redhat.com>
Date: Wed Aug 5 15:05:30 2020 -0400
c++: cxx_eval_vec_init after zero-initialization [PR96282]
In the first testcase below, expand_aggr_init_1 sets up t's default
constructor such that the ctor first zero-initializes the entire base b,
followed by calling b's default constructor, the latter of which just
default-initializes the array member b::m via a VEC_INIT_EXPR.
So upon constexpr evaluation of this latter VEC_INIT_EXPR, ctx->ctor is
nonempty due to the prior zero-initialization, and we proceed in
cxx_eval_vec_init to append new constructor_elts to the end of ctx->ctor
without first checking if a matching constructor_elt already exists.
This leads to ctx->ctor having two matching constructor_elts for each
index.
This patch fixes this issue by truncating a zero-initialized array
CONSTRUCTOR in cxx_eval_vec_init_1 before we begin appending array
elements to it. We propagate its zeroed out state during evaluation by
clearing CONSTRUCTOR_NO_CLEARING on each new appended aggregate element.
gcc/cp/ChangeLog:
PR c++/96282
* constexpr.c (cxx_eval_vec_init_1): Truncate ctx->ctor and
then clear CONSTRUCTOR_NO_CLEARING on each appended element
initializer if we're initializing a previously zero-initialized
array object.
gcc/testsuite/ChangeLog:
PR c++/96282
* g++.dg/cpp0x/constexpr-array26.C: New test.
* g++.dg/cpp0x/constexpr-array27.C: New test.
* g++.dg/cpp2a/constexpr-init18.C: New test.
Co-authored-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit d21252de6c81ed236d8981d47b9a57dc4f1c6d57)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/96282] [8/9 Regression] internal compiler error: in output_constructor_regular_field
2020-07-22 12:13 [Bug c++/96282] New: internal compiler error: in output_constructor_regular_field terra at gnome dot org
` (7 preceding siblings ...)
2021-02-01 13:41 ` cvs-commit at gcc dot gnu.org
@ 2021-04-21 21:09 ` cvs-commit at gcc dot gnu.org
2021-05-14 14:01 ` [Bug c++/96282] [8 " jakub at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-21 21:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96282
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:fef6ee0790de58f16128a0de87571ba7e04b8320
commit r9-9455-gfef6ee0790de58f16128a0de87571ba7e04b8320
Author: Patrick Palka <ppalka@redhat.com>
Date: Wed Aug 5 15:05:30 2020 -0400
c++: cxx_eval_vec_init after zero-initialization [PR96282]
In the first testcase below, expand_aggr_init_1 sets up t's default
constructor such that the ctor first zero-initializes the entire base b,
followed by calling b's default constructor, the latter of which just
default-initializes the array member b::m via a VEC_INIT_EXPR.
So upon constexpr evaluation of this latter VEC_INIT_EXPR, ctx->ctor is
nonempty due to the prior zero-initialization, and we proceed in
cxx_eval_vec_init to append new constructor_elts to the end of ctx->ctor
without first checking if a matching constructor_elt already exists.
This leads to ctx->ctor having two matching constructor_elts for each
index.
This patch fixes this issue by truncating a zero-initialized array
CONSTRUCTOR in cxx_eval_vec_init_1 before we begin appending array
elements to it. We propagate its zeroed out state during evaluation by
clearing CONSTRUCTOR_NO_CLEARING on each new appended aggregate element.
gcc/cp/ChangeLog:
PR c++/96282
* constexpr.c (cxx_eval_vec_init_1): Truncate ctx->ctor and
then clear CONSTRUCTOR_NO_CLEARING on each appended element
initializer if we're initializing a previously zero-initialized
array object.
gcc/testsuite/ChangeLog:
PR c++/96282
* g++.dg/cpp0x/constexpr-array26.C: New test.
* g++.dg/cpp0x/constexpr-array27.C: New test.
Co-authored-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit d21252de6c81ed236d8981d47b9a57dc4f1c6d57)
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/96282] [8 Regression] internal compiler error: in output_constructor_regular_field
2020-07-22 12:13 [Bug c++/96282] New: internal compiler error: in output_constructor_regular_field terra at gnome dot org
` (8 preceding siblings ...)
2021-04-21 21:09 ` [Bug c++/96282] [8/9 " cvs-commit at gcc dot gnu.org
@ 2021-05-14 14:01 ` jakub at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-14 14:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96282
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Target Milestone|8.5 |9.4
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The GCC 8 branch is being closed, fixed in GCC 9.4.
^ permalink raw reply [flat|nested] 11+ messages in thread