Skip to content

[clang] Flag -mlong-double-128 causes segfault #118138

@kozakaron

Description

@kozakaron

The following code causes segmentation fault when compiled with the -mlong-double-128 flag on Windows 11:

int main()
{
    long double x = 1.0L;
    x *= 2.0L;    // crashes here

    return 0;
}

Runs flawlessly with GCC, and with Ubuntu Clang in WSL. Also runs fine without the flag or with -mlong-double-64 or -mlong-double-80 . Also fails with clang++.

Normal operation

D:\> clang -o bug_report bug_report.c
D:\> .\bug_report.exe

Returns with code 0 almost instantly.

Error

D:\> clang -o bug_report bug_report.c -mlong-double-128
D:\> .\bug_report.exe

Runs for seconds, and returns a non-zero value. Gnu debugger says, it had segmentation fault after executing the marked line.

Environment

  • OP Sys: Windows 11 Pro 23H2
  • CPU: AMD Ryzen 7 5800H
D:\> clang --version
(built by Brecht Sanders) clang version 16.0.6
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: C:/mingw64/bin

Metadata

Metadata

Assignees

No one assigned

    Labels

    clangClang issues not falling into any other category

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions