<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/202205>202205</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Assertion failure in X86_64ABIInfo::GetINTEGERTypeAtOffset for SysV x86_64 ABI with __uint128_t bitfield struct return
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          danieljwait
      </td>
    </tr>
</table>

<pre>
    ### Summary

Clang trunk assertion build crashes during LLVM IR generation on x86_64.

Non-assertion builds of Clang accept this testcase, as does GCC trunk. The issue does not reproduce when targetting `x86_64-pc-windows-msvc` or `aarch64-linux-gnu`.

### Revision

```
clang version 23.0.0git (https://github.com/llvm/llvm-project.git baa69e929b67543682452e9d9f9ebbd76790ad42)
Target: x86_64-unknown-linux-gnu
Build config: +assertions
```

### Reduced testcase

```c
typedef struct {
  __uint128_t : 124;
  __uint128_t f2 : 4;
} s;

s foo(void) {
  return (s){0};
}
```

### Reproduction command

```bash
clang -target x86_64-linux-gnu -emit-llvm -S test.c
```

### Observed behaviour

Clang aborts with the following assertion failure:

```
Assertion `IROffset == 0' failed.
```

Triggered at:

```
clang/lib/CodeGen/Targets/X86.cpp:2540
```

Relevant stack frames:

```
X86_64ABIInfo::GetINTEGERTypeAtOffset
X86_64ABIInfo::computeInfo
```

The crash occurs during LLVM IR generation:

```
test.c:6:3: LLVM IR generation of declaration 'foo'
test.c:6:3: Generating code for declaration 'foo'
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVV1vozgU_TXOyxXIMV_hgQfSTqpIszNSpxrNW2XsC3hK7Mg2yfTfrww07bbZaldCasP1_TjnHh-4c6rTiBXJtiS7XfHR98ZWkmuFw-8zV37VGPlcEZbMD_wYDwdunwmtCa1vBq478HbUT8CdQ-uV0dCMapAgLHc9OpCjVb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