public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104523] New: G++ crash when compiling a simple module that includes pybind11/stl.h
@ 2022-02-13 22:45 juanjo at juanjoalvarez dot net
  2022-02-13 22:51 ` [Bug c++/104523] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: juanjo at juanjoalvarez dot net @ 2022-02-13 22:45 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104523
           Summary: G++ crash when compiling a simple module that includes
                    pybind11/stl.h
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: juanjo at juanjoalvarez dot net
  Target Milestone: ---

// Info
Version of GCC: gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0
System type; Ubuntu 21.10 AMD64.

// Steps to reproduce

I have a very simple to reproduce segmentation fault on the compiler when using
C++20 modules.

Steps to reproduce:

1. Install PyBind11 header files (it's a header only lib). If you have Python
the simplest way to do it is to "pip install pybind11". Then get the include
path, it usually will be at (python site-packages dir)/pybind11/include.

2. Install Python development header files (usually called pythonx.y-dev on
most distros).

3. Compile the file below with (update the include paths):

c++ -std=c++20 -fmodules-ts \
  -I/home/juanjux/.local/lib/python3.9/site-packages/pybind11/include \
  -I/home/juanjux/.pyenv/versions/3.9.7/include/python3.9 \
  -c -o build/PyBind11Module.o PyBind11Module.cpp



// File PyBind11Module.cpp start -->

module;
#include <pybind11/stl.h>
export module PyBind11Module;

// <--- File end

Result on my system:

PyBind11Module.cpp:5:9: internal compiler error: Segmentation fault
    5 | export module PyBind11Module;
      |         ^~~~~~
0xb0c67e crash_signal
        ../../src/gcc/toplev.c:327
0x7f517144d51f ???
        ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x9ca50d node_template_info
        ../../src/gcc/cp/module.cc:3895
0x9f0f5d get_originating_module_decl(tree_node*)
        ../../src/gcc/cp/module.cc:18327
0x9ded59 trees_out::decl_value(tree_node*, depset*)
        ../../src/gcc/cp/module.cc:7523
0x9df5c9 trees_out::decl_node(tree_node*, walk_kind)
        ../../src/gcc/cp/module.cc:8247
0x9e012a trees_out::tree_node(tree_node*)
        ../../src/gcc/cp/module.cc:9085
0x9ead9a module_state::write_cluster(elf_out*, depset**, unsigned int,
depset::hash&, unsigned int*, unsigned int*)
        ../../src/gcc/cp/module.cc:14633
0xa08f7a module_state::write(elf_out*, cpp_reader*)
        ../../src/gcc/cp/module.cc:17736
0x638d8a finish_module_processing(cpp_reader*)
        ../../src/gcc/cp/module.cc:19859
0xfa265e c_parse_final_cleanups()
        ../../src/gcc/cp/decl2.c:5175
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-11/README.Bugs> for instructions.

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

* [Bug c++/104523] G++ crash when compiling a simple module that includes pybind11/stl.h
  2022-02-13 22:45 [Bug c++/104523] New: G++ crash when compiling a simple module that includes pybind11/stl.h juanjo at juanjoalvarez dot net
@ 2022-02-13 22:51 ` pinskia at gcc dot gnu.org
  2022-02-13 23:52 ` juanjo at juanjoalvarez dot net
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-13 22:51 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-02-13
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |WAITING

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Can you please add -save-temps and attach the resulting .ii file too?
Or add -freport-bug and attach the file mentioned in the error message.
Compressing the file is fine too.

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

* [Bug c++/104523] G++ crash when compiling a simple module that includes pybind11/stl.h
  2022-02-13 22:45 [Bug c++/104523] New: G++ crash when compiling a simple module that includes pybind11/stl.h juanjo at juanjoalvarez dot net
  2022-02-13 22:51 ` [Bug c++/104523] " pinskia at gcc dot gnu.org
@ 2022-02-13 23:52 ` juanjo at juanjoalvarez dot net
  2022-02-13 23:55 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: juanjo at juanjoalvarez dot net @ 2022-02-13 23:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Juanjo Alvarez <juanjo at juanjoalvarez dot net> ---
Created attachment 52434
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52434&action=edit
.ii file

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

* [Bug c++/104523] G++ crash when compiling a simple module that includes pybind11/stl.h
  2022-02-13 22:45 [Bug c++/104523] New: G++ crash when compiling a simple module that includes pybind11/stl.h juanjo at juanjoalvarez dot net
  2022-02-13 22:51 ` [Bug c++/104523] " pinskia at gcc dot gnu.org
  2022-02-13 23:52 ` juanjo at juanjoalvarez dot net
@ 2022-02-13 23:55 ` pinskia at gcc dot gnu.org
  2022-02-13 23:57 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-13 23:55 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |UNCONFIRMED
     Ever confirmed|1                           |0

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

