public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94523] New: [10 Regression] error: 'constexpr' evaluation depth exceeds maximum of 512 (use '-fconstexpr-depth=' to increase the maximum) since r10-7490-g76f09260b7eccd6c
@ 2020-04-07 19:16 marxin at gcc dot gnu.org
  2020-04-07 19:16 ` [Bug c++/94523] " marxin at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-04-07 19:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94523
           Summary: [10 Regression] error: 'constexpr' evaluation depth
                    exceeds maximum of 512 (use '-fconstexpr-depth=' to
                    increase the maximum) since r10-7490-g76f09260b7eccd6c
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: jason at gcc dot gnu.org
  Target Milestone: ---

It's a test-case reduced from pybind11 package:

$ cat pybind11.ii
template <bool, typename a> using b = a;
struct d {
  char ao;
  template <typename ap> constexpr d(ap) : ao{} {}
};
template <int... au> struct e { static constexpr auto aw = d(au...); };
template <int c> b<c, d> ax(e<1>::aw);

$ g++-9 pybind11.ii -c
$ g++ pybind11.ii -c
...
pybind11.ii:6:55:   in 'constexpr' expansion of 'd(1)'
pybind11.ii:6:55:   in 'constexpr' expansion of 'd(1)'
pybind11.ii:6:55:   in 'constexpr' expansion of 'd(1)'
pybind11.ii:6:55:   in 'constexpr' expansion of 'd(1)'
pybind11.ii:6:55:   in 'constexpr' expansion of 'd(1)'
pybind11.ii:6:55: error: 'constexpr' evaluation depth exceeds maximum of 512
(use '-fconstexpr-depth=' to increase the maximum)
    6 | template <int... au> struct e { static constexpr auto aw = d(au...); };
      |                                                       ^~

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

* [Bug c++/94523] [10 Regression] error: 'constexpr' evaluation depth exceeds maximum of 512 (use '-fconstexpr-depth=' to increase the maximum) since r10-7490-g76f09260b7eccd6c
  2020-04-07 19:16 [Bug c++/94523] New: [10 Regression] error: 'constexpr' evaluation depth exceeds maximum of 512 (use '-fconstexpr-depth=' to increase the maximum) since r10-7490-g76f09260b7eccd6c marxin at gcc dot gnu.org
@ 2020-04-07 19:16 ` marxin at gcc dot gnu.org
  2020-04-08  8:19 ` arnaud.giersch at free dot fr
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-04-07 19:16 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |9.3.0
   Last reconfirmed|                            |2020-04-07
             Status|UNCONFIRMED                 |NEW
      Known to fail|                            |10.0
   Target Milestone|---                         |10.0
     Ever confirmed|0                           |1
           Priority|P3                          |P1

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Clang also accepts that so I hope it's reject-valid.

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

* [Bug c++/94523] [10 Regression] error: 'constexpr' evaluation depth exceeds maximum of 512 (use '-fconstexpr-depth=' to increase the maximum) since r10-7490-g76f09260b7eccd6c
  2020-04-07 19:16 [Bug c++/94523] New: [10 Regression] error: 'constexpr' evaluation depth exceeds maximum of 512 (use '-fconstexpr-depth=' to increase the maximum) since r10-7490-g76f09260b7eccd6c marxin at gcc dot gnu.org
  2020-04-07 19:16 ` [Bug c++/94523] " marxin at gcc dot gnu.org
@ 2020-04-08  8:19 ` arnaud.giersch at free dot fr
  2020-04-08  8:30 ` marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: arnaud.giersch at free dot fr @ 2020-04-08  8:19 UTC (permalink / raw)
  To: gcc-bugs

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

Arnaud Giersch <arnaud.giersch at free dot fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |arnaud.giersch at free dot fr

--- Comment #2 from Arnaud Giersch <arnaud.giersch at free dot fr> ---
Hi,

Faced with the same problem, I noticed that it fails only with -std=c++14 (not
with c++17, nor c++20).

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

