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

    <tr>
        <th>Summary</th>
        <td>
            Mangled names for long double literals differ from GCC
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:codegen
      </td>
    </tr>

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

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

<pre>
    Example:
```
template<auto> struct A {};
void f(A<1.0l>) {}
```

Clang mangling:
```
clang version 18.1.0rc (https://github.com/llvm/llvm-project.git 461274b81d8641eab64d494accddc81d7db8a09e)
Target: x86_64-unknown-linux-gnu
mangling: _Z1f1AILe3fff8000000000000000EE
```

GCC mangling:
```
g++ (Compiler-Explorer-Build-gcc--binutils-2.42) 14.1.0
mangling: _Z1f1AILe0000000000003fff8000000000000000EE
```

The [Itanium-ABI ](https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling.literal) states:

> Floating-point literals are encoded using a fixed-length lowercase hexadecimal string corresponding to the internal representation, high-order bytes first. For example: "Lf bf800000 E" is -1.0f on platforms conforming to IEEE 754.

GCC appears to take the "internal representation" to mean the 16 bytes for the long double, Clang takes it to mean the bytes for the 80-bit representation. It's not clear to me which is correct, however it would be good if the mangling matched between the compilers.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVEuvmzgU_jXO5ggE5pkFiySXVFfq7LqaTWXsg_HU2Mg2SfrvRybJ3Hs7046KkMH2eXznOw_mvZIGsSPVkVQvO7aGybpuEPm-qQen_G6w4nvX39i8aCTFgWQvJDuQOnu82zbgvGgWkBQntgZLih58cCsPcADSHEnzQorjXfRilYCR0PZAilOeZpoUPaH7p9h_Wb-vJ82MhJkZqZWRP0PCN6kLOq-sgbxN8zRzHAhtpxAWH9XomdCzVGFah5TbmdCz1pfnJ1mc_Qt5SKUKUNY5bcqhzUVblzmyo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