[Bug c++/97328] [10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:3995 since r10-7313-gb599bf9d6d1e180d

2020-10-22 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97328

--- Comment #6 from CVS Commits  ---
The master branch has been updated by Patrick Palka :

https://gcc.gnu.org/g:3d423c6f6a69d87ad52ba3af75f3debd8a8b8810

commit r11-4231-g3d423c6f6a69d87ad52ba3af75f3debd8a8b8810
Author: Patrick Palka 
Date:   Thu Oct 22 07:40:40 2020 -0400

c++: Handle RANGE_EXPR index in init_subob_ctx [PR97328]

In the testcase below, we're ICEing during constexpr evaluation of the
CONSTRUCTOR {.data={{}, [1 ... 7]={}}} of type 'vector'.  The interesting
thing about this CONSTRUCTOR is that it has a RANGE_EXPR index for an
element initializer which doesn't satisfy reduced_constant_expression_p
(because the field 't' is uninitialized).

This is a problem because init_subob_ctx currently punts on setting up a
sub-aggregate initialization context when given a RANGE_EXPR index, so
we later trip over the asserts in verify_ctor_sanity when recursing into
cxx_eval_bare_aggregate on this element initializer.

Fix this by making init_subob_ctx set up an appropriate initialization
context when supplied a RANGE_EXPR index.

gcc/cp/ChangeLog:

PR c++/97328
* constexpr.c (init_subob_ctx): Don't punt on RANGE_EXPR
indexes, instead build a sub-aggregate initialization context
with no subobject.

gcc/testsuite/ChangeLog:

PR c++/97328
* g++.dg/cpp2a/constexpr-init19.C: New test.
* g++.dg/cpp2a/constexpr-init20.C: New test.

[Bug c++/97328] [10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:3995 since r10-7313-gb599bf9d6d1e180d

2020-10-12 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97328

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2

[Bug c++/97328] [10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:3995 since r10-7313-gb599bf9d6d1e180d

2020-10-08 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97328

--- Comment #5 from Patrick Palka  ---
https://gcc.gnu.org/pipermail/gcc-patches/2020-October/555850.html

[Bug c++/97328] [10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:3995 since r10-7313-gb599bf9d6d1e180d

2020-10-08 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97328

--- Comment #4 from Patrick Palka  ---
(In reply to Marek Polacek from comment #3)
> (In reply to Patrick Palka from comment #2)
> > When 'storage' is a struct instead of a union, i.e. for the testcase
> > 
> > template 
> > struct vector {
> > struct storage { 
> > T t; 
> > constexpr  storage() {}
> > } data[N];
> > };
> > 
> > constexpr auto foo() {
> > vector i;
> > return i;
> > }
> > auto f = foo();
> > 
> > we started to ICE earlier, since r279019:
> > 
> >PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.
> 
> Ah.  Feel free to hand this PR to me then (that is, if you don't want it
> anymore).

I have a fix, I think :) Will post it to the ML soon.

[Bug c++/97328] [10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:3995 since r10-7313-gb599bf9d6d1e180d

2020-10-08 Thread mpolacek at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97328

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #3 from Marek Polacek  ---
(In reply to Patrick Palka from comment #2)
> When 'storage' is a struct instead of a union, i.e. for the testcase
> 
> template 
> struct vector {
> struct storage { 
> T t; 
> constexpr  storage() {}
> } data[N];
> };
> 
> constexpr auto foo() {
> vector i;
> return i;
> }
> auto f = foo();
> 
> we started to ICE earlier, since r279019:
> 
>PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.

Ah.  Feel free to hand this PR to me then (that is, if you don't want it
anymore).

[Bug c++/97328] [10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:3995 since r10-7313-gb599bf9d6d1e180d

2020-10-08 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97328

--- Comment #2 from Patrick Palka  ---
When 'storage' is a struct instead of a union, i.e. for the testcase

template 
struct vector {
struct storage { 
T t; 
constexpr  storage() {}
} data[N];
};

constexpr auto foo() {
vector i;
return i;
}
auto f = foo();

we started to ICE earlier, since r279019:

   PR c++/91353 - P1331R2: Allow trivial default init in constexpr contexts.

[Bug c++/97328] [10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:3995 since r10-7313-gb599bf9d6d1e180d

2020-10-08 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97328

Patrick Palka  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |ppalka at gcc dot 
gnu.org

[Bug c++/97328] [10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:3995 since r10-7313-gb599bf9d6d1e180d

2020-10-08 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97328

Martin Liška  changed:

   What|Removed |Added

   Last reconfirmed||2020-10-08
 Status|UNCONFIRMED |NEW
Summary|[ICE] internal compiler |[10/11 Regression] ICE in
   |error: in   |verify_ctor_sanity, at
   |verify_ctor_sanity, at  |cp/constexpr.c:3995 since
   |cp/constexpr.c:3995 |r10-7313-gb599bf9d6d1e180d
 CC||marxin at gcc dot gnu.org,
   ||ppalka at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Martin Liška  ---
Confirmed, started with r10-7313-gb599bf9d6d1e180d.

[Bug c++/97328] [10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:3995 since r10-7313-gb599bf9d6d1e180d

2020-10-08 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97328

Martin Liška  changed:

   What|Removed |Added

   Target Milestone|--- |10.3
  Known to work||9.3.0
  Known to fail||10.2.0, 11.0