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

Modules crash and/or linker failure #85561

Open
mmoult opened this issue Mar 17, 2024 · 0 comments
Open

Modules crash and/or linker failure #85561

mmoult opened this issue Mar 17, 2024 · 0 comments

Comments

@mmoult
Copy link

mmoult commented Mar 17, 2024

I encountered an issue which I believe to be a bug in clang. The compilation fails during linking, and with some minor modifications to the code, clang crashes. Unfortunately, when I was coming up with the reduced version, I maintained the linker failure but lost the clang crash. Hopefully an investigation into the problem which I kept can fix both. If you can verify that this is a bug (and not a programming mistake on my part), I will take the time to produce the crash report.

I have attached all relevant code files: files.zip The issue appears to be coming from the vector parameter of Foo::noo (in previous tests, I observed that when the parameter is replaced with a bool or a vector of some other type, the error goes away. Interesting that Bar* is permitted as a return, but not as a specialization of vector.)

The error I am getting looks like this:

[10/10] Linking CXX executable modules-test
FAILED: modules-test 
: && /home/mmoult/Build/llvm-project-llvmorg-18.1.1/build/bin/clang++ -g  CMakeFiles/build.dir/main.cpp.o CMakeFiles/build.dir/foo.cpp.o CMakeFiles/build.dir/bar.cxx.o CMakeFiles/build.dir/foo.cxx.o -o modules-test   && :
/usr/bin/ld: CMakeFiles/build.dir/foo.cpp.o: in function `Foo@foo::doo()':
/home/mmoult/git/test/foo.cpp:10: undefined reference to `Foo@foo::num'
/usr/bin/ld: CMakeFiles/build.dir/bar.cxx.o: in function `Bar@bar::call() const':
/home/mmoult/git/test/bar.cxx:12: undefined reference to `Foo@foo::num'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

The command I ran on Debian is:

cmake -G Ninja -B build -S . -DCMAKE_BUILD_TYPE=Debug

The version of CMake I am using is 3.29.0-rc4, found at https://cmake.org/download/ (version 3.29.0-rc3 produced the same error).
The version of Ninja I am using is 1.11.1
The version of clang I am using is:

clang version 18.1.1
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/mmoult/Build/llvm-project-llvmorg-18.1.1/build/bin

Thanks for your consideration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant