public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "northon_patrick3 at yahoo dot ca" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/105797] New: Internal compiler error: Segmentation fault ( fn_type_unification -> satisfaction_cache::satisfaction_cache -> iterative_hash_template_arg )
Date: Tue, 31 May 2022 23:23:21 +0000	[thread overview]
Message-ID: <bug-105797-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 105797
           Summary: Internal compiler error: Segmentation fault (
                    fn_type_unification ->
                    satisfaction_cache::satisfaction_cache ->
                    iterative_hash_template_arg )
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: northon_patrick3 at yahoo dot ca
  Target Milestone: ---

Created attachment 53061
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53061&action=edit
Result from -freport-bug

The code:
```
#include <type_traits>
#include <concepts>

template <typename T_>
struct AStruct
{
        using value_type = T_;
};

template <typename T_>
constexpr auto fc1(AStruct<T_> v)
        requires std::integral<typename std::decay_t<decltype(v)>::value_type>
        //requires std::integral<T_>
        { return v; }

template <typename T1_, typename T2_>
constexpr auto fc2(AStruct<T1_> v1, AStruct<T2_> v2)
        requires std::integral<typename std::decay_t<decltype(v1)>::value_type>
        { return v1; }

void test(AStruct<int> v1, AStruct<int> v2)
        { fc2(v1, v2); }

void test2(AStruct<int> v)
        { fc1(v); }
```


The command line:

```
g++ -std=c++20 test.cpp
```


The error:

```
test.cpp: In substitution of ‘template<class T_> constexpr auto
fc1(AStruct<T_>) requires  integral<typename
std::decay<decltype(v)>::type::value_type> [with T_ = int]’:
test.cpp:25:7:   required from here
test.cpp:25:14: internal compiler error: Segmentation fault
   25 |         { fc1(v); }
      |           ~~~^~~
0x1ac4724 internal_error(char const*, ...)
        ???:0
0x7f1693 iterative_hash_template_arg(tree_node*, unsigned int)
        ???:0
0x6bf9da satisfaction_cache::satisfaction_cache(tree_node*, tree_node*,
sat_info)
        ???:0
0x81bbd4 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
        ???:0
0x69d051 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ???:0
0x836c31 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ???:0
0x7eaa63 c_parse_file()
        ???:0
0x914adb c_common_parse_file()
        ???:0
```


It happens from GCC 11.1 and onward to GCC 13 at commit
271072ca259dd285e7723d9bf6da7295e4090dfa.

GCC is configured with:

```
configure --prefix=/opt/pat-gcc --libdir=/opt/pat-gcc/lib
--libexecdir=/opt/pat-gcc/lib --enable-languages=c,c++,lto --with-isl
--with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit
--enable-cet=auto --enable-checking=release --enable-clocale=gnu
--enable-default-pie --enable-default-ssp --enable-gnu-indirect-function
--enable-gnu-unique-object --enable-install-libiberty --enable-linker-build-id
--enable-lto --enable-multilib --enable-plugin --enable-shared
--enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-libunwind-exceptions --disable-werror
gdc_include_dir=/opt/pat-gcc/include/dlang/gdc
```


If I comment out either one of test or test2 functions, it compiles. If I
change either one of the requires clause to use T_ or T1_ instead of decltype,
it compiles. If I change either one of fc1 or fc2 to use auto instead of a
template<> clause, it compiles. So it seem to crash at a very specific
condition.

             reply	other threads:[~2022-05-31 23:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-31 23:23 northon_patrick3 at yahoo dot ca [this message]
2022-05-31 23:31 ` [Bug c++/105797] [11/12/13 Regression] " mpolacek at gcc dot gnu.org
2022-05-31 23:45 ` mpolacek at gcc dot gnu.org
2022-06-01 13:17 ` ppalka at gcc dot gnu.org
2022-06-03 13:09 ` cvs-commit at gcc dot gnu.org
2022-06-03 13:32 ` [Bug c++/105797] [11/12 " ppalka at gcc dot gnu.org
2023-05-29 10:07 ` jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-105797-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).