public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "johelegp at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/107033] [13 Regression] [modules] ICE converting to span
Date: Sun, 25 Sep 2022 16:08:10 +0000	[thread overview]
Message-ID: <bug-107033-4-Hjj5XXMi9S@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107033-4@http.gcc.gnu.org/bugzilla/>

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

Johel Ernesto Guerrero Peña <johelegp at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
      Known to fail|                            |11.3.0, 12.2.0

--- Comment #1 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Simplified. GCC12 only accepts when the span is an lvalue, and otherwise is
rejects-valid. GCC11 and GCC13 are ice-on-valid-code with different backtraces.

GCC11: https://godbolt.org/z/ev5Wb4d3v
GCC12: https://godbolt.org/z/bo6f5nT7Y
GCC13: https://godbolt.org/z/qGdWq4383
GCC12 lvalue: https://godbolt.org/z/zoz69ener

GCC11:
```
In file included from /app/std.hpp:2,
of module /app/std.hpp, imported at /app/mod.cpp:2:
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/span: In instantiation of
'class std::span<int>':
mod.cpp:3:51:   required from here
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/span:155:9: internal
compiler error: Segmentation fault
  155 |         span(_It __first, size_type __count)
      |         ^~~~
0x17888c9 internal_error(char const*, ...)
        ???:0
0x7da897 tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x7f6feb instantiate_class_template(tree_node*)
        ???:0
0x82a7f3 complete_type(tree_node*)
        ???:0
0x806c31 finish_compound_literal(tree_node*, tree_node*, int, fcl_t)
        ???:0
0x7c123b c_parse_file()
        ???:0
0x894042 c_common_parse_file()
        ???:0
```

GCC12:
```
mod.cpp:3:35: error: no match for call to '(const
std::ranges::__cust_access::_Begin) (std::span<int>)'
    3 | export auto _ = std::ranges::begin(std::span<int>{});
      |                 ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
In file included from
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/string_view:50,
                 from
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/bits/basic_string.h:47,
                 from
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/string:53,
                 from
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/bits/locale_classes.h:40,
                 from
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/bits/ios_base.h:41,
                 from
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/streambuf:41,
                 from
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/bits/streambuf_iterator.h:35,
                 from
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/iterator:66,
                 from
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/ranges:43,
                 from /app/std.hpp:1,
of module /app/std.hpp, imported at /app/mod.cpp:2:
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/bits/ranges_base.h:114:9:
note: candidate: 'template<class _Tp>  requires (__maybe_borrowed_range<_Tp>)
&& ((is_array_v<typename std::remove_reference<_Tp>::type>) ||
(__member_begin<_Tp>) || (__adl_begin<_Tp>)) constexpr auto
std::ranges::__cust_access::_Begin::operator()(_Tp&&) const'
  114 |         operator()[[nodiscard]](_Tp&& __t) const
noexcept(_S_noexcept<_Tp&>())
      |         ^~~~~~~~
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/bits/ranges_base.h:114:9:
note:   template argument deduction/substitution failed:
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/bits/ranges_base.h:114:9:
note: constraints not satisfied
mod.cpp: In substitution of 'template<class _Tp>  requires
(__maybe_borrowed_range<_Tp>) && ((is_array_v<typename
std::remove_reference<_Tp>::type>) || (__member_begin<_Tp>) ||
(__adl_begin<_Tp>)) constexpr auto
std::ranges::__cust_access::_Begin::operator()(_Tp&&) const [with _Tp =
std::span<int>]':
mod.cpp:3:35:   required from here
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/bits/ranges_base.h:83:15: 
 required for the satisfaction of '__maybe_borrowed_range<_Tp>' [with _Tp =
std::span<int, 18446744073709551615>]
/opt/compiler-explorer/gcc-12.2.0/include/c++/12.2.0/bits/ranges_base.h:85:11:
note: no operand of the disjunction is satisfied
   84 |         = is_lvalue_reference_v<_Tp>
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~
   85 |           || enable_borrowed_range<remove_cvref_t<_Tp>>;
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: note: set '-fconcepts-diagnostics-depth=' to at least 2 for more
detail
mod.cpp:1:8: warning: not writing module 'mod' due to errors
    1 | export module mod;
      |        ^~~~~~
```

GCC13:
```
mod.cpp:1:8: internal compiler error: Segmentation fault
    1 | export module mod;
      |        ^~~~~~
0x234bd6e internal_error(char const*, ...)
        ???:0
0xc84cfe walk_specializations(bool, void (*)(bool, spec_entry*, void*), void*)
        ???:0
0xbead4c depset::hash::add_specializations(bool)
        ???:0
0xbfb5a8 module_state::write_begin(elf_out*, cpp_reader*, module_state_config&,
unsigned int&)
        ???:0
0xbfcd45 finish_module_processing(cpp_reader*)
        ???:0
0xb89d2e c_parse_final_cleanups()
        ???:0
0xdb0cc8 c_common_parse_file()
        ???:0
```

  reply	other threads:[~2022-09-25 16:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-25 14:08 [Bug c++/107033] New: " johelegp at gmail dot com
2022-09-25 16:08 ` johelegp at gmail dot com [this message]
2022-09-25 16:09 ` [Bug c++/107033] " johelegp at gmail dot com
2022-09-25 16:32 ` [Bug c++/107033] [13 Regression] [modules] ICE using span as a range johelegp at gmail dot com
2022-09-25 17:12 ` johelegp at gmail dot com
2022-09-26  9:27 ` [Bug c++/107033] [13 Regression] [modules] Variable template of type trait via importable header gives wrong result rguenth at gcc dot gnu.org
2022-09-26 13:07 ` ppalka at gcc dot gnu.org
2022-09-26 15:31 ` cvs-commit at gcc dot gnu.org
2022-09-29 21:07 ` ppalka 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-107033-4-Hjj5XXMi9S@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).