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

            Bug ID: 96591
           Summary: ICE with -flto=auto and -O1: tree code ‘typename_type’
                    is not supported in LTO streams
           Product: gcc
           Version: 10.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc-bugs at marehr dot dialup.fu-berlin.de
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Hi gcc-team,

I'm not sure if this is the right component.

The following code:

```c++
template <typename scalar_t, unsigned length>
struct builtin_simd
{
  using type [[gnu::vector_size(sizeof(scalar_t) * length)]] = scalar_t;
};

struct simd_traits
{
  using scalar_type = int;

  template <typename new_scalar_type>
  using rebind = typename builtin_simd<new_scalar_type, 1>::type;
};

template <typename simd_t>
constexpr simd_t fill(typename simd_traits::scalar_type const scalar)
{
  return simd_t{scalar};
}

class Test
{
    using score_type = typename builtin_simd<int, 1>::type;
    score_type data[1]{fill<score_type>(8)};
};

struct TestFactoryBase
{
  virtual Test *CreateTest() = 0;
};

template <class TestClass>
struct TestFactoryImpl : public TestFactoryBase
{
  Test *CreateTest() override { return new TestClass; }
};

void MakeAndRegisterTestInfo(TestFactoryBase *factory);

int main() {
  MakeAndRegisterTestInfo(new TestFactoryImpl<Test>);
}
```

https://godbolt.org/z/55xTod

produces with

> > g++ -O1 -flto=auto ice.cpp
> during IPA pass: pure-const
> ice.cpp:42:1: internal compiler error: tree code ‘typename_type’ is not 
> supported in LTO streams
>    42 | }
>       | ^
> Please submit a full bug report, with preprocessed source if appropriate.
> See <https://bugs.archlinux.org/> for instructions.

that error.

Some notes:
* removing "using rebind = typename builtin_simd<new_scalar_type, 1>::type;" or
* removing "constexpr" from constexpr simd_t fill(typename
simd_traits::scalar_type const scalar) 
will make it compile.

Thank you!

Reply via email to