public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114954] New: [modules] ICE in write_class_def with templated union type
@ 2024-05-06  0:53 nshead at gcc dot gnu.org
  2024-05-07  1:39 ` [Bug c++/114954] " cvs-commit at gcc dot gnu.org
  2024-05-07  1:40 ` nshead at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: nshead at gcc dot gnu.org @ 2024-05-06  0:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114954
           Summary: [modules] ICE in write_class_def with templated union
                    type
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nshead at gcc dot gnu.org
            Blocks: 103524
  Target Milestone: ---

The following sample crashes on trunk:

  export module main;

  template <int N>
  union U {
  private:
    char a[N + 1];
    int b;
  };

  U<4> p;

With 'g++ -fmodules-ts -S main.cpp':
~/ice/main.cpp:1:8: internal compiler error: in write_class_def, at
cp/module.cc:12118
    1 | export module main;
      |        ^~~~~~
0x1010c67 write_class_def
        ../../gcc/gcc/cp/module.cc:12118
0x1014d91 write_definition
        ../../gcc/gcc/cp/module.cc:12731
0x101880e depset::hash::find_dependencies(module_state*)
        ../../gcc/gcc/cp/module.cc:13640
0x1026a62 module_state::write_begin(elf_out*, cpp_reader*,
module_state_config&, unsigned int&)
        ../../gcc/gcc/cp/module.cc:18253
0x102e39f finish_module_processing(cpp_reader*)
        ../../gcc/gcc/cp/module.cc:20693
0xf50556 c_parse_final_cleanups()
        ../../gcc/gcc/cp/decl2.cc:5393
0x131e75f c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.cc:1329

The assertion that fails is

  /* Every class but __as_base has a type-specific.  */
  gcc_checking_assert (!TYPE_LANG_SPECIFIC (type) == IS_FAKE_BASE_TYPE (type));

The issue looks to be that a union `__as_base` type doesn't satisfy the
'IS_FAKE_BASE_TYPE', which only applies to RECORD_TYPEs.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103524
[Bug 103524] [meta-bug] modules issue

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

* [Bug c++/114954] [modules] ICE in write_class_def with templated union type
  2024-05-06  0:53 [Bug c++/114954] New: [modules] ICE in write_class_def with templated union type nshead at gcc dot gnu.org
@ 2024-05-07  1:39 ` cvs-commit at gcc dot gnu.org
  2024-05-07  1:40 ` nshead at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-07  1:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nathaniel Shead <nshead@gcc.gnu.org>:

https://gcc.gnu.org/g:0c43c673b0d431ca02d83bf6fae9cd60e9a3d0a8

commit r15-221-g0c43c673b0d431ca02d83bf6fae9cd60e9a3d0a8
Author: Nathaniel Shead <nathanieloshead@gmail.com>
Date:   Mon May 6 13:05:52 2024 +1000

    c++: Allow IS_FAKE_BASE_TYPE for union types [PR114954]

    In some circumstances, unions can also have an __as_base type; we need
    to make sure that IS_FAKE_BASE_TYPE correctly recognises this.

            PR c++/114954

    gcc/cp/ChangeLog:

            * cp-tree.h (IS_FAKE_BASE_TYPE): Also apply to unions.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/pr114954.C: New test.

    Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
    Reviewed-by: Jason Merrill <jason@redhat.com>

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

* [Bug c++/114954] [modules] ICE in write_class_def with templated union type
  2024-05-06  0:53 [Bug c++/114954] New: [modules] ICE in write_class_def with templated union type nshead at gcc dot gnu.org
  2024-05-07  1:39 ` [Bug c++/114954] " cvs-commit at gcc dot gnu.org
@ 2024-05-07  1:40 ` nshead at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: nshead at gcc dot gnu.org @ 2024-05-07  1:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |nshead at gcc dot gnu.org
             Status|UNCONFIRMED                 |RESOLVED
   Target Milestone|---                         |15.0
         Resolution|---                         |FIXED

--- Comment #2 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
Fixed for GCC 15.

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

end of thread, other threads:[~2024-05-07  1:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-06  0:53 [Bug c++/114954] New: [modules] ICE in write_class_def with templated union type nshead at gcc dot gnu.org
2024-05-07  1:39 ` [Bug c++/114954] " cvs-commit at gcc dot gnu.org
2024-05-07  1:40 ` nshead 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).