<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/113015>113015</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
A Stack dump Error when emit CIR
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
maijun-sec
</td>
</tr>
</table>
<pre>
The source code is as follows:
``` c
#include <stdio.h>
#include <malloc.h>
#include "test.h"
void StructureAlignmentMallocBadCase01()
{
char *p = malloc(5);
free(p);
}
void test() {
long x = 4L;
}
void testcase_bad_01(float largeFloat) {
float result = 5.11 - largeFloat;
}
void testcase_bad_02(double negativeDouble) {
double result = 3.14159265358979323846 - negativeDouble;
}
int main() {
int x;
printf("%d\n", x);
char c = -1;
if (c < 0) {
printf("c is negative\n");
} else {
printf("c is non-negative\n");
}
return 0;
}
```
The command line is as follows:
``` bash
/mnt/d/wsl/tools/LLVM-19.1.2-Linux-X64/bin/clang -S -Xclang -emit-cir -o output.cir test.c
```
The error message is as follows:
``` text
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /mnt/d/wsl/tools/LLVM-19.1.2-Linux-X64/bin/clang -S -Xclang -emit-cir -o output.cir test.c
#0 0x0000560d9ea3eb78 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/mnt/d/wsl/tools/LLVM-19.1.2-Linux-X64/bin/clang+0x695db78)
#1 0x0000560d9ea3c00e llvm::sys::RunSignalHandlers() (/mnt/d/wsl/tools/LLVM-19.1.2-Linux-X64/bin/clang+0x695b00e)
#2 0x0000560d9e998c87 CrashRecoverySignalHandler(int) (.llvm.17117292872744395150) CrashRecoveryContext.cpp:0:0
#3 0x00007f4c0c8f0320 (/lib/x86_64-linux-gnu/libc.so.6+0x45320)
#4 0x0000560d9f8d90e0 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/mnt/d/wsl/tools/LLVM-19.1.2-Linux-X64/bin/clang+0x77f80e0)
#5 0x0000560da3a00b30
clang: error: clang frontend command failed with exit code 133 (use -v to see invocation)
clang version 19.1.2 (/home/runner/work/llvm-project/llvm-project/clang 7ba7d8e2f7b6445b60679da826210cdde29eaf8b)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /mnt/d/wsl/tools/LLVM-19.1.2-Linux-X64/bin
clang: error: unable to execute command: Segmentation fault
clang: note: diagnostic msg: Error generating preprocessed source(s).
```
I am using the release: https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.2/LLVM-19.1.2-Linux-X64.tar.xz.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8V99v2zgS_mvol4EFivr94AfXiXEFskDRFId9KyhyJHNLkQZJ2e799QdKcmOn6eXudrFBYlMacuabb4YfGe696g3ihhQfSPGw4mM4WLcZuPpjNGuPYtVa-X3z5YDg7egEgrASQXngHjqrtT17km0JfSB0S0o6_4JYXrBMGaFHiUCynQ9S2eRAsse3rAPX2opfmBkL6ENyIIwtxunzZJWE5-BGEUaHW616M6AJv02uPnC54x5pSlhNWLOsqz7MAwAAceAOCNsegWQPMAMgrC7i7OxmXucQCauPt-9J9fATkohxDgZ3cbQ1PVymIPnTux4E9_i15fLrhLzTlgfQ3PW4j8PXzme7Qz_qMEUokjSF9e2K_z4gI6yWdmw1gsGeB3XCh-nxp5SWWTdxsyTN06JhZZEVdVM1GcvqvIT1a0-_QDN_KhNg4Mq8xWK0XV7qcnTKhG6ayAgrJCl2Zhru4HJXqPtyiwnsOr0rsOqAsDqadkDvA9-GEbHvr-n8iHffK6R6ANQe77HHn589WbN-39vrLByG0RmgbxB53X63S-LOFXYYuJGglXl_67bcH64bcD-YQNheErY_e03YPlirPWH7p6d__rZOmyRN2PpJmfGy_r3MCdu3sXR7obnpYf0M69-XIQ4qrIVysLZgx3AcQxKfpk0t3kGPzlkHA3rP-_fhB7y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