public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103631] New: Internal compiler error in C++20 class NTTP + concept
@ 2021-12-09 13:51 winmikedows at hotmail dot com
  2021-12-09 13:56 ` [Bug c++/103631] [12 Regression] ICE in C++20 class NTTP + concept since r12-100-gbcd77b7b9f35bd5b marxin at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: winmikedows at hotmail dot com @ 2021-12-09 13:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103631
           Summary: Internal compiler error in C++20 class NTTP + concept
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: winmikedows at hotmail dot com
  Target Milestone: ---

I am using GCC 11.2.0 on macOS 10.15.7, and it throw ICE on the following code
snippet:
```cpp
// value_specialize, work with NTTP only
template<typename Target, template<auto> typename T>
inline constexpr bool is_specialize_value_v = false;
template<template<auto> typename T, auto Ts>
inline constexpr bool is_specialize_value_v<T<Ts>, T> = true;
template<typename Target, template<auto> typename T>
concept specialize_value = is_specialize_value_v<Target, T>;

template<int i> struct Test{};

template<Test str>
struct A
{
    template<typename T> requires specialize_value<T, A>
    int fun(T&&)
    {
        return 1;
    }
};
```

The full compiler output of my invocation `g++-11 -v -save-temps -O0 -std=c++20
-Wall -Wextra -o code code.cpp` is (The intermediate file code.ii is identical
to code.cpp except some #-directives since I'm not using the preprocessor, and
code.s is empty, so I will not include them)
```
Using built-in specs.
COLLECT_GCC=g++-11
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/11.2.0_3/libexec/gcc/x86_64-apple-darwin19/11/lto-wrapper
Target: x86_64-apple-darwin19
Configured with: ../configure --prefix=/usr/local/Cellar/gcc/11.2.0_3
--libdir=/usr/local/Cellar/gcc/11.2.0_3/lib/gcc/11 --disable-nls
--enable-checking=release --with-gcc-major-version-only
--enable-languages=c,c++,objc,obj-c++,fortran,d --program-suffix=-11
--with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr
--with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl
--with-zstd=/usr/local/opt/zstd --with-pkgversion='Homebrew GCC 11.2.0_3'
--with-bugurl=https://github.com/Homebrew/homebrew-core/issues
--enable-libphobos --build=x86_64-apple-darwin19 --with-system-zlib
--disable-multilib --with-native-system-header-dir=/usr/include
--with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (Homebrew GCC 11.2.0_3)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O0' '-std=c++20' '-Wall' '-Wextra'
'-o' 'code' '-mmacosx-version-min=10.15.0' '-asm_macosx_version_min=10.15'
'-shared-libgcc' '-mtune=core2'
 /usr/local/Cellar/gcc/11.2.0_3/libexec/gcc/x86_64-apple-darwin19/11/cc1plus -E
-quiet -v -D__DYNAMIC__ code.cpp -fPIC -mmacosx-version-min=10.15.0
-mtune=core2 -std=c++20 -Wall -Wextra -O0 -fpch-preprocess -o code.ii
ignoring nonexistent directory
"/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/local/include"
ignoring nonexistent directory
"/usr/local/Cellar/gcc/11.2.0_3/lib/gcc/11/gcc/x86_64-apple-darwin19/11/../../../../../../x86_64-apple-darwin19/include"
ignoring nonexistent directory
"/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:

/usr/local/Cellar/gcc/11.2.0_3/lib/gcc/11/gcc/x86_64-apple-darwin19/11/../../../../../../include/c++/11

/usr/local/Cellar/gcc/11.2.0_3/lib/gcc/11/gcc/x86_64-apple-darwin19/11/../../../../../../include/c++/11/x86_64-apple-darwin19

/usr/local/Cellar/gcc/11.2.0_3/lib/gcc/11/gcc/x86_64-apple-darwin19/11/../../../../../../include/c++/11/backward
 /usr/local/Cellar/gcc/11.2.0_3/lib/gcc/11/gcc/x86_64-apple-darwin19/11/include

/usr/local/Cellar/gcc/11.2.0_3/lib/gcc/11/gcc/x86_64-apple-darwin19/11/include-fixed
 /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include

/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O0' '-std=c++20' '-Wall' '-Wextra'
'-o' 'code' '-mmacosx-version-min=10.15.0' '-asm_macosx_version_min=10.15'
'-shared-libgcc' '-mtune=core2'
 /usr/local/Cellar/gcc/11.2.0_3/libexec/gcc/x86_64-apple-darwin19/11/cc1plus
