public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97430] New: internal compiler error: in verify_ctor_sanity,  at cp/constexpr.c:3884
@ 2020-10-14 23:43 jfrech.bugzilla at gmail dot com
  2020-10-14 23:54 ` [Bug c++/97430] [10/11 Regression] " mpolacek at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: jfrech.bugzilla at gmail dot com @ 2020-10-14 23:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97430

            Bug ID: 97430
           Summary: internal compiler error: in verify_ctor_sanity, at
                    cp/constexpr.c:3884
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jfrech.bugzilla at gmail dot com
  Target Milestone: ---

Possible duplicate of Bug 96241.

The following one-line source file triggers an ICE with `-std=c++17`:

int main(){[](){enum E{F};struct{E e{F};}p[1]{};return p->e;};}

% g++ -std=c++17 ice.cpp
ice.cpp: In static member function ‘static constexpr main()::<lambda()>::E
main()::<lambda()>::_FUN()’:
ice.cpp:1:61:   in ‘constexpr’ expansion of ‘0->main()::<lambda()>()’
ice.cpp:1:61: internal compiler error: in verify_ctor_sanity, at
cp/constexpr.c:3884
    1 | int main(){[](){enum E{F};struct{E e{F};}p[1]{};return p->e;};}
      |                                                             ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-10/README.Bugs> for instructions.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/97430] [10/11 Regression] internal compiler error: in verify_ctor_sanity, at cp/constexpr.c:3884
  2020-10-14 23:43 [Bug c++/97430] New: internal compiler error: in verify_ctor_sanity, at cp/constexpr.c:3884 jfrech.bugzilla at gmail dot com
@ 2020-10-14 23:54 ` mpolacek at gcc dot gnu.org
  2020-10-15  1:48 ` mpolacek at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-10-14 23:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97430

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|internal compiler error: in |[10/11 Regression] internal
                   |verify_ctor_sanity, at      |compiler error: in
                   |cp/constexpr.c:3884         |verify_ctor_sanity, at
                   |                            |cp/constexpr.c:3884
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |ice-on-valid-code
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |mpolacek at gcc dot gnu.org
   Last reconfirmed|                            |2020-10-14
   Target Milestone|---                         |10.3
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Not a dup of bug 96241, this one started with r10-6527.  Use -std=c++17.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/97430] [10/11 Regression] internal compiler error: in verify_ctor_sanity, at cp/constexpr.c:3884
  2020-10-14 23:43 [Bug c++/97430] New: internal compiler error: in verify_ctor_sanity, at cp/constexpr.c:3884 jfrech.bugzilla at gmail dot com
  2020-10-14 23:54 ` [Bug c++/97430] [10/11 Regression] " mpolacek at gcc dot gnu.org
@ 2020-10-15  1:48 ` mpolacek at gcc dot gnu.org
  2020-10-15  3:04 ` mpolacek at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-10-15  1:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97430

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
A test without a lambda that ICEs with -std=c++14 too:

enum E : int { F };
struct X {
  E e{F};
};
constexpr X x[1];

auto
foo ()
{
  return x[0].e;
}

Note that we don't ICE if the X's member is changed to E e{1};.  The difference
is that for the former reduced_constant_expression_p says false (due to the
CONST_DECL F), so we cxx_eval_bare_aggregate and verify_ctor_sanity in
cxx_eval_constant_expression/CONSTRUCTOR.  With e{1}
reduced_constant_expression_p is true and we don't call
cxx_eval_bare_aggregate.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/97430] [10/11 Regression] internal compiler error: in verify_ctor_sanity, at cp/constexpr.c:3884
  2020-10-14 23:43 [Bug c++/97430] New: internal compiler error: in verify_ctor_sanity, at cp/constexpr.c:3884 jfrech.bugzilla at gmail dot com
  2020-10-14 23:54 ` [Bug c++/97430] [10/11 Regression] " mpolacek at gcc dot gnu.org
  2020-10-15  1:48 ` mpolacek at gcc dot gnu.org
