public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95386] New: internal compiler error: in satisfaction_value,  while compiling function with a requires clause
@ 2020-05-28 14:22 jpalecek at web dot de
  2020-05-28 14:57 ` [Bug c++/95386] " marxin at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: jpalecek at web dot de @ 2020-05-28 14:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95386
           Summary: internal compiler error: in satisfaction_value, while
                    compiling function with a requires clause
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jpalecek at web dot de
  Target Milestone: ---

Created attachment 48627
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48627&action=edit
C-reduced code reproducing the problem

Hello,

while trying to call a function with this signature

template <class T>
void g(T&& a) requires !std::is_lvalue_reference<T>()

I get an internal compiler error:


rref-test.cpp:48:6: internal compiler error: in satisfaction_value, at
cp/constraint.cc:2503
   48 |   g(a);

This doesn't happen if I don't use the implicit conversion to bool in the
requires clause:

template <class T>
void g(T&& a) requires !std::is_lvalue_reference<T>::value

is OK.

The minimized (C-reduced) reproducing code is in the attachment. It is a bit
funny as it is not syntactically a complete program, but does reproduce the
problem anyway.

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

* [Bug c++/95386] internal compiler error: in satisfaction_value, while compiling function with a requires clause
  2020-05-28 14:22 [Bug c++/95386] New: internal compiler error: in satisfaction_value, while compiling function with a requires clause jpalecek at web dot de
@ 2020-05-28 14:57 ` marxin at gcc dot gnu.org
  2020-05-28 15:16 ` jpalecek at web dot de
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-05-28 14:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org
   Last reconfirmed|                            |2020-05-28
             Status|UNCONFIRMED                 |WAITING
     Ever confirmed|0                           |1

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Was the original code a valid code?
It seems the reduced code is invalid.

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

* [Bug c++/95386] internal compiler error: in satisfaction_value, while compiling function with a requires clause
  2020-05-28 14:22 [Bug c++/95386] New: internal compiler error: in satisfaction_value, while compiling function with a requires clause jpalecek at web dot de
  2020-05-28 14:57 ` [Bug c++/95386] " marxin at gcc dot gnu.org