-fpreprocessed code.ii -fPIC -quiet -dumpbase code.cpp -dumpbase-ext .cpp
-mmacosx-version-min=10.15.0 -mtune=core2 -O0 -Wall -Wextra -std=c++20 -version
-o code.s
GNU C++20 (Homebrew GCC 11.2.0_3) version 11.2.0 (x86_64-apple-darwin19)
        compiled by GNU C version 11.2.0, GMP version 6.2.1, MPFR version
4.1.0, MPC version 1.2.1, isl version isl-0.24-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++20 (Homebrew GCC 11.2.0_3) version 11.2.0 (x86_64-apple-darwin19)
        compiled by GNU C version 11.2.0, GMP version 6.2.1, MPFR version
4.1.0, MPC version 1.2.1, isl version isl-0.24-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: c8ad714ab17745b5fe60039e428beb58
code.cpp:14:35: internal compiler error: in unify, at cp/pt.c:23587
   14 |     template<typename T> requires specialize_value<T, A>
      |                                   ^~~~~~~~~~~~~~~~~~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://github.com/Homebrew/homebrew-core/issues> for instructions.
```
I can also reproduce the behavior in godbolt on GCC trunk:
https://godbolt.org/z/bxeYvdezP, and clang++ pass with the code, so I think
this code is valid.

BTW, I also tried altering the code, and found that if you do any one of the
four things below, GCC will pass with it.
1. change line 6 to use `template<int>` instead of `template<auto>`
2. change line 9 to remove template and just use `struct Test{}`
3. change line 11 to use any other type of NTTP (like `int`)
4. change line 14 to use `is_specialize_value_v` instead of `specialize_value`
So probably this ICE is just the result of code complexity.

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

* [Bug c++/103631] [12 Regression] ICE in C++20 class NTTP + concept since r12-100-gbcd77b7b9f35bd5b
  2021-12-09 13:51 [Bug c++/103631] New: Internal compiler error in C++20 class NTTP + concept winmikedows at hotmail dot com
@ 2021-12-09 13:56 ` marxin at gcc dot gnu.org
  2021-12-09 14:01 ` [Bug c++/103631] [11/12 " pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-12-09 13:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Target Milestone|---                         |12.0
            Summary|Internal compiler error in  |[12 Regression] ICE in
                   |C++20 class NTTP + concept  |C++20 class NTTP + concept
                   |                            |since
                   |                            |r12-100-gbcd77b7b9f35bd5b
   Last reconfirmed|                            |2021-12-09
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |ppalka at gcc dot gnu.org

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
I think it started with r12-100-gbcd77b7b9f35bd5b.

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

* [Bug c++/103631] [11/12 Regression] ICE in C++20 class NTTP + concept since r12-100-gbcd77b7b9f35bd5b
  2021-12-09 13:51 [Bug c++/103631] New: Internal compiler error in C++20 class NTTP + concept winmikedows at hotmail dot com
  2021-12-09 13:56 ` [Bug c++/103631] [12 Regression] ICE in C++20 class NTTP + concept since r12-100-gbcd77b7b9f35bd5b marxin at gcc dot gnu.org
@ 2021-12-09 14:01 ` pinskia at gcc dot gnu.org
  2022-01-04  9:05 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-09 14:01 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|12.0                        |11.3
      Known to fail|                            |11.2.0
      Known to work|                            |11.1.0

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

* [Bug c++/103631] [11/12 Regression] ICE in C++20 class NTTP + concept since r12-100-gbcd77b7b9f35bd5b
  2021-12-09 13:51 [Bug c++/103631] New: Internal compiler error in C++20 class NTTP + concept winmikedows at hotmail dot com
  2021-12-09 13:56 ` [Bug c++/103631] [12 Regression] ICE in C++20 class NTTP + concept since r12-100-gbcd77b7b9f35bd5b marxin at gcc dot gnu.org
  2021-12-09 14:01 ` [Bug c++/103631] [11/12 " pinskia at gcc dot gnu.org
@ 2022-01-04  9:05 ` rguenth at gcc dot gnu.org
  2022-01-20 18:12 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-04  9:05 UTC (permalink / raw)
  To: gcc-bugs

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

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++/103631] [11/12 Regression] ICE in C++20 class NTTP + concept since r12-100-gbcd77b7b9f35bd5b
  2021-12-09 13:51 [Bug c++/103631] New: Internal compiler error in C++20 class NTTP + concept winmikedows at hotmail dot com
                   ` (2 preceding siblings ...)
  2022-01-04  9:05 ` rguenth at gcc dot gnu.org
