public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104788] New: ICE
@ 2022-03-04 16:24 raffael at casagrande dot ch
2022-03-04 16:32 ` [Bug c++/104788] ICE mpolacek at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: raffael at casagrande dot ch @ 2022-03-04 16:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104788
Bug ID: 104788
Summary: ICE
Product: gcc
Version: 11.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: raffael at casagrande dot ch
Target Milestone: ---
The following simple program produces an internal compiler error when compiled
with "-std=c++20" (problem seems to be fixed in current trunk 12.0!):
#include <algorithm>
#include <vector>
template <class MESH_FACTORY>
class OpenFoamReader {
public:
OpenFoamReader() {
auto z = []() {
struct Connection {
std::uint32_t end_point;
auto operator<=>(const Connection&) const noexcept ->
std::strong_ordering = default;
};
std::vector<Connection> connections;
// sort connections
std::ranges::sort(connections);
};
}
};
int main() {
OpenFoamReader<int> reader;
}
================================================
Error message:
================================================
In file included from
/opt/compiler-explorer/gcc-11.2.0/include/c++/11.2.0/bits/move.h:57,
from
/opt/compiler-explorer/gcc-11.2.0/include/c++/11.2.0/bits/stl_pair.h:59,
from
/opt/compiler-explorer/gcc-11.2.0/include/c++/11.2.0/utility:70,
from
/opt/compiler-explorer/gcc-11.2.0/include/c++/11.2.0/algorithm:60,
from <source>:1:
/opt/compiler-explorer/gcc-11.2.0/include/c++/11.2.0/type_traits: In
instantiation of 'constexpr const bool std::is_invocable_v<std::ranges::less&,
OpenFoamReader<int>::OpenFoamReader()::<lambda()>::Connection&,
OpenFoamReader<int>::OpenFoamReader()::<lambda()>::Connection&>':
/opt/compiler-explorer/gcc-11.2.0/include/c++/11.2.0/concepts:338:25:
required by substitution of 'template<class _Range, class _Comp, class _Proj>
requires (random_access_range<_Range>) &&
(sortable<decltype(std::ranges::__cust_access::__begin((declval<_Container&>)())),
_Comp, _Proj>) constexpr std::ranges::borrowed_iterator_t<_Range>
std::ranges::__sort_fn::operator()(_Range&&, _Comp, _Proj) const [with _Range =
std::vector<OpenFoamReader<int>::OpenFoamReader()::<lambda()>::Connection,
std::allocator<OpenFoamReader<int>::OpenFoamReader()::<lambda()>::Connection>
>&; _Comp = std::ranges::less; _Proj = std::identity]'
<source>:16:24: required from 'OpenFoamReader<MESH_FACTORY>::OpenFoamReader()
[with MESH_FACTORY = int]'
<source>:22:25: required from here
/opt/compiler-explorer/gcc-11.2.0/include/c++/11.2.0/type_traits:3001:27:
internal compiler error: Segmentation fault
3001 | inline constexpr bool is_invocable_v = is_invocable<_Fn,
_Args...>::value;
| ^~~~~~~~~~~~~~
0x1786229 internal_error(char const*, ...)
???:0
0x806d30 stmts_are_full_exprs_p()
???:0
0x700b81 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
???:0
0x7e02f3 instantiate_decl(tree_node*, bool, bool)
???:0
0x70a613 maybe_instantiate_decl(tree_node*)
???:0
0x7f4881 lookup_and_finish_template_variable(tree_node*, tree_node*, int)
???:0
0x6c532a constraints_satisfied_p(tree_node*, tree_node*)
???:0
0x7f7487 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
???:0
0x695371 build_op_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int)
???:0
0x80ae32 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
???:0
0x7f2e86 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
???:0
0x7e02f3 instantiate_decl(tree_node*, bool, bool)
???:0
0x7fb69b instantiate_pending_templates(int)
???:0
0x70cd4d c_parse_final_cleanups()
???:0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/104788] ICE
2022-03-04 16:24 [Bug c++/104788] New: ICE raffael at casagrande dot ch
@ 2022-03-04 16:32 ` mpolacek at gcc dot gnu.org
2022-03-07 11:58 ` [Bug c++/104788] ICE in stmts_are_full_exprs_p marxin at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-03-04 16:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104788
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2022-03-04
Ever confirmed|0 |1
CC| |jason at gcc dot gnu.org,
| |mpolacek at gcc dot gnu.org
Status|UNCONFIRMED |NEW
Keywords| |ice-on-valid-code
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed on trunk by r12-6327-gce0ab8fb46f07b. We probably don't want to backport
that one though.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/104788] ICE in stmts_are_full_exprs_p
2022-03-04 16:24 [Bug c++/104788] New: ICE raffael at casagrande dot ch
2022-03-04 16:32 ` [Bug c++/104788] ICE mpolacek at gcc dot gnu.org
@ 2022-03-07 11:58 ` marxin at gcc dot gnu.org
2024-04-14 4:41 ` pinskia at gcc dot gnu.org
2024-04-14 4:57 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-03-07 11:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104788
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|needs-reduction |
CC| |marxin at gcc dot gnu.org
--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Reduced to:
cat pr104788.ii
template <int __v>
struct integral_constant {
static constexpr int value = __v;
};
using true_type = integral_constant<true>;
using false_type = integral_constant<false>;
template <typename _Tp>
struct __success_type {
typedef _Tp type;
};
template <typename>
using __void_t = void;
template <typename _Tp, typename _Up = _Tp &&>
_Up __declval(int);
template <typename _Tp>
auto declval() -> decltype(__declval<_Tp>(0));
template <typename _Tp>
struct remove_cv {
using type = _Tp;
};
template <bool, bool, typename...>
struct __result_of_impl;
struct __result_of_other_impl {
template <typename _Fn, typename... _Args>
static __success_type<decltype(_Fn()(_Args()...))> _S_test(int);
};
template <typename _Functor, typename... _ArgTypes>
struct __result_of_impl<false, false, _Functor, _ArgTypes...>
: __result_of_other_impl {
typedef decltype(_S_test<_Functor, _ArgTypes...>(0)) type;
};
template <typename _Functor, typename... _ArgTypes>
struct __invoke_result : __result_of_impl<false_type::value, false_type::value,
_Functor, _ArgTypes...>::type {};
template <typename _Default>
struct __detector {
using type = _Default;
};
template <typename _Default, template <typename> class>
using __detected_or = __detector<_Default>;
template <typename _Default, template <typename> class _Op>
using __detected_or_t = __detected_or<_Default, _Op>::type;
template <typename, typename, typename = void>
struct __is_invocable_impl;
template <typename _Result, typename _Ret>
struct __is_invocable_impl<_Result, _Ret, __void_t<typename _Result::type>>
: true_type {};
template <typename _Fn, typename... _Args>
using invoke_result_t = __invoke_result<_Fn, _Args...>::type;
template <typename _Fn, typename... _ArgTypes>
struct is_invocable
: __is_invocable_impl<__invoke_result<_Fn, _ArgTypes...>, void> {};
template <typename _Tp, typename _Up>
constexpr bool is_same_v = __is_same(_Tp, _Up);
template <typename _Fn, typename... _Args>
constexpr bool is_invocable_v = is_invocable<_Fn, _Args...>::value;
template <typename _Tp>
using remove_cvref_t = remove_cv<_Tp>::type;
template <typename, typename _Yp>
using __cond_res = decltype(declval<_Yp()>()());
template <typename...>
struct common_reference;
template <typename... _Tp>
using common_reference_t = common_reference<_Tp...>::type;
template <typename _Tp1, typename _Tp2>
struct common_reference<_Tp1, _Tp2> {
using type = __cond_res<int, _Tp2>;
};
namespace __detail {
template <typename _Tp, typename _Up>
concept __same_as = is_same_v<_Tp, _Up>;
}
template <typename _Tp, typename _Up>
concept same_as = __detail::__same_as<_Up, _Tp>;
template <typename _Tp, typename _Up>
concept common_reference_with =
same_as<common_reference_t<_Tp, _Up>, common_reference_t<_Tp, _Up>>;
namespace __detail {
template <typename _Tp>
using __cref = _Tp;
template <typename _Tp, typename _Up>
concept __weakly_eq_cmp_with = requires(_Tp __t, _Up __u) {
__u != __t;
};
} // namespace __detail
template <typename _Tp>
concept equality_comparable = __detail::__weakly_eq_cmp_with<_Tp, _Tp>;
template <typename _Tp, typename _Up>
concept equality_comparable_with =
common_reference_with<__detail::__cref<_Tp>, __detail::__cref<_Up>> &&
equality_comparable<
common_reference_t<__detail::__cref<_Tp>, __detail::__cref<_Up>>>;
template <typename _Tp, typename _Up>
concept totally_ordered_with = equality_comparable_with<
_Tp, common_reference_t<__detail::__cref<_Tp>, __detail::__cref<_Up>>>;
template <typename _Fn, typename... _Args>
concept invocable = is_invocable_v<_Fn, _Args...>;
template <typename _Fn, typename... _Args>
concept regular_invocable = invocable<_Fn, _Args...>;
template <typename _Fn, typename... _Args>
concept predicate = regular_invocable<_Fn, _Args...>;
template <typename _Rel, typename _Tp, typename _Up>
concept relation = predicate<_Rel, _Up, _Tp>;
template <typename _Rel, typename _Tp, typename _Up>
concept strict_weak_order = relation<_Rel, _Tp, _Up>;
template <typename>
struct iterator_traits;
struct identity {
template <typename _Tp>
_Tp operator()(_Tp);
};
struct less {
template <typename _Tp, typename _Up>
requires totally_ordered_with<_Tp, _Up>
bool operator()(_Tp, _Up);
};
namespace __detail {
template <typename _Tp>
concept __dereferenceable = requires(_Tp __t) {
__t;
};
} // namespace __detail
template <__detail::__dereferenceable _Tp>
using iter_reference_t = decltype(*_Tp());
namespace __detail {
template <typename _Tp>
using __iter_value_t = _Tp ::value_type;
}
template <typename _Tp>
using iter_value_t = __detail::__iter_value_t<_Tp>;
namespace __detail {
template <typename _In>
concept __indirectly_readable_impl = common_reference_with<_In, _In>;
}
template <typename _In>
concept indirectly_readable = __detail::__indirectly_readable_impl<_In>;
template <indirectly_readable _Tp>
using iter_common_reference_t = common_reference_t<_Tp, iter_value_t<_Tp>>;
template <typename _Iter>
concept random_access_iterator = requires(_Iter __n) {
__n;
};
template <typename _Fn, typename _Iter>
concept indirectly_regular_unary_invocable =
common_reference_with<invoke_result_t<_Fn, _Iter>,
invoke_result_t<_Fn, _Iter>>;
template <typename _Fn, typename _I1, typename _I2 = _I1>
concept indirect_strict_weak_order =
strict_weak_order<_Fn, iter_common_reference_t<_I1>, _I2>;
template <typename _Fn, typename... _Is>
using indirect_result_t = invoke_result_t<_Fn, iter_reference_t<_Is>...>;
template <indirectly_readable _Iter,
indirectly_regular_unary_invocable<_Iter> _Proj>
struct projected {
using value_type = remove_cvref_t<indirect_result_t<_Proj, _Iter>>;
};
template <typename _Iter, typename _Rel, typename _Proj = identity>
concept sortable = indirect_strict_weak_order<_Rel, projected<_Iter, _Proj>>;
namespace ranges::__cust_access {
template <typename _Tp>
auto __begin(_Tp __t) {
return __t.begin();
}
} // namespace ranges::__cust_access
namespace __detail {
template <typename _Tp>
using __range_iter_t = decltype(ranges::__cust_access::__begin(_Tp()));
}
template <typename _Tp>
struct iterator_traits<_Tp *> {
using reference = _Tp;
};
template <typename _Iterator>
struct __normal_iterator {
iterator_traits<_Iterator>::reference operator*();
};
template <typename _Tp>
struct allocator {
typedef _Tp value_type;
};
struct __allocator_traits_base {
template <typename _Tp>
using __pointer = _Tp;
};
template <typename _Alloc>
struct allocator_traits : __allocator_traits_base {
typedef _Alloc::value_type value_type;
using pointer = __detected_or_t<value_type *, __pointer>;
};
template <typename _Alloc>
struct __alloc_traits {
struct rebind {
typedef allocator_traits<_Alloc> other;
};
};
namespace ranges {
template <typename _Tp>
using iterator_t = __detail::__range_iter_t<_Tp>;
template <typename _Tp>
concept random_access_range = random_access_iterator<_Tp>;
struct {
template <random_access_range _Range, typename _Comp = less>
requires sortable<iterator_t<_Range>, _Comp> _Range operator()(_Range);
} sort;
} // namespace ranges
template <typename _Alloc>
struct _Vector_base {
typedef __alloc_traits<_Alloc>::rebind::other ::pointer pointer;
};
template <typename _Tp, typename _Alloc = allocator<_Tp>>
struct vector {
__normal_iterator<typename _Vector_base<_Alloc>::pointer> begin();
};
struct OpenFoamReader {
OpenFoamReader() {
struct Connection {
auto operator<=>(const Connection &) const = default;
};
vector<Connection> connections;
ranges::sort(connections);
}
};
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/104788] ICE in stmts_are_full_exprs_p
2022-03-04 16:24 [Bug c++/104788] New: ICE raffael at casagrande dot ch
2022-03-04 16:32 ` [Bug c++/104788] ICE mpolacek at gcc dot gnu.org
2022-03-07 11:58 ` [Bug c++/104788] ICE in stmts_are_full_exprs_p marxin at gcc dot gnu.org
@ 2024-04-14 4:41 ` pinskia at gcc dot gnu.org
2024-04-14 4:57 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-14 4:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104788
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 57943
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57943&action=edit
Slightly more reduced
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/104788] ICE in stmts_are_full_exprs_p
2022-03-04 16:24 [Bug c++/104788] New: ICE raffael at casagrande dot ch
` (2 preceding siblings ...)
2024-04-14 4:41 ` pinskia at gcc dot gnu.org
@ 2024-04-14 4:57 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-14 4:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104788
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #57943|0 |1
is obsolete| |
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 57944
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57944&action=edit
Slightly more reduced
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-04-14 4:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-04 16:24 [Bug c++/104788] New: ICE raffael at casagrande dot ch
2022-03-04 16:32 ` [Bug c++/104788] ICE mpolacek at gcc dot gnu.org
2022-03-07 11:58 ` [Bug c++/104788] ICE in stmts_are_full_exprs_p marxin at gcc dot gnu.org
2024-04-14 4:41 ` pinskia at gcc dot gnu.org
2024-04-14 4:57 ` pinskia 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).