[Bug c++/93048] New: ICE in verify_gimple
pilarlatiesa at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Dec 23 09:23:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93048
Bug ID: 93048
Summary: ICE in verify_gimple
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: pilarlatiesa at gmail dot com
Target Milestone: ---
The (valid) code bellow trigger an ICE:
In member function 'TCoefs<d, r> TExprDiv<d, r, T<d, 1, TRest ...>
>::CalcCoefs(std::size_t) const [with long unsigned int d = 2; long unsigned
int r = 1; TRest = {}; T = TCampo]':
<source>:79:1: error: incorrect sharing of tree nodes
79 | TExprDiv<d, r, T<d, 1u, TRest...>>::CalcCoefs(std::size_t) const
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*<retval>
<retval>->aP = aP;
during GIMPLE pass: cfg
<source>:79:1: internal compiler error: verify_gimple failed
Started ICEing with 10.0.0 20191222 (x86_64-pc-linux-gnu). It compiled fine
with 10.0.0 20191126.
I could not reduce the testcase any further. Sorry.
#include <cstddef>
#include <valarray>
template<std::size_t d, std::size_t r1>
struct TTensor
{};
template<std::size_t d, std::size_t r>
struct TCoefs
{
double aP;
std::valarray<double> aF;
TTensor<d, r> b;
};
template<typename T>
class TExprBase {};
template<std::size_t d, std::size_t r1, typename... TRest,
template<std::size_t, std::size_t, typename...> typename T>
class TExprBase<T<d, r1, TRest...>>
{
public:
decltype(auto)
CalcCoefs(std::size_t i) const
{ return static_cast<T<d, r1, TRest...> const *>(this)->CalcCoefs(i); }
operator T<d, r1, TRest...> const &() const
{ return static_cast<T<d, r1, TRest...> const &>(*this); }
};
template<std::size_t d, std::size_t r, typename T, typename U, typename TOp>
class TBinExpr: public TExprBase<TBinExpr<d, r, T, U, TOp>>
{
private:
T const &lhs;
U const &rhs;
[[no_unique_address]] TOp const Op = {};
public:
TBinExpr() = delete;
TBinExpr(T const &lhs_, U const &rhs_) :
lhs(lhs_), rhs(rhs_) {}
decltype(auto)
CalcCoefs(std::size_t i) const
{ return Op(lhs.CalcCoefs(i), rhs.CalcCoefs(i)); }
};
template<std::size_t d, std::size_t r>
class TCampo : public TExprBase<TCampo<d, r>> {};
template<std::size_t d, std::size_t r, typename T = void>
class TExprDiv {};
template<std::size_t d, std::size_t r, typename... TRest,
template<std::size_t, std::size_t, typename...> typename T>
class TExprDiv<d, r, T<d, 1u, TRest...>> : public TExprBase<TExprDiv<d, r,
T<d, 1u, TRest...>>>
{
private:
TCampo<d, r> const &U;
TCampo<d, r> const &φ;
public:
TExprDiv(TExprBase<T<d, 1u, TRest...>> const &U_, TCampo<d, r> const
&φ_):
U(U_), φ(φ_) {}
TCoefs<d, r>
CalcCoefs(std::size_t) const;
};
template<std::size_t d, std::size_t r, typename... TRest,
template<std::size_t, std::size_t, typename...> typename T>
TCoefs<d, r>
TExprDiv<d, r, T<d, 1u, TRest...>>::CalcCoefs(std::size_t) const
{
double aP = 0.0;
std::valarray<double> aF;
TTensor<d, r> b = {};
return {aP, aF, b};
}
template<std::size_t d, std::size_t r, typename... TRest,
template<std::size_t, std::size_t, typename...> typename T>
TExprDiv<d, r, T<d, 1u, TRest...>>
div(TExprBase<T<d, 1u, TRest...>> const &U, TCampo<d, r> const &φ)
{ return {U, φ}; }
int main()
{
TCampo<2u, 1u> U;
auto bar = div(U, U).CalcCoefs(0);
return 0;
}
More information about the Gcc-bugs
mailing list