<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/118138>118138</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] Flag `-mlong-double-128` causes segfault
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
kozakaron
</td>
</tr>
</table>
<pre>
The following code causes segmentation fault when compiled with the `-mlong-double-128` flag on Windows 11:
~~~c
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
~~~
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVF1v2zYU_TX0y4UEirJl-UEPsl21A7otSFr0saDEa4kLRRr88Ece8tsHSk6bLNswDLBhg_fcw8NzP7hzsteIFVltyWq_4MEPxlaP5ok_cmv0ojXiWn0ZEA5GKXOWuofOCISOB4cOHPYjas-9NBoOPCgP5wE1dGY8SoUCztIP4AcEUtBkVEb3iTChVZhkrCQFhYPiPRgN36QW5uwgy0heE1o_Pz93hNZSexi51ISVhG0Ircl6S2gNABDJYCaDC5B8D1lKP5P8JX4Bwup4zObjeEZYQ1gDneVuQAcDWoycc4JFH6wGOlOQ9X6WMQPug3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