public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114685] New: [modules] ICE when exporting a type through a different alias then one declared in GMF
@ 2024-04-10 20:51 m.cencora at gmail dot com
  2024-04-10 21:11 ` [Bug c++/114685] " m.cencora at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: m.cencora at gmail dot com @ 2024-04-10 20:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114685
           Summary: [modules] ICE when exporting a type through a
                    different alias then one declared in GMF
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: m.cencora at gmail dot com
  Target Milestone: ---

$ cat lldiv_t.cpp 
module;

#include "lldiv_t.h"

export module std;

export namespace std
{
using ::__gnu_cxx::lldiv_t;
}

$ cat lldiv_t.h 
#pragma once

struct lldiv_t{};

namespace __gnu_cxx
{
using ::lldiv_t;
}

namespace std
{
using ::lldiv_t;
}

$ g++ -std=gnu++2b -isystem $PWD -fmodules-ts lldiv_t.cpp
lldiv_t.cpp:5:8: internal compiler error: in add_binding_entity, at
cp/module.cc:12992
    5 | export module std;
      |        ^~~~~~
0x772540 depset::hash::add_binding_entity(tree_node*, WMB_Flags, void*)
        ../../src/gcc/cp/module.cc:12992
0x1049b77 walk_module_binding(tree_node*, bitmap_head*, bool (*)(tree_node*,
WMB_Flags, void*), void*)
        ../../src/gcc/cp/name-lookup.cc:4224
0x1017341 depset::hash::add_namespace_entities(tree_node*, bitmap_head*)
        ../../src/gcc/cp/module.cc:13032
0x1031c89 module_state::write_begin(elf_out*, cpp_reader*,
module_state_config&, unsigned int&)
        ../../src/gcc/cp/module.cc:17968
0x1033244 finish_module_processing(cpp_reader*)
        ../../src/gcc/cp/module.cc:20340
0xfbcbc1 c_parse_final_cleanups()
        ../../src/gcc/cp/decl2.cc:5354
0x120ef68 c_common_parse_file()
        ../../src/gcc/c-family/c-opts.cc:1329

Works fine on gcc-13.
Reduced from an implementation of "std" module.

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

* [Bug c++/114685] [modules] ICE when exporting a type through a different alias then one declared in GMF
  2024-04-10 20:51 [Bug c++/114685] New: [modules] ICE when exporting a type through a different alias then one declared in GMF m.cencora at gmail dot com
@ 2024-04-10 21:11 ` m.cencora at gmail dot com
  2024-04-11 13:49 ` nshead at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: m.cencora at gmail dot com @ 2024-04-10 21:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from m.cencora at gmail dot com ---
Oops, the -isystem and -std options are not necessary for reproduction.

This is enough:
$ g++ -fmodules-ts lldiv_t.cpp

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

* [Bug c++/114685] [modules] ICE when exporting a type through a different alias then one declared in GMF
  2024-04-10 20:51 [Bug c++/114685] New: [modules] ICE when exporting a type through a different alias then one declared in GMF m.cencora at gmail dot com
  2024-04-10 21:11 ` [Bug c++/114685] " m.cencora at gmail dot com
@ 2024-04-11 13:49 ` nshead at gcc dot gnu.org
  2024-04-24 13:53 ` ppalka at gcc dot gnu.org
  2024-04-26 20:55 ` m.cencora at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: nshead at gcc dot gnu.org @ 2024-04-11 13:49 UTC (permalink / raw)
  To: gcc-bugs

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

Nathaniel Shead <nshead at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=114683
             Status|UNCONFIRMED                 |NEW
                 CC|                            |nshead at gcc dot gnu.org
   Last reconfirmed|                            |2024-04-11
     Ever confirmed|0                           |1

--- Comment #2 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
This fails on

      if (data->hash->add_namespace_entities (decl, data->partitions))
        {
          /* It contains an exported thing, so it is exported.  */
          gcc_checking_assert (DECL_MODULE_PURVIEW_P (decl));
          DECL_MODULE_EXPORT_P (decl) = true;
        }

ultimately for a very similar reason to PR114683: non-functions brought in by
using-decls currently just bind the value directly which means that there's
nothing to indicate that they should be exported from this scope (and not their
original one).

I've been playing around with making use of the existing STAT_HACK machinery to
try to get this working, but it looks like we'll probably need to overhaul a
fair chunk of the name lookup code to handle this correctly.

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

* [Bug c++/114685] [modules] ICE when exporting a type through a different alias then one declared in GMF
  2024-04-10 20:51 [Bug c++/114685] New: [modules] ICE when exporting a type through a different alias then one declared in GMF m.cencora at gmail dot com
  2024-04-10 21:11 ` [Bug c++/114685] " m.cencora at gmail dot com
  2024-04-11 13:49 ` nshead at gcc dot gnu.org
@ 2024-04-24 13:53 ` ppalka at gcc dot gnu.org
  2024-04-26 20:55 ` m.cencora at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-04-24 13:53 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(N.B. https://gcc.gnu.org/PR114600#c10 contains a full std module with
workarounds)

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

* [Bug c++/114685] [modules] ICE when exporting a type through a different alias then one declared in GMF
  2024-04-10 20:51 [Bug c++/114685] New: [modules] ICE when exporting a type through a different alias then one declared in GMF m.cencora at gmail dot com
                   ` (2 preceding siblings ...)
  2024-04-24 13:53 ` ppalka at gcc dot gnu.org
@ 2024-04-26 20:55 ` m.cencora at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: m.cencora at gmail dot com @ 2024-04-26 20:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from m.cencora at gmail dot com ---
I've stumbled upon a related error when trying to export std::vector after
inclusion of <format> in GMF:

module;

namespace std
{
class vector;
namespace __format {
using std::vector;
}
}

export module std;

export namespace std {
#ifdef WORKAROUND
namespace __format {}
#endif
    using std::vector;
}

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

end of thread, other threads:[~2024-04-26 20:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-10 20:51 [Bug c++/114685] New: [modules] ICE when exporting a type through a different alias then one declared in GMF m.cencora at gmail dot com
2024-04-10 21:11 ` [Bug c++/114685] " m.cencora at gmail dot com
2024-04-11 13:49 ` nshead at gcc dot gnu.org
2024-04-24 13:53 ` ppalka at gcc dot gnu.org
2024-04-26 20:55 ` m.cencora 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).