* [Bug c++/104523] G++ crash when compiling a simple module that includes pybind11/stl.h
  2022-02-13 22:45 [Bug c++/104523] New: G++ crash when compiling a simple module that includes pybind11/stl.h juanjo at juanjoalvarez dot net
                   ` (2 preceding siblings ...)
  2022-02-13 23:55 ` pinskia at gcc dot gnu.org
@ 2022-02-13 23:57 ` pinskia at gcc dot gnu.org
  2022-02-14 20:36 ` pinskia at gcc dot gnu.org
  2024-03-06 22:12 ` ppalka at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-13 23:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
apinski@xeond:~/src/upstream-gcc$ ~/upstream-gcc/bin/gcc  t.ii -std=c++20
-fmodules-ts
PyBind11Module.cpp:5:9: internal compiler error: tree check: expected none of
template_decl, have template_decl in add_specializations, at cp/module.cc:12971
0x8f8f58 tree_not_check_failed(tree_node const*, char const*, int, char const*,
...)
        /home/apinski/src/upstream-gcc/gcc/gcc/tree.c:8739
0x75c6b1 tree_not_check(tree_node*, char const*, int, char const*, tree_code)
        /home/apinski/src/upstream-gcc/gcc/gcc/tree.h:3450
0x75c6b1 depset::hash::add_specializations(bool)
        /home/apinski/src/upstream-gcc/gcc/gcc/cp/module.cc:12971
0xb00fa5 module_state::write(elf_out*, cpp_reader*)
        /home/apinski/src/upstream-gcc/gcc/gcc/cp/module.cc:17606
0xb02590 finish_module_processing(cpp_reader*)
        /home/apinski/src/upstream-gcc/gcc/gcc/cp/module.cc:19876
0xa92a5b c_parse_final_cleanups()
        /home/apinski/src/upstream-gcc/gcc/gcc/cp/decl2.c:5310
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.


Reducing.

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

* [Bug c++/104523] G++ crash when compiling a simple module that includes pybind11/stl.h
  2022-02-13 22:45 [Bug c++/104523] New: G++ crash when compiling a simple module that includes pybind11/stl.h juanjo at juanjoalvarez dot net
                   ` (3 preceding siblings ...)
  2022-02-13 23:57 ` pinskia at gcc dot gnu.org
@ 2022-02-14 20:36 ` pinskia at gcc dot gnu.org
  2024-03-06 22:12 ` ppalka at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-14 20:36 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
     Ever confirmed|0                           |1
   Last reconfirmed|2022-02-13 00:00:00         |2022-02-14
             Status|UNCONFIRMED                 |NEW

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed, reduced testcase:
# 1 "mysource.cc"
module ;
# 1 "myheader.h" 1
template<typename _CharT>
  class t {
    template<typename> friend class tt;
  };
t<int> to_wstring() { }
# 4 "mysource.cc" 2
export  module  mymodule;

Or maybe that is a regression from before ....

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

* [Bug c++/104523] G++ crash when compiling a simple module that includes pybind11/stl.h
  2022-02-13 22:45 [Bug c++/104523] New: G++ crash when compiling a simple module that includes pybind11/stl.h juanjo at juanjoalvarez dot net
                   ` (4 preceding siblings ...)
  2022-02-14 20:36 ` pinskia at gcc dot gnu.org
@ 2024-03-06 22:12 ` ppalka at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-03-06 22:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |14.0
         Resolution|---                         |FIXED

--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 14 since r14-8963.

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

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-13 22:45 [Bug c++/104523] New: G++ crash when compiling a simple module that includes pybind11/stl.h juanjo at juanjoalvarez dot net
2022-02-13 22:51 ` [Bug c++/104523] " pinskia at gcc dot gnu.org
2022-02-13 23:52 ` juanjo at juanjoalvarez dot net
2022-02-13 23:55 ` pinskia at gcc dot gnu.org
2022-02-13 23:57 ` pinskia at gcc dot gnu.org
2022-02-14 20:36 ` pinskia at gcc dot gnu.org
2024-03-06 22:12 ` ppalka 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).