Bug 69001 - g++ --std=c++17 -g internal compiler error: in create_tmp_var, at gimple-expr.c:519
Summary: g++ --std=c++17 -g internal compiler error: in create_tmp_var, at gimple-expr...
Status: RESOLVED DUPLICATE of bug 77739
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 5.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2015-12-21 12:45 UTC by David Kredba
Modified: 2017-01-10 10:31 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-12-21 00:00:00


Attachments
Original source file from Gentoo Bugzilla (807 bytes, text/x-csrc)
2015-12-21 12:45 UTC, David Kredba
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Kredba 2015-12-21 12:45:40 UTC
Created attachment 37094 [details]
Original source file from Gentoo Bugzilla

Found by Hunter Allen and reported at the Gentoo Bugzilla
as https://bugs.gentoo.org/show_bug.cgi?id=568908.

As requested in PR68761 by Jakub Jelinek I am opening this standalone report.


Creduced case:

namespace std {
inline namespace __cxx11 {}
template <typename> class allocator;
namespace __cxx11 {
template <typename _CharT, typename = _CharT, typename = allocator<_CharT>>
class basic_string;
typedef basic_string<char> string;
}
template <typename> class allocator {
public:
  template <typename> struct rebind { typedef allocator other; };
};
template <typename _Alloc, typename _Tp> struct __alloctr_rebind {
  typedef typename _Alloc::template rebind<_Tp>::other __type;
};
template <typename _Alloc> struct allocator_traits {
  typedef decltype(0) pointer;
  template <typename _Tp>
  using rebind_alloc = typename __alloctr_rebind<_Alloc, _Tp>::__type;
};
}

namespace __gnu_cxx {
template <typename _Alloc>
struct __alloc_traits : std::allocator_traits<_Alloc> {
  typedef std::allocator_traits<_Alloc> _Base_type;
  template <typename _Tp> struct rebind {
    typedef typename _Base_type::template rebind_alloc<_Tp> other;
  };
};
}
namespace std {
namespace __cxx11 {
template <typename _CharT, typename, typename _Alloc> class basic_string {
  typedef
      typename __gnu_cxx::__alloc_traits<_Alloc>::template rebind<_CharT>::other
          _Char_alloc_type;
  typedef __gnu_cxx::__alloc_traits<_Char_alloc_type> _Alloc_traits;

public:
  typedef _Char_alloc_type allocator_type;
  typedef typename _Alloc_traits::pointer pointer;
  struct _Alloc_hider {
    _Alloc_hider(pointer, _Alloc);
  } _M_dataplus;
  pointer _M_local_data();
  allocator_type _M_get_allocator();
  basic_string(const basic_string &)
      : _M_dataplus(_M_local_data(), _M_get_allocator()) {}
  basic_string(_CharT *, _Alloc __a = _Alloc())
      : _M_dataplus(_M_local_data(), __a) {}
};
}
}

auto vglambda = [](auto printer) {
  return [=](auto &&... ts) { return [=] { printer(ts...); }; };
};
main()

{
  vglambda([](auto, auto, auto) {})(std::string(""), "", "");
}
Comment 1 Jakub Jelinek 2015-12-21 13:00:42 UTC
What is going on is that cp_genericize_r first converts changes a by-reference RESULT_DECL into INDIRECT_REF of it, and then (dunno if because of tree sharing or some constexpr stuff) at some point that IL is passed again to cp_genericize_r again and again performs the same change, so we in the end have two nested INDIRECT_REFs and the types don't match any longer.
Comment 2 Jakub Jelinek 2017-01-10 10:31:16 UTC
Fixed with r242766 and r243407 for 6.x.

*** This bug has been marked as a duplicate of bug 77739 ***