@ 2020-10-15  3:04 ` mpolacek at gcc dot gnu.org
  2020-10-15  4:03 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-10-15  3:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97430

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
And that also means that this:

enum E : int { F };
struct X {
  E e{F};
};

constexpr X x[1]{};

constexpr auto
foo ()
{
  return x[0].e;
}

constexpr auto a = foo ();

started to ICE earlier, since r10-6437.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/97430] [10/11 Regression] internal compiler error: in verify_ctor_sanity, at cp/constexpr.c:3884
  2020-10-14 23:43 [Bug c++/97430] New: internal compiler error: in verify_ctor_sanity, at cp/constexpr.c:3884 jfrech.bugzilla at gmail dot com
                   ` (2 preceding siblings ...)
  2020-10-15  3:04 ` mpolacek at gcc dot gnu.org
@ 2020-10-15  4:03 ` mpolacek at gcc dot gnu.org
  2020-10-15  4:07 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-10-15  4:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97430

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This ought to fix it, though it's completely untested:

--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -3661,6 +3661,10 @@ cxx_eval_array_reference (const constexpr_ctx *ctx, tree
t,
     {
       tree empty_ctor = build_constructor (init_list_type_node, NULL);
       val = digest_init (elem_type, empty_ctor, tf_warning_or_error);
+      constexpr_ctx new_ctx = *ctx;
+      new_ctx.ctor = build_constructor (elem_type, NULL);
+      new_ctx.object = NULL_TREE;
+      ctx = &new_ctx;
     }
   else
     val = build_value_init (elem_type, tf_warning_or_error);

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/97430] [10/11 Regression] internal compiler error: in verify_ctor_sanity, at cp/constexpr.c:3884
  2020-10-14 23:43 [Bug c++/97430] New: internal compiler error: in verify_ctor_sanity, at cp/constexpr.c:3884 jfrech.bugzilla at gmail dot com
                   ` (3 preceding siblings ...)
  2020-10-15  4:03 ` mpolacek at gcc dot gnu.org
@ 2020-10-15  4:07 ` mpolacek at gcc dot gnu.org
  2020-10-15  7:25 ` rguenth at gcc dot gnu.org
  2020-10-15 14:05 ` mpolacek at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-10-15  4:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97430

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
...which should also fix Bug 96241 so these in fact are duplicates.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/97430] [10/11 Regression] internal compiler error: in verify_ctor_sanity, at cp/constexpr.c:3884
  2020-10-14 23:43 [Bug c++/97430] New: internal compiler error: in verify_ctor_sanity, at cp/constexpr.c:3884 jfrech.bugzilla at gmail dot com
                   ` (4 preceding siblings ...)
  2020-10-15  4:07 ` mpolacek at gcc dot gnu.org
@ 2020-10-15  7:25 ` rguenth at gcc dot gnu.org
  2020-10-15 14:05 ` mpolacek at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-10-15  7:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97430

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/97430] [10/11 Regression] internal compiler error: in verify_ctor_sanity, at cp/constexpr.c:3884
  2020-10-14 23:43 [Bug c++/97430] New: internal compiler error: in verify_ctor_sanity, at cp/constexpr.c:3884 jfrech.bugzilla at gmail dot com
                   ` (5 preceding siblings ...)
  2020-10-15  7:25 ` rguenth at gcc dot gnu.org
@ 2020-10-15 14:05 ` mpolacek at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-10-15 14:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97430

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Closing as a dup.

*** This bug has been marked as a duplicate of bug 96241 ***

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-10-15 14:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-14 23:43 [Bug c++/97430] New: internal compiler error: in verify_ctor_sanity, at cp/constexpr.c:3884 jfrech.bugzilla at gmail dot com
2020-10-14 23:54 ` [Bug c++/97430] [10/11 Regression] " mpolacek at gcc dot gnu.org
2020-10-15  1:48 ` mpolacek at gcc dot gnu.org
2020-10-15  3:04 ` mpolacek at gcc dot gnu.org
2020-10-15  4:03 ` mpolacek at gcc dot gnu.org
2020-10-15  4:07 ` mpolacek at gcc dot gnu.org
2020-10-15  7:25 ` rguenth at gcc dot gnu.org
2020-10-15 14:05 ` mpolacek 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).