public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98644] New: [concepts] ICE in satisfaction_value, at cp/constraint.cc:2825
@ 2021-01-12 20:42 arthur.j.odwyer at gmail dot com
  2021-01-13 15:19 ` [Bug c++/98644] [10/11 Regression] " ppalka at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: arthur.j.odwyer at gmail dot com @ 2021-01-12 20:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98644
           Summary: [concepts] ICE in satisfaction_value, at
                    cp/constraint.cc:2825
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arthur.j.odwyer at gmail dot com
  Target Milestone: ---

// https://godbolt.org/z/qh1zos
    template<class T> concept Signed = bool(T(1));
    static_assert(Signed<int*>);

Compile with "-std=c++20":

<source>:2:28: internal compiler error: in satisfaction_value, at
cp/constraint.cc:2825
    2 | static_assert(Signed<int*>);
      |                            ^
0x1cc31d9 internal_error(char const*, ...)
        ???:0
0x6b25f7 fancy_abort(char const*, int, char const*)
        ???:0
0x7390d2 evaluate_concept_check(tree_node*, int)
        ???:0
0x7255f4 maybe_constant_value(tree_node*, tree_node*, bool)
        ???:0
0x97ffcd finish_static_assert(tree_node*, tree_node*, unsigned int, bool, bool)
        ???:0

Another very similar ICE, even though the stack trace is different:

    // https://godbolt.org/z/rPn6vd
    bool Signed = requires { requires bool((char *)1); };

<source>:1:35: internal compiler error: in satisfaction_value, at
cp/constraint.cc:2825
    1 | bool Signed = requires { requires bool((char *)1); };
      |                          ~~~~~~~~~^~~~~~~~~~~~~~~
0x1cc31d9 internal_error(char const*, ...)
        ???:0
0x6b25f7 fancy_abort(char const*, int, char const*)
        ???:0
0x737597 tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*)
        ???:0

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

* [Bug c++/98644] [10/11 Regression] [concepts] ICE in satisfaction_value, at cp/constraint.cc:2825
  2021-01-12 20:42 [Bug c++/98644] New: [concepts] ICE in satisfaction_value, at cp/constraint.cc:2825 arthur.j.odwyer at gmail dot com
@ 2021-01-13 15:19 ` ppalka at gcc dot gnu.org
  2021-01-13 15:46 ` ppalka at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-01-13 15:19 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |9.3.0
      Known to fail|                            |10.2.0, 11.0
            Summary|[concepts] ICE in           |[10/11 Regression]
                   |satisfaction_value, at      |[concepts] ICE in
                   |cp/constraint.cc:2825       |satisfaction_value, at
                   |                            |cp/constraint.cc:2825
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
                 CC|                            |ppalka at gcc dot gnu.org
   Target Milestone|---                         |10.3
   Last reconfirmed|                            |2021-01-13

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Confirmed.  We started ICEing on the first testcase after r10-7361, and on the
second testcase after r11-5799.  Previously, we would issue the fatal error

  error: ‘reinterpret_cast<char*>(1)’ is not a constant expression

during satisfaction (as per [temp.constr]/3).

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

* [Bug c++/98644] [10/11 Regression] [concepts] ICE in satisfaction_value, at cp/constraint.cc:2825
  2021-01-12 20:42 [Bug c++/98644] New: [concepts] ICE in satisfaction_value, at cp/constraint.cc:2825 arthur.j.odwyer at gmail dot com
  2021-01-13 15:19 ` [Bug c++/98644] [10/11 Regression] " ppalka at gcc dot gnu.org
@ 2021-01-13 15:46 ` ppalka at gcc dot gnu.org
  2021-01-14 11:20 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-01-13 15:46 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

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

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Patrick Palka from comment #1)
> Confirmed.  We started ICEing on the first testcase after r10-7361, and on
> the second testcase after r11-5799.  Previously, we would issue the fatal
> error
> 
>   error: ‘reinterpret_cast<char*>(1)’ is not a constant expression
> 
> during satisfaction (as per [temp.constr]/3).

Oops, I meant to say [temp.constr.atomic]/3 here.

Investigating.

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

* [Bug c++/98644] [10/11 Regression] [concepts] ICE in satisfaction_value, at cp/constraint.cc:2825
  2021-01-12 20:42 [Bug c++/98644] New: [concepts] ICE in satisfaction_value, at cp/constraint.cc:2825 arthur.j.odwyer at gmail dot com
  2021-01-13 15:19 ` [Bug c++/98644] [10/11 Regression] " ppalka at gcc dot gnu.org
  2021-01-13 15:46 ` ppalka at gcc dot gnu.org
@ 2021-01-14 11:20 ` rguenth at gcc dot gnu.org
  2021-04-08 12:02 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-01-14 11:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/98644] [10/11 Regression] [concepts] ICE in satisfaction_value, at cp/constraint.cc:2825
  2021-01-12 20:42 [Bug c++/98644] New: [concepts] ICE in satisfaction_value, at cp/constraint.cc:2825 arthur.j.odwyer at gmail dot com
                   ` (2 preceding siblings ...)
  2021-01-14 11:20 ` rguenth at gcc dot gnu.org
