<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/85570>85570</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`clang++-17` crashes in `clang::CodeGen::CodeGenModule::getNaturalTypeAlignment`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
xarantolus
</td>
</tr>
</table>
<pre>
Hey, I'm running into an issue running clang++-17 on a `c7g.medium` AWS ARM instance with the following file as input (`test.cpp`):
```cpp
#include <arm_sve.h>
#include <stddef.h>
namespace arm_sve_edge {
__attribute__((target("+sve"))) void compress() {
uint64_t vl = svcntb();
svuint8_t index_reg;
for (size_t j = 0; j < vl; j++) {
index_reg[j] = j;
}
}
}
```
Exact reproduction steps:
1. Start an `c7g.medium` instance with an Ubuntu 22.04.4 LTS AMI (exact AMI: `ami-02b7c7e61897b5e21` in `eu-central-1`)
2. Connect via SSH/Instance connect
3. Install clang like this (you might have to confirm some prompts):
```
cd /tmp && \
wget https://apt.llvm.org/llvm.sh && \
chmod +x llvm.sh && \
sudo ./llvm.sh 17 all
```
4. Create an example file:
```
nano test.cpp
```
5. Paste file content from above, Ctrl+x to save & exit
6. Run clang (with flags as described [here](https://llvm.org/docs/HowToSubmitABug.html#crashing-bugs)):
```
LLVM_SYMBOLIZER_PATH=llvm-symbolizer-17 clang++-17 -c -emit-llvm -Xclang -disable-llvm-passes test.cpp
```
This will produce the attached trace: [clang-output.txt](https://github.com/llvm/llvm-project/files/14627731/clang-output.txt), implying that this is a front-end bug.
The requested bug report files are in this file: [bug-report.zip](https://github.com/llvm/llvm-project/files/14627736/bug-report.zip). I couldn't quite get cvise or creduce to accept these as inputs, so I couldn't create a minimized version of the file. I hope it will still be useful.
This issue might be related to #45429.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVltv4zoO_jXKC2HDlm_JQx6Sd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