@ 2022-01-20 18:12 ` cvs-commit at gcc dot gnu.org
  2022-01-20 18:15 ` [Bug c++/103631] [11 " ppalka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-20 18:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 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:2f34d7ef3d026cf7109b6e6bb2eca14c840e7c71

commit r12-6777-g2f34d7ef3d026cf7109b6e6bb2eca14c840e7c71
Author: Patrick Palka <ppalka@redhat.com>
Date:   Thu Jan 20 13:12:16 2022 -0500

    c++: add testcase for recently fixed PR [PR103631]

    We accept this testcase after r12-6773.

            PR c++/103631

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/nontype-class51.C: New test.

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

* [Bug c++/103631] [11 Regression] ICE in C++20 class NTTP + concept since r12-100-gbcd77b7b9f35bd5b
  2021-12-09 13:51 [Bug c++/103631] New: Internal compiler error in C++20 class NTTP + concept winmikedows at hotmail dot com
                   ` (3 preceding siblings ...)
  2022-01-20 18:12 ` cvs-commit at gcc dot gnu.org
@ 2022-01-20 18:15 ` ppalka at gcc dot gnu.org
  2022-01-20 18:16 ` ppalka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-01-20 18:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11/12 Regression] ICE in   |[11 Regression] ICE in
                   |C++20 class NTTP + concept  |C++20 class NTTP + concept
                   |since                       |since
                   |r12-100-gbcd77b7b9f35bd5b   |r12-100-gbcd77b7b9f35bd5b

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Incidentally fixed for GCC 12 so far, by r12-6773.

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

* [Bug c++/103631] [11 Regression] ICE in C++20 class NTTP + concept since r12-100-gbcd77b7b9f35bd5b
  2021-12-09 13:51 [Bug c++/103631] New: Internal compiler error in C++20 class NTTP + concept winmikedows at hotmail dot com
                   ` (4 preceding siblings ...)
  2022-01-20 18:15 ` [Bug c++/103631] [11 " ppalka at gcc dot gnu.org
@ 2022-01-20 18:16 ` ppalka at gcc dot gnu.org
  2022-04-21  7:50 ` rguenth at gcc dot gnu.org
  2023-05-21 15:13 ` ppalka at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-01-20 18:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/103631] [11 Regression] ICE in C++20 class NTTP + concept since r12-100-gbcd77b7b9f35bd5b
  2021-12-09 13:51 [Bug c++/103631] New: Internal compiler error in C++20 class NTTP + concept winmikedows at hotmail dot com
                   ` (5 preceding siblings ...)
  2022-01-20 18:16 ` ppalka at gcc dot gnu.org
@ 2022-04-21  7:50 ` rguenth at gcc dot gnu.org
  2023-05-21 15:13 ` ppalka at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-04-21  7:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.3                        |11.4

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11.3 is being released, retargeting bugs to GCC 11.4.

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

* [Bug c++/103631] [11 Regression] ICE in C++20 class NTTP + concept since r12-100-gbcd77b7b9f35bd5b
  2021-12-09 13:51 [Bug c++/103631] New: Internal compiler error in C++20 class NTTP + concept winmikedows at hotmail dot com
                   ` (6 preceding siblings ...)
  2022-04-21  7:50 ` rguenth at gcc dot gnu.org
@ 2023-05-21 15:13 ` 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:13 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 12+ (r12-6773 is not being backported).

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

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

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-09 13:51 [Bug c++/103631] New: Internal compiler error in C++20 class NTTP + concept winmikedows at hotmail dot com
2021-12-09 13:56 ` [Bug c++/103631] [12 Regression] ICE in C++20 class NTTP + concept since r12-100-gbcd77b7b9f35bd5b marxin at gcc dot gnu.org
2021-12-09 14:01 ` [Bug c++/103631] [11/12 " pinskia at gcc dot gnu.org
2022-01-04  9:05 ` rguenth at gcc dot gnu.org
2022-01-20 18:12 ` cvs-commit at gcc dot gnu.org
2022-01-20 18:15 ` [Bug c++/103631] [11 " ppalka at gcc dot gnu.org
2022-01-20 18:16 ` ppalka at gcc dot gnu.org
2022-04-21  7:50 ` rguenth at gcc dot gnu.org
2023-05-21 15:13 ` 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).