public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114005] New: Constructing a constexpr std::initializer_list ICEs GCC when using C++ modules
@ 2024-02-20  1:14 eddiejnolan at gmail dot com
  2024-03-01 22:05 ` [Bug c++/114005] " cvs-commit at gcc dot gnu.org
  2024-03-01 22:09 ` nshead at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: eddiejnolan at gmail dot com @ 2024-02-20  1:14 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114005
           Summary: Constructing a constexpr std::initializer_list ICEs
                    GCC when using C++ modules
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eddiejnolan at gmail dot com
  Target Milestone: ---

Constructing a constexpr std::initializer_list at namespace scope causes an ICE
when attempting to compile this module:

module;

#include <initializer_list>

export module module1;

constexpr std::initializer_list<int> foo{0};

Using the command line:

g++ -g -std=gnu++23 -MD -fmodules-ts -MD -fdeps-format=p1689r5 -x c++ -c

Compiler explorer link: https://godbolt.org/z/6Te44T6oo

Error message:

module1.cpp:5:8: internal compiler error: in tree_node, at cp/module.cc:9320
    5 | export module math;
      |        ^~~~~~
0x7adc91 trees_out::tree_node(tree_node*)
       
/tmp/eddie/spack-stage/spack-stage-gcc-master-5txldehejuy5mxnvbocqkauwzyskb5oe/spack-src/gcc/cp/module.cc:9320
0xb9dfb2 trees_out::core_vals(tree_node*)
       
/tmp/eddie/spack-stage/spack-stage-gcc-master-5txldehejuy5mxnvbocqkauwzyskb5oe/spack-src/gcc/cp/module.cc:6066
0xba16f3 trees_out::tree_node_vals(tree_node*)
       
/tmp/eddie/spack-stage/spack-stage-gcc-master-5txldehejuy5mxnvbocqkauwzyskb5oe/spack-src/gcc/cp/module.cc:7241
0xba16f3 trees_out::tree_value(tree_node*)
       
/tmp/eddie/spack-stage/spack-stage-gcc-master-5txldehejuy5mxnvbocqkauwzyskb5oe/spack-src/gcc/cp/module.cc:9142
0xb9d430 trees_out::tree_node(tree_node*)
       
/tmp/eddie/spack-stage/spack-stage-gcc-master-5txldehejuy5mxnvbocqkauwzyskb5oe/spack-src/gcc/cp/module.cc:9340
0xb9dfb2 trees_out::core_vals(tree_node*)
       
/tmp/eddie/spack-stage/spack-stage-gcc-master-5txldehejuy5mxnvbocqkauwzyskb5oe/spack-src/gcc/cp/module.cc:6066
0xba16f3 trees_out::tree_node_vals(tree_node*)
       
/tmp/eddie/spack-stage/spack-stage-gcc-master-5txldehejuy5mxnvbocqkauwzyskb5oe/spack-src/gcc/cp/module.cc:7241
0xba16f3 trees_out::tree_value(tree_node*)
       
/tmp/eddie/spack-stage/spack-stage-gcc-master-5txldehejuy5mxnvbocqkauwzyskb5oe/spack-src/gcc/cp/module.cc:9142
0xb9d430 trees_out::tree_node(tree_node*)
       
/tmp/eddie/spack-stage/spack-stage-gcc-master-5txldehejuy5mxnvbocqkauwzyskb5oe/spack-src/gcc/cp/module.cc:9340
0xb9e0e6 trees_out::core_vals(tree_node*)
       
/tmp/eddie/spack-stage/spack-stage-gcc-master-5txldehejuy5mxnvbocqkauwzyskb5oe/spack-src/gcc/cp/module.cc:6473
0xba16f3 trees_out::tree_node_vals(tree_node*)
       
/tmp/eddie/spack-stage/spack-stage-gcc-master-5txldehejuy5mxnvbocqkauwzyskb5oe/spack-src/gcc/cp/module.cc:7241
0xba16f3 trees_out::tree_value(tree_node*)
       
/tmp/eddie/spack-stage/spack-stage-gcc-master-5txldehejuy5mxnvbocqkauwzyskb5oe/spack-src/gcc/cp/module.cc:9142
0xb9d430 trees_out::tree_node(tree_node*)
       
