Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang++ crashes when using pointer-to-member pointers from separate named modules #116190

Open
JoniHelen opened this issue Nov 14, 2024 · 1 comment
Labels
clang:modules C++20 modules and Clang Header Modules crash Prefer [crash-on-valid] or [crash-on-invalid]

Comments

@JoniHelen
Copy link

clang++ crashes while building CMake project with c++ modules using pointer-to-member pointers with the following stack trace:

Stack dump:
0.	Program arguments: D:\\LLVM\\bin\\clang++.exe -cc1 -triple x86_64-pc-windows-msvc19.41.34120 -emit-obj -mincremental-linker-compatible -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name bar.ixx -mrelocation-model pic -pic-level 2 -mframe-pointer=none -relaxed-aliasing -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -gno-column-info -gcodeview -debug-info-kind=constructor -fdebug-compilation-dir=D:\\Algotask3\\cmake-build-debug -object-file-name=D:\\Algotask3\\cmake-build-debug\\CMakeFiles\\ptr_bug.dir\\bar.ixx.obj -fcoverage-compilation-dir=D:\\Algotask3\\cmake-build-debug -resource-dir D:\\LLVM\\lib\\clang\\19 -O0 -std=gnu++23 -fdeprecated-macro -ferror-limit 19 -fno-use-cxa-atexit -fms-extensions -fms-compatibility -fms-compatibility-version=19.41.34120 -fno-implicit-modules -fmodule-file=foo=CMakeFiles/ptr_bug.dir/foo.pcm -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions --dependent-lib=msvcrtd -gcodeview -faddrsig -o CMakeFiles/ptr_bug.dir/bar.ixx.obj -x pcm CMakeFiles/ptr_bug.dir/bar.pcm
1.	<eof> parser at end of file
2.	D:\Algotask3\bar.ixx:5:14: LLVM IR generation of declaration 'Bar'
Exception Code: 0xC0000005
 #0 0x00007ff6275d6e30 (D:\LLVM\bin\clang++.exe+0xa6e30)
 #1 0x00007ff62920c356 (D:\LLVM\bin\clang++.exe+0x1cdc356)
 #2 0x00007ff628757dd0 (D:\LLVM\bin\clang++.exe+0x1227dd0)
 #3 0x00007ff628bb853a (D:\LLVM\bin\clang++.exe+0x168853a)
 #4 0x00007ff6283e03ec (D:\LLVM\bin\clang++.exe+0xeb03ec)
 #5 0x00007ff6283dc4ca (D:\LLVM\bin\clang++.exe+0xeac4ca)
 #6 0x00007ff628756d4f (D:\LLVM\bin\clang++.exe+0x1226d4f)
 #7 0x00007ff628755948 (D:\LLVM\bin\clang++.exe+0x1225948)
 #8 0x00007ff629736699 (D:\LLVM\bin\clang++.exe+0x2206699)
 #9 0x00007ff629732ce0 (D:\LLVM\bin\clang++.exe+0x2202ce0)
#10 0x00007ff6297326c2 (D:\LLVM\bin\clang++.exe+0x22026c2)
#11 0x00007ff629732651 (D:\LLVM\bin\clang++.exe+0x2202651)
#12 0x00007ff6297309e8 (D:\LLVM\bin\clang++.exe+0x22009e8)
#13 0x00007ff62877a752 (D:\LLVM\bin\clang++.exe+0x124a752)
#14 0x00007ff62910faec (D:\LLVM\bin\clang++.exe+0x1bdfaec)
#15 0x00007ff6290fe816 (D:\LLVM\bin\clang++.exe+0x1bce816)
#16 0x00007ff62a525af4 (D:\LLVM\bin\clang++.exe+0x2ff5af4)
#17 0x00007ff62992565e (D:\LLVM\bin\clang++.exe+0x23f565e)
#18 0x00007ff629094f2a (D:\LLVM\bin\clang++.exe+0x1b64f2a)
#19 0x00007ff627af0f21 (D:\LLVM\bin\clang++.exe+0x5c0f21)
#20 0x00007ff627af0ab2 (D:\LLVM\bin\clang++.exe+0x5c0ab2)
#21 0x00007ff627aed826 (D:\LLVM\bin\clang++.exe+0x5bd826)
#22 0x00007ff627aea7e5 (D:\LLVM\bin\clang++.exe+0x5ba7e5)
#23 0x00007ff627ae917e (D:\LLVM\bin\clang++.exe+0x5b917e)
#24 0x00007ff62796c21a (D:\LLVM\bin\clang++.exe+0x43c21a)
#25 0x00007ff627968c73 (D:\LLVM\bin\clang++.exe+0x438c73)
#26 0x00007ff6291350b8 (D:\LLVM\bin\clang++.exe+0x1c050b8)
#27 0x00007ffaf1457374 (C:\WINDOWS\System32\KERNEL32.DLL+0x17374)
#28 0x00007ffaf25bcc91 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x4cc91)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 19.1.3
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: D:\LLVM\bin

source_and_run_script.zip
repro_files.zip

The issue only occurs when the classes are originally from different modules. If they are defined in the same module, the program builds fine.

@github-actions github-actions bot added the clang Clang issues not falling into any other category label Nov 14, 2024
@EugeneZelenko EugeneZelenko added clang:modules C++20 modules and Clang Header Modules crash Prefer [crash-on-valid] or [crash-on-invalid] and removed clang Clang issues not falling into any other category labels Nov 14, 2024
@llvmbot
Copy link

llvmbot commented Nov 14, 2024

