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

cpp modules cause 'internal compiler error' #6109

Open
largenumberhere opened this issue Jan 23, 2025 · 1 comment
Open

cpp modules cause 'internal compiler error' #6109

largenumberhere opened this issue Jan 23, 2025 · 1 comment
Labels

Comments

@largenumberhere
Copy link

Xmake Version

xmake v2.8.7+20240401

Operating System Version and Architecture

WSL, Ubuntu 24.04.1 LTS, x86_64

Describe Bug

Using C++ modules with xmake and gcc 13.3.0 fails spectacularly. I'm unsure if this is due to xmake giving bad data, or if this version of gcc is broken.
The important detail here is that the compiler segfaults during compilation, it is not a runtime issue.

The error log suggests I submit a bug to GNU, however I thought it would be appropriate to inform you first because this occurs in the context of xmake, and may be a side effect of some incorrect input.

Expected Behavior

The compilation is successful.

Project Configuration

Here's the project.zip as is.
For convenience, I'll also embed the included source code bellow.

add_rules("mode.debug", "mode.release")

target("tmp")
    set_kind("binary")
    add_files("src/*.cpp")
    set_languages("c11", "cxx23")
    set_policy("build.c++.modules", true)
    add_files("src/*.mpp")
import mymod;

#include <iostream>

using namespace std;

int main(int argc, char** argv)
{
    cout << "hello world!" << words();
    return 0;
}
export module mymod;

export const char* words() {
    return "hello world!\n";
}

Additional Information and Error Logs

$ xmake -v
[  0%]: <tmp> generating.module.deps src/main.cpp
/usr/bin/gcc -E -x c++ -m64 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -std=c++23 -D_GLIBCXX_USE_CXX11_ABI=0 -DNDEBUG src/main.cpp -o build/.gens/tmp/linux/x86_64/release/rules/bmi/cache/modules/b47db9d3/main.cpp.i
[ 28%]: <tmp> compiling.module.release mymod
/usr/bin/gcc -c -m64 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -std=c++23 -fmodules-ts -D_GLIBCXX_USE_CXX11_ABI=0 -DNDEBUG -fmodule-mapper=/tmp/.xmake1000/250123/tmp/src/two.mpp -x c++ -o build/.objs/tmp/linux/x86_64/release/src/two.mpp.o src/two.mpp
error: src/two.mpp:5:1: internal compiler error: Segmentation fault
    5 | }
      | ^
0x1153292 internal_error(char const*, ...)
        ???:0
0xbee18d elf_out::write(data const&)
        ???:0
0xbee3cb elf_out::end()
        ???:0
0x17ae6a5 c_common_parse_file()
        ???:0
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-13/README.Bugs> for instructions.
@waruqi
Copy link
Member

waruqi commented Jan 23, 2025

maybe gcc issue

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

No branches or pull requests

2 participants