/tmp/eddie/spack-stage/spack-stage-gcc-master-5txldehejuy5mxnvbocqkauwzyskb5oe/spack-src/gcc/cp/module.cc:9340
0xba1a19 trees_out::write_var_def(tree_node*)
       
/tmp/eddie/spack-stage/spack-stage-gcc-master-5txldehejuy5mxnvbocqkauwzyskb5oe/spack-src/gcc/cp/module.cc:11768
0xba3bda depset::hash::find_dependencies(module_state*)
       
/tmp/eddie/spack-stage/spack-stage-gcc-master-5txldehejuy5mxnvbocqkauwzyskb5oe/spack-src/gcc/cp/module.cc:13427
0xba45e7 module_state::write_begin(elf_out*, cpp_reader*, module_state_config&,
unsigned int&)
       
/tmp/eddie/spack-stage/spack-stage-gcc-master-5txldehejuy5mxnvbocqkauwzyskb5oe/spack-src/gcc/cp/module.cc:18000
0xba5b84 finish_module_processing(cpp_reader*)
       
/tmp/eddie/spack-stage/spack-stage-gcc-master-5txldehejuy5mxnvbocqkauwzyskb5oe/spack-src/gcc/cp/module.cc:20348
0xb2e0b3 c_parse_final_cleanups()
       
/tmp/eddie/spack-stage/spack-stage-gcc-master-5txldehejuy5mxnvbocqkauwzyskb5oe/spack-src/gcc/cp/decl2.cc:5316
0xd88fcf c_common_parse_file()
       
/tmp/eddie/spack-stage/spack-stage-gcc-master-5txldehejuy5mxnvbocqkauwzyskb5oe/spack-src/gcc/c-family/c-opts.cc:1329
Please submit a full bug report, with preprocessed source (by using
-freport-bug).

GCC version tested was built from master on 20240218 using Spack:

gcc version 14.0.1 20240218 (experimental) (Spack GCC)

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

* [Bug c++/114005] Constructing a constexpr std::initializer_list ICEs GCC when using C++ modules
  2024-02-20  1:14 [Bug c++/114005] New: Constructing a constexpr std::initializer_list ICEs GCC when using C++ modules eddiejnolan at gmail dot com
@ 2024-03-01 22:05 ` cvs-commit at gcc dot gnu.org
  2024-03-01 22:09 ` nshead at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-01 22:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:2823b4d96d9ec4ad4e67e5e8edaa1b060a467491

commit r14-9266-g2823b4d96d9ec4ad4e67e5e8edaa1b060a467491
Author: Nathaniel Shead <nathanieloshead@gmail.com>
Date:   Thu Feb 29 22:49:13 2024 +1100

    c++: Ensure DECL_CONTEXT is set for temporary vars [PR114005]

    Modules streaming requires DECL_CONTEXT to be set for anything streamed.
    This patch ensures that 'create_temporary_var' does set a DECL_CONTEXT
    for these variables (such as the backing storage for initializer_lists)
    even if not inside a function declaration.

            PR c++/114005

    gcc/cp/ChangeLog:

            * init.cc (create_temporary_var): Use current_scope instead of
            current_function_decl.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/pr114005_a.C: New test.
            * g++.dg/modules/pr114005_b.C: New test.

    Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>

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

* [Bug c++/114005] Constructing a constexpr std::initializer_list ICEs GCC when using C++ modules
  2024-02-20  1:14 [Bug c++/114005] New: Constructing a constexpr std::initializer_list ICEs GCC when using C++ modules eddiejnolan at gmail dot com
  2024-03-01 22:05 ` [Bug c++/114005] " cvs-commit at gcc dot gnu.org
@ 2024-03-01 22:09 ` nshead at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: nshead at gcc dot gnu.org @ 2024-03-01 22:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

end of thread, other threads:[~2024-03-01 22:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-20  1:14 [Bug c++/114005] New: Constructing a constexpr std::initializer_list ICEs GCC when using C++ modules eddiejnolan at gmail dot com
2024-03-01 22:05 ` [Bug c++/114005] " cvs-commit at gcc dot gnu.org
2024-03-01 22:09 ` 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).