@ 2020-05-28 15:16 ` jpalecek at web dot de
  2020-05-28 15:17 ` jpalecek at web dot de
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jpalecek at web dot de @ 2020-05-28 15:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jiří Paleček <jpalecek at web dot de> ---
(In reply to Martin Liška from comment #1)
> Was the original code a valid code?
> It seems the reduced code is invalid.

Yes at least I believe so. I will attach the original code, it is not big.

Note that you must compile (both versions) with -fconcepts.

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

* [Bug c++/95386] internal compiler error: in satisfaction_value, while compiling function with a requires clause
  2020-05-28 14:22 [Bug c++/95386] New: internal compiler error: in satisfaction_value, while compiling function with a requires clause jpalecek at web dot de
  2020-05-28 14:57 ` [Bug c++/95386] " marxin at gcc dot gnu.org
  2020-05-28 15:16 ` jpalecek at web dot de
@ 2020-05-28 15:17 ` jpalecek at web dot de
  2020-05-28 15:59 ` [Bug c++/95386] [10/11 Regression] ICE: in satisfaction_value, while compiling function with a requires clause since r10-3735-gcb57504a55015891 marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jpalecek at web dot de @ 2020-05-28 15:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jiří Paleček <jpalecek at web dot de> ---
Created attachment 48629
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48629&action=edit
Original code which fails to compile

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

* [Bug c++/95386] [10/11 Regression] ICE: in satisfaction_value, while compiling function with a requires clause since r10-3735-gcb57504a55015891
  2020-05-28 14:22 [Bug c++/95386] New: internal compiler error: in satisfaction_value, while compiling function with a requires clause jpalecek at web dot de
                   ` (2 preceding siblings ...)
  2020-05-28 15:17 ` jpalecek at web dot de
@ 2020-05-28 15:59 ` marxin at gcc dot gnu.org
  2020-05-29  6:25 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-05-28 15:59 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
            Summary|internal compiler error: in |[10/11 Regression] ICE: in
                   |satisfaction_value, while   |satisfaction_value, while
                   |compiling function with a   |compiling function with a
                   |requires clause             |requires clause since
                   |                            |r10-3735-gcb57504a55015891
             Status|WAITING                     |NEW
                 CC|                            |jason at gcc dot gnu.org

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
Reduced test-case:

$ cat pr95386.ii
namespace std {
template <int __v> struct A {
  typedef bool value_type;
  constexpr operator value_type() { return __v; }
};
template <typename> struct is_lvalue_reference : A<false> {};
} // namespace std
template <class T> void fn1(T) requires !std::is_lvalue_reference<T>();
template <class T> void fn1(T);
void fn2() { fn1(fn2); }

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

* [Bug c++/95386] [10/11 Regression] ICE: in satisfaction_value, while compiling function with a requires clause since r10-3735-gcb57504a55015891
  2020-05-28 14:22 [Bug c++/95386] New: internal compiler error: in satisfaction_value, while compiling function with a requires clause jpalecek at web dot de
                   ` (3 preceding siblings ...)
  2020-05-28 15:59 ` [Bug c++/95386] [10/11 Regression] ICE: in satisfaction_value, while compiling function with a requires clause since r10-3735-gcb57504a55015891 marxin at gcc dot gnu.org
@ 2020-05-29  6:25 ` rguenth at gcc dot gnu.org
  2020-05-29  7:10 ` marxin at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-05-29  6:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.2

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Did it work with GCC 9 or why is this marked as regression?

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

* [Bug c++/95386] [10/11 Regression] ICE: in satisfaction_value, while compiling function with a requires clause since r10-3735-gcb57504a55015891
  2020-05-28 14:22 [Bug c++/95386] New: internal compiler error: in satisfaction_value, while compiling function with a requires clause jpalecek at web dot de
                   ` (4 preceding siblings ...)
  2020-05-29  6:25 ` rguenth at gcc dot gnu.org
@ 2020-05-29  7:10 ` marxin at gcc dot gnu.org
  2020-05-29 15:07 ` ppalka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-05-29  7:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |9.3.0

--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #5)
> Did it work with GCC 9 or why is this marked as regression?

Yes.

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

* [Bug c++/95386] [10/11 Regression] ICE: in satisfaction_value, while compiling function with a requires clause since r10-3735-gcb57504a55015891
  2020-05-28 14:22 [Bug c++/95386] New: internal compiler error: in satisfaction_value, while compiling function with a requires clause jpalecek at web dot de
                   ` (5 preceding siblings ...)
  2020-05-29  7:10 ` marxin at gcc dot gnu.org
@ 2020-05-29 15:07 ` ppalka at gcc dot gnu.org
  2020-05-30  1:16 ` 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-05-29 15:07 UTC (permalink / raw)
  To: gcc-bugs

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

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
                 CC|                            |ppalka at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

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

* [Bug c++/95386] [10/11 Regression] ICE: in satisfaction_value, while compiling function with a requires clause since r10-3735-gcb57504a55015891
  2020-05-28 14:22 [Bug c++/95386] New: internal compiler error: in satisfaction_value, while compiling function with a requires clause jpalecek at web dot de
                   ` (6 preceding siblings ...)
  2020-05-29 15:07 ` ppalka at gcc dot gnu.org
@ 2020-05-30  1:16 ` cvs-commit at gcc dot gnu.org
  2020-05-30  4:21 ` cvs-commit at gcc dot gnu.org
  2020-05-30  4:23 ` ppalka at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-30  1:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

commit r11-738-gaef6e234a8a78db39b4ba034cc4c100c07c294a7
Author: Patrick Palka <ppalka@redhat.com>
Date:   Fri May 29 21:12:21 2020 -0400

    c++: satisfaction value of type typedef to bool [PR95386]

    In the testcase below, the satisfaction value of fn1<int>'s constraint
    is INTEGER_CST '1' of type BOOLEAN_TYPE value_type, which is a typedef
    to the standard boolean_type_node.  But satisfaction_value expects to
    see exactly boolean_true_node or integer_one_node, which this value is
    neither, causing us to trip over the assert therein.

    This patch changes satisfaction_value to accept INTEGER_CST of any
    boolean type.

    gcc/cp/ChangeLog:

            PR c++/95386
            * constraint.cc (satisfaction_value): Accept INTEGER_CST of any
            boolean type.

    gcc/testsuite/ChangeLog:

            PR c++/95386
            * g++.dg/concepts/pr95386.C: New test.

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

* [Bug c++/95386] [10/11 Regression] ICE: in satisfaction_value, while compiling function with a requires clause since r10-3735-gcb57504a55015891
  2020-05-28 14:22 [Bug c++/95386] New: internal compiler error: in satisfaction_value, while compiling function with a requires clause jpalecek at web dot de
                   ` (7 preceding siblings ...)
  2020-05-30  1:16 ` cvs-commit at gcc dot gnu.org
@ 2020-05-30  4:21 ` cvs-commit at gcc dot gnu.org
  2020-05-30  4:23 ` ppalka at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-05-30  4:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:6632f2920f08f5b45ffd1ada7006d4591ef9b172

commit r10-8215-g6632f2920f08f5b45ffd1ada7006d4591ef9b172
Author: Patrick Palka <ppalka@redhat.com>
Date:   Fri May 29 13:09:20 2020 -0400

    c++: satisfaction value of type typedef to bool [PR95386]

    In the testcase below, the satisfaction value of fn1<int>'s constraint
    is INTEGER_CST '1' of type BOOLEAN_TYPE value_type, which is a typedef
    to the standard boolean_type_node.  But satisfaction_value expects to
    see exactly boolean_true_node or integer_one_node, which this value is
    neither, causing us to trip over the assert therein.

    This patch relaxes satisfaction_value to accept any INTEGER_CST which
    satisfies integer_zerop or integer_onep.

    gcc/cp/ChangeLog:

            PR c++/95386
            * constraint.cc (satisfaction_value): Relax to accept any
            INTEGER_CST that satisfies integer_zerop or integer_onep.

    gcc/testsuite/ChangeLog:

            PR c++/95386
            * g++.dg/concepts/pr95386.C: New test.

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

* [Bug c++/95386] [10/11 Regression] ICE: in satisfaction_value, while compiling function with a requires clause since r10-3735-gcb57504a55015891
  2020-05-28 14:22 [Bug c++/95386] New: internal compiler error: in satisfaction_value, while compiling function with a requires clause jpalecek at web dot de
                   ` (8 preceding siblings ...)
  2020-05-30  4:21 ` cvs-commit at gcc dot gnu.org
@ 2020-05-30  4:23 ` ppalka at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-05-30  4:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #9 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 10.2+.

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

end of thread, other threads:[~2020-05-30  4:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-28 14:22 [Bug c++/95386] New: internal compiler error: in satisfaction_value, while compiling function with a requires clause jpalecek at web dot de
2020-05-28 14:57 ` [Bug c++/95386] " marxin at gcc dot gnu.org
2020-05-28 15:16 ` jpalecek at web dot de
2020-05-28 15:17 ` jpalecek at web dot de
2020-05-28 15:59 ` [Bug c++/95386] [10/11 Regression] ICE: in satisfaction_value, while compiling function with a requires clause since r10-3735-gcb57504a55015891 marxin at gcc dot gnu.org
2020-05-29  6:25 ` rguenth at gcc dot gnu.org
2020-05-29  7:10 ` marxin at gcc dot gnu.org
2020-05-29 15:07 ` ppalka at gcc dot gnu.org
2020-05-30  1:16 ` cvs-commit at gcc dot gnu.org
2020-05-30  4:21 ` cvs-commit at gcc dot gnu.org
2020-05-30  4:23 ` 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).