public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103118] New: [modules] ICE tree check in get_merge_kind at cp/module.cc
@ 2021-11-07 18:44 johelegp at gmail dot com
  2021-11-12 17:10 ` [Bug c++/103118] " johelegp at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: johelegp at gmail dot com @ 2021-11-07 18:44 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103118
           Summary: [modules] ICE tree check in get_merge_kind at
                    cp/module.cc
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: johelegp at gmail dot com
                CC: johelegp at gmail dot com
  Target Milestone: ---

Including `<chrono>` in the following source results in an ICE.

std.hpp:
```C++
#include <algorithm>
#include <array>
#include <bit>
#include <chrono>
#include <concepts>
#include <cstddef>
#include <cstdint>
#include <exception>
#include <fstream>
#include <iostream>
#include <optional>
#include <string>
#include <type_traits>
#include <utility>
```

Command:
```
g++ -std=c++23 -fmodules-ts -x c++-header -c std.hpp
```

Output:
```
std.hpp: internal compiler error: tree check: expected var_decl or
function_decl or field_decl or type_decl or concept_decl or template_decl, have
namespace_decl in get_merge_kind, at cp/module.cc:10072
0x208bafd internal_error(char const*, ...)
        ???:0
0x8b1d90 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ???:0
0xabf5dd trees_out::decl_value(tree_node*, depset*)
        ???:0
0xac077b trees_out::decl_node(tree_node*, walk_kind)
        ???:0
0xac17aa trees_out::tree_node(tree_node*)
        ???:0
0xac1b02 trees_out::chained_decls(tree_node*)
        ???:0
0xac2ab1 trees_out::core_vals(tree_node*)
        ???:0
0xac5748 trees_out::tree_value(tree_node*)
        ???:0
0xac1608 trees_out::tree_node(tree_node*)
        ???:0
0xac5870 trees_out::write_function_def(tree_node*)
        ???:0
0xac7b6c depset::hash::find_dependencies(module_state*)
        ???:0
0xac7fba module_state::write(elf_out*, cpp_reader*)
        ???:0
0xac968e finish_module_processing(cpp_reader*)
        ???:0
0xa5739c c_parse_final_cleanups()
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://bugs.archlinux.org/> for instructions.
```

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/103118] [modules] ICE tree check in get_merge_kind at cp/module.cc
  2021-11-07 18:44 [Bug c++/103118] New: [modules] ICE tree check in get_merge_kind at cp/module.cc johelegp at gmail dot com
@ 2021-11-12 17:10 ` johelegp at gmail dot com
  2021-11-12 18:47 ` johelegp at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: johelegp at gmail dot com @ 2021-11-12 17:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
To work around this
- Do not include `<chrono>`.
- Explicitly import a module that exports its definitions when you need to use
the chrono library.

I use the headers above to compile a header unit, which I export from a module
to work around the lack of a standard modules. Apparently, `<chrono>` is
indirectly included, as using the chrono library works.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/103118] [modules] ICE tree check in get_merge_kind at cp/module.cc
  2021-11-07 18:44 [Bug c++/103118] New: [modules] ICE tree check in get_merge_kind at cp/module.cc johelegp at gmail dot com
  2021-11-12 17:10 ` [Bug c++/103118] " johelegp at gmail dot com
@ 2021-11-12 18:47 ` johelegp at gmail dot com
  2021-11-12 18:57 ` johelegp at gmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: johelegp at gmail dot com @ 2021-11-12 18:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Or not. I forgot to uncomment uses of the chrono library.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/103118] [modules] ICE tree check in get_merge_kind at cp/module.cc
  2021-11-07 18:44 [Bug c++/103118] New: [modules] ICE tree check in get_merge_kind at cp/module.cc johelegp at gmail dot com
  2021-11-12 17:10 ` [Bug c++/103118] " johelegp at gmail dot com
  2021-11-12 18:47 ` johelegp at gmail dot com
@ 2021-11-12 18:57 ` johelegp at gmail dot com
  2021-11-16 21:53 ` johelegp at gmail dot com
  2022-02-13 14:03 ` johelegp at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: johelegp at gmail dot com @ 2021-11-12 18:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
What works is including them in a non-module unit translation unit.

```C++
#if defined(__GNUC__) and not defined(__clang__)
#  include <chrono> // Workaround GCC bug 103118.
#  include <span>   // Workaround GCC bug 100583.
#endif
import waarudo.geometries;
import waarudo.numbers;
import waarudo.quantities;
#include <cassert>
```

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/103118] [modules] ICE tree check in get_merge_kind at cp/module.cc
  2021-11-07 18:44 [Bug c++/103118] New: [modules] ICE tree check in get_merge_kind at cp/module.cc johelegp at gmail dot com
                   ` (2 preceding siblings ...)
  2021-11-12 18:57 ` johelegp at gmail dot com
@ 2021-11-16 21:53 ` johelegp at gmail dot com
  2022-02-13 14:03 ` johelegp at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: johelegp at gmail dot com @ 2021-11-16 21:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
With the setup in Comment 3, now I can also include `<chrono>` in the GMF of a
module. I don't think this worked last week. Though all I'm doing in the module
is specializing a my-library type trait on some chrono date types.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c++/103118] [modules] ICE tree check in get_merge_kind at cp/module.cc
  2021-11-07 18:44 [Bug c++/103118] New: [modules] ICE tree check in get_merge_kind at cp/module.cc johelegp at gmail dot com
                   ` (3 preceding siblings ...)
  2021-11-16 21:53 ` johelegp at gmail dot com
@ 2022-02-13 14:03 ` johelegp at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: johelegp at gmail dot com @ 2022-02-13 14:03 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #5 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Fixed somewhere along the way.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-02-13 14:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-07 18:44 [Bug c++/103118] New: [modules] ICE tree check in get_merge_kind at cp/module.cc johelegp at gmail dot com
2021-11-12 17:10 ` [Bug c++/103118] " johelegp at gmail dot com
2021-11-12 18:47 ` johelegp at gmail dot com
2021-11-12 18:57 ` johelegp at gmail dot com
2021-11-16 21:53 ` johelegp at gmail dot com
2022-02-13 14:03 ` johelegp at gmail dot com

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).