* [Bug c++/94523] [10 Regression] error: 'constexpr' evaluation depth exceeds maximum of 512 (use '-fconstexpr-depth=' to increase the maximum) since r10-7490-g76f09260b7eccd6c
  2020-04-07 19:16 [Bug c++/94523] New: [10 Regression] error: 'constexpr' evaluation depth exceeds maximum of 512 (use '-fconstexpr-depth=' to increase the maximum) since r10-7490-g76f09260b7eccd6c marxin at gcc dot gnu.org
  2020-04-07 19:16 ` [Bug c++/94523] " marxin at gcc dot gnu.org
  2020-04-08  8:19 ` arnaud.giersch at free dot fr
@ 2020-04-08  8:30 ` marxin at gcc dot gnu.org
  2020-04-08 19:51 ` jason at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-04-08  8:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Arnaud Giersch from comment #2)
> Hi,
> 
> Faced with the same problem, I noticed that it fails only with -std=c++14
> (not with c++17, nor c++20).

Good point! I can only confirm that.

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

* [Bug c++/94523] [10 Regression] error: 'constexpr' evaluation depth exceeds maximum of 512 (use '-fconstexpr-depth=' to increase the maximum) since r10-7490-g76f09260b7eccd6c
  2020-04-07 19:16 [Bug c++/94523] New: [10 Regression] error: 'constexpr' evaluation depth exceeds maximum of 512 (use '-fconstexpr-depth=' to increase the maximum) since r10-7490-g76f09260b7eccd6c marxin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-04-08  8:30 ` marxin at gcc dot gnu.org
@ 2020-04-08 19:51 ` jason at gcc dot gnu.org
  2020-04-09 11:32 ` reichelt at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2020-04-08 19:51 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org

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

* [Bug c++/94523] [10 Regression] error: 'constexpr' evaluation depth exceeds maximum of 512 (use '-fconstexpr-depth=' to increase the maximum) since r10-7490-g76f09260b7eccd6c
  2020-04-07 19:16 [Bug c++/94523] New: [10 Regression] error: 'constexpr' evaluation depth exceeds maximum of 512 (use '-fconstexpr-depth=' to increase the maximum) since r10-7490-g76f09260b7eccd6c marxin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-04-08 19:51 ` jason at gcc dot gnu.org
@ 2020-04-09 11:32 ` reichelt at gcc dot gnu.org
  2020-04-09 11:36 ` reichelt at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: reichelt at gcc dot gnu.org @ 2020-04-09 11:32 UTC (permalink / raw)
  To: gcc-bugs

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

Volker Reichelt <reichelt at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu.org

--- Comment #4 from Volker Reichelt <reichelt at gcc dot gnu.org> ---
Here's a simpler testcase without variadic templates and template alias:

=======================================
struct A
{
  char c;
  constexpr A(int) : c() {}
};

template<int N> struct B
{
  static constexpr auto X = A(N);
};

constexpr A a = B<0>::X;
=======================================

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

* [Bug c++/94523] [10 Regression] error: 'constexpr' evaluation depth exceeds maximum of 512 (use '-fconstexpr-depth=' to increase the maximum) since r10-7490-g76f09260b7eccd6c
  2020-04-07 19:16 [Bug c++/94523] New: [10 Regression] error: 'constexpr' evaluation depth exceeds maximum of 512 (use '-fconstexpr-depth=' to increase the maximum) since r10-7490-g76f09260b7eccd6c marxin at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-04-09 11:32 ` reichelt at gcc dot gnu.org
@ 2020-04-09 11:36 ` reichelt at gcc dot gnu.org
  2020-04-09 11:58 ` reichelt at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: reichelt at gcc dot gnu.org @ 2020-04-09 11:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Volker Reichelt <reichelt at gcc dot gnu.org> ---
Btw, larger testcases also fail with -std=c++2a, so it's not restricted to
-std=c++14

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

* [Bug c++/94523] [10 Regression] error: 'constexpr' evaluation depth exceeds maximum of 512 (use '-fconstexpr-depth=' to increase the maximum) since r10-7490-g76f09260b7eccd6c
  2020-04-07 19:16 [Bug c++/94523] New: [10 Regression] error: 'constexpr' evaluation depth exceeds maximum of 512 (use '-fconstexpr-depth=' to increase the maximum) since r10-7490-g76f09260b7eccd6c marxin at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2020-04-09 11:36 ` reichelt at gcc dot gnu.org