@llvm/issue-subscribers-clang-modules

Author: Joni Helén (JoniHelen)

clang++ crashes while building CMake project with c++ modules using pointer-to-member pointers with the following stack trace:
Stack dump:
0.	Program arguments: D:\\LLVM\\bin\\clang++.exe -cc1 -triple x86_64-pc-windows-msvc19.41.34120 -emit-obj -mincremental-linker-compatible -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name bar.ixx -mrelocation-model pic -pic-level 2 -mframe-pointer=none -relaxed-aliasing -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -gno-column-info -gcodeview -debug-info-kind=constructor -fdebug-compilation-dir=D:\\Algotask3\\cmake-build-debug -object-file-name=D:\\Algotask3\\cmake-build-debug\\CMakeFiles\\ptr_bug.dir\\bar.ixx.obj -fcoverage-compilation-dir=D:\\Algotask3\\cmake-build-debug -resource-dir D:\\LLVM\\lib\\clang\\19 -O0 -std=gnu++23 -fdeprecated-macro -ferror-limit 19 -fno-use-cxa-atexit -fms-extensions -fms-compatibility -fms-compatibility-version=19.41.34120 -fno-implicit-modules -fmodule-file=foo=CMakeFiles/ptr_bug.dir/foo.pcm -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions --dependent-lib=msvcrtd -gcodeview -faddrsig -o CMakeFiles/ptr_bug.dir/bar.ixx.obj -x pcm CMakeFiles/ptr_bug.dir/bar.pcm
1.	&lt;eof&gt; parser at end of file
2.	D:\Algotask3\bar.ixx:5:14: LLVM IR generation of declaration 'Bar'
Exception Code: 0xC0000005
 #<!-- -->0 0x00007ff6275d6e30 (D:\LLVM\bin\clang++.exe+0xa6e30)
 #<!-- -->1 0x00007ff62920c356 (D:\LLVM\bin\clang++.exe+0x1cdc356)
 #<!-- -->2 0x00007ff628757dd0 (D:\LLVM\bin\clang++.exe+0x1227dd0)
 #<!-- -->3 0x00007ff628bb853a (D:\LLVM\bin\clang++.exe+0x168853a)
 #<!-- -->4 0x00007ff6283e03ec (D:\LLVM\bin\clang++.exe+0xeb03ec)
 #<!-- -->5 0x00007ff6283dc4ca (D:\LLVM\bin\clang++.exe+0xeac4ca)
 #<!-- -->6 0x00007ff628756d4f (D:\LLVM\bin\clang++.exe+0x1226d4f)
 #<!-- -->7 0x00007ff628755948 (D:\LLVM\bin\clang++.exe+0x1225948)
 #<!-- -->8 0x00007ff629736699 (D:\LLVM\bin\clang++.exe+0x2206699)
 #<!-- -->9 0x00007ff629732ce0 (D:\LLVM\bin\clang++.exe+0x2202ce0)
#<!-- -->10 0x00007ff6297326c2 (D:\LLVM\bin\clang++.exe+0x22026c2)
#<!-- -->11 0x00007ff629732651 (D:\LLVM\bin\clang++.exe+0x2202651)
#<!-- -->12 0x00007ff6297309e8 (D:\LLVM\bin\clang++.exe+0x22009e8)
#<!-- -->13 0x00007ff62877a752 (D:\LLVM\bin\clang++.exe+0x124a752)
#<!-- -->14 0x00007ff62910faec (D:\LLVM\bin\clang++.exe+0x1bdfaec)
#<!-- -->15 0x00007ff6290fe816 (D:\LLVM\bin\clang++.exe+0x1bce816)
#<!-- -->16 0x00007ff62a525af4 (D:\LLVM\bin\clang++.exe+0x2ff5af4)
#<!-- -->17 0x00007ff62992565e (D:\LLVM\bin\clang++.exe+0x23f565e)
#<!-- -->18 0x00007ff629094f2a (D:\LLVM\bin\clang++.exe+0x1b64f2a)
#<!-- -->19 0x00007ff627af0f21 (D:\LLVM\bin\clang++.exe+0x5c0f21)
#<!-- -->20 0x00007ff627af0ab2 (D:\LLVM\bin\clang++.exe+0x5c0ab2)
#<!-- -->21 0x00007ff627aed826 (D:\LLVM\bin\clang++.exe+0x5bd826)
#<!-- -->22 0x00007ff627aea7e5 (D:\LLVM\bin\clang++.exe+0x5ba7e5)
#<!-- -->23 0x00007ff627ae917e (D:\LLVM\bin\clang++.exe+0x5b917e)
#<!-- -->24 0x00007ff62796c21a (D:\LLVM\bin\clang++.exe+0x43c21a)
#<!-- -->25 0x00007ff627968c73 (D:\LLVM\bin\clang++.exe+0x438c73)
#<!-- -->26 0x00007ff6291350b8 (D:\LLVM\bin\clang++.exe+0x1c050b8)
#<!-- -->27 0x00007ffaf1457374 (C:\WINDOWS\System32\KERNEL32.DLL+0x17374)
#<!-- -->28 0x00007ffaf25bcc91 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x4cc91)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 19.1.3
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: D:\LLVM\bin

source_and_run_script.zip
repro_files.zip

The issue only occurs when the classes are originally from different modules. If they are defined in the same module, the program builds fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:modules C++20 modules and Clang Header Modules crash Prefer [crash-on-valid] or [crash-on-invalid]
Projects
None yet
Development

No branches or pull requests

3 participants