@ 2021-04-08 12:02 ` rguenth at gcc dot gnu.org
  2022-03-12 20:02 ` [Bug c++/98644] [10/11/12 " cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-08 12:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.3                        |10.4

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10.3 is being released, retargeting bugs to GCC 10.4.

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

* [Bug c++/98644] [10/11/12 Regression] [concepts] ICE in satisfaction_value, at cp/constraint.cc:2825
  2021-01-12 20:42 [Bug c++/98644] New: [concepts] ICE in satisfaction_value, at cp/constraint.cc:2825 arthur.j.odwyer at gmail dot com
                   ` (3 preceding siblings ...)
  2021-04-08 12:02 ` rguenth at gcc dot gnu.org
@ 2022-03-12 20:02 ` cvs-commit at gcc dot gnu.org
  2022-03-12 20:04 ` [Bug c++/98644] [10/11 " ppalka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-12 20:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 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:ab71d3fe4b23af4c29a8d6fcf1e914fed4393e3b

commit r12-7630-gab71d3fe4b23af4c29a8d6fcf1e914fed4393e3b
Author: Patrick Palka <ppalka@redhat.com>
Date:   Sat Mar 12 14:57:59 2022 -0500

    c++: ICE with non-constant satisfaction value [PR98644]

    Here during satisfaction, the expression of the atomic constraint after
    substitution is (int *) NON_LVALUE_EXPR <1> != 0B, which is not a C++
    constant expression due to the reinterpret_cast, but TREE_CONSTANT is
    set since its value is otherwise effectively constant.  We then call
    maybe_constant_value on it, which proceeds via its fail-fast path to
    exit early without clearing TREE_CONSTANT.  But satisfy_atom relies
    on checking TREE_CONSTANT of the result of maybe_constant_value in order
    to detect non-constant satisfaction.

    This patch fixes this by making the fail-fast path of maybe_constant_value
    clear TREE_CONSTANT in this case, like cxx_eval_outermost_constant_expr
    in the normal path would have done.

            PR c++/98644

    gcc/cp/ChangeLog:

            * constexpr.cc (mark_non_constant): Define, split out from ...
            (cxx_eval_outermost_constant_expr): ... here.
            (maybe_constant_value): Use it.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/concepts-pr98644.C: New test.
            * g++.dg/parse/array-size2.C: Remove expected diagnostic about a
            narrowing conversion.

    Co-authored-by: Jason Merrill <jason@redhat.com>

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

* [Bug c++/98644] [10/11 Regression] [concepts] ICE in satisfaction_value, at cp/constraint.cc:2825
  2021-01-12 20:42 [Bug c++/98644] New: [concepts] ICE in satisfaction_value, at cp/constraint.cc:2825 arthur.j.odwyer at gmail dot com
                   ` (4 preceding siblings ...)
  2022-03-12 20:02 ` [Bug c++/98644] [10/11/12 " cvs-commit at gcc dot gnu.org
@ 2022-03-12 20:04 ` ppalka at gcc dot gnu.org
  2022-06-28 10:43 ` jakub at gcc dot gnu.org
  2023-05-21 15:18 ` ppalka at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-03-12 20:04 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[10/11/12 Regression]       |[10/11 Regression]
                   |[concepts] ICE in           |[concepts] ICE in
                   |satisfaction_value, at      |satisfaction_value, at
                   |cp/constraint.cc:2825       |cp/constraint.cc:2825

--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed (finally) for GCC 12 so far.

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

* [Bug c++/98644] [10/11 Regression] [concepts] ICE in satisfaction_value, at cp/constraint.cc:2825
  2021-01-12 20:42 [Bug c++/98644] New: [concepts] ICE in satisfaction_value, at cp/constraint.cc:2825 arthur.j.odwyer at gmail dot com
                   ` (5 preceding siblings ...)
  2022-03-12 20:04 ` [Bug c++/98644] [10/11 " ppalka at gcc dot gnu.org
@ 2022-06-28 10:43 ` jakub at gcc dot gnu.org
  2023-05-21 15:18 ` ppalka at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:43 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |10.5

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

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

* [Bug c++/98644] [10/11 Regression] [concepts] ICE in satisfaction_value, at cp/constraint.cc:2825
  2021-01-12 20:42 [Bug c++/98644] New: [concepts] ICE in satisfaction_value, at cp/constraint.cc:2825 arthur.j.odwyer at gmail dot com
                   ` (6 preceding siblings ...)
  2022-06-28 10:43 ` jakub at gcc dot gnu.org
@ 2023-05-21 15:18 ` ppalka at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-05-21 15:18 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
   Target Milestone|10.5                        |12.0
         Resolution|---                         |FIXED

--- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 12+, this doesn't seem worthwhile to backport since it's
ICE-on-invalid.

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

end of thread, other threads:[~2023-05-21 15:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-12 20:42 [Bug c++/98644] New: [concepts] ICE in satisfaction_value, at cp/constraint.cc:2825 arthur.j.odwyer at gmail dot com
2021-01-13 15:19 ` [Bug c++/98644] [10/11 Regression] " ppalka at gcc dot gnu.org
2021-01-13 15:46 ` ppalka at gcc dot gnu.org
2021-01-14 11:20 ` rguenth at gcc dot gnu.org
2021-04-08 12:02 ` rguenth at gcc dot gnu.org
2022-03-12 20:02 ` [Bug c++/98644] [10/11/12 " cvs-commit at gcc dot gnu.org
2022-03-12 20:04 ` [Bug c++/98644] [10/11 " ppalka at gcc dot gnu.org
2022-06-28 10:43 ` jakub at gcc dot gnu.org
2023-05-21 15:18 ` ppalka 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).