@ 2020-04-09 11:58 ` reichelt at gcc dot gnu.org
  2020-04-09 21:34 ` cvs-commit at gcc dot gnu.org
  2020-04-10 21:31 ` jason at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: reichelt at gcc dot gnu.org @ 2020-04-09 11:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Volker Reichelt <reichelt at gcc dot gnu.org> ---
Please ignore my previous comment, it really only fails with -std=c++14 or
-std=c++11 .

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

* [Bug c++/94523] [10 Regression] error: 'constexpr' evaluation depth exceeds maximum of 512 (use '-fconstexpr-depth=' to increase the maximum) since r10-7490-g76f09260b7eccd6c
  2020-04-07 19:16 [Bug c++/94523] New: [10 Regression] error: 'constexpr' evaluation depth exceeds maximum of 512 (use '-fconstexpr-depth=' to increase the maximum) since r10-7490-g76f09260b7eccd6c marxin at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2020-04-09 11:58 ` reichelt at gcc dot gnu.org
@ 2020-04-09 21:34 ` cvs-commit at gcc dot gnu.org
  2020-04-10 21:31 ` jason at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-09 21:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 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:ef529765234bea7893bd56f3ab3a2da7695f6b21

commit r10-7669-gef529765234bea7893bd56f3ab3a2da7695f6b21
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Apr 8 23:59:30 2020 -0400

    c++: constexpr static data member instantiation [PR94523]

    Here due to my recent change to store_init_value we were expanding the
    initializer of aw knowing that we were initializing aw.  When
    cxx_eval_call_expression finished the constructor, it wanted to look up the
    value of aw to set TREE_READONLY on it, but we haven't set DECL_INITIAL
yet,
    so decl_constant_value tried to instantiate the initializer again.  And
    infinite recursion.  Stopped by optimizing the case of asking for the value
    of ctx->object, which is ctx->value.  It also would have worked to look in
    the values hash table, so let's move that up before decl_constant_value as
    well.

    gcc/cp/ChangeLog
    2020-04-09  Jason Merrill  <jason@redhat.com>

            PR c++/94523
            * constexpr.c (cxx_eval_constant_expression) [VAR_DECL]: Look at
            ctx->object and ctx->global->values first.

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

* [Bug c++/94523] [10 Regression] error: 'constexpr' evaluation depth exceeds maximum of 512 (use '-fconstexpr-depth=' to increase the maximum) since r10-7490-g76f09260b7eccd6c
  2020-04-07 19:16 [Bug c++/94523] New: [10 Regression] error: 'constexpr' evaluation depth exceeds maximum of 512 (use '-fconstexpr-depth=' to increase the maximum) since r10-7490-g76f09260b7eccd6c marxin at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2020-04-09 21:34 ` cvs-commit at gcc dot gnu.org
@ 2020-04-10 21:31 ` jason at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2020-04-10 21:31 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2020-04-10 21:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-07 19:16 [Bug c++/94523] New: [10 Regression] error: 'constexpr' evaluation depth exceeds maximum of 512 (use '-fconstexpr-depth=' to increase the maximum) since r10-7490-g76f09260b7eccd6c marxin at gcc dot gnu.org
2020-04-07 19:16 ` [Bug c++/94523] " marxin at gcc dot gnu.org
2020-04-08  8:19 ` arnaud.giersch at free dot fr
2020-04-08  8:30 ` marxin at gcc dot gnu.org
2020-04-08 19:51 ` jason at gcc dot gnu.org
2020-04-09 11:32 ` reichelt at gcc dot gnu.org
2020-04-09 11:36 ` reichelt at gcc dot gnu.org
2020-04-09 11:58 ` reichelt at gcc dot gnu.org
2020-04-09 21:34 ` cvs-commit at gcc dot gnu.org
2020-04-10 21:31 ` 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).