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

    <tr>
        <th>Summary</th>
        <td>
            Alignment discrepancies between clang and avr-gcc for `short`, `long long`, and `double`
        </td>
    </tr>

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

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

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

<pre>
    Not sure if this is intentional on the clang side, but I thought I'd at least open an issue to find out. :slightly_smiling_face:

```console
❯ avr-gcc --version
avr-gcc (GCC) 5.4.0
❯ clang --version
clang version 18.1.8
❯ avr-gcc -fsyntax-only avr.c
❯ cat avr.c
_Static_assert(sizeof(char) == 1, "sizeof(char) == 1");
_Static_assert(_Alignof(char) == 1, "_Alignof(char) == 1");
_Static_assert(__alignof(char) == 1, "__alignof(char) == 1");

_Static_assert(sizeof(short) == 2, "sizeof(short) == 2");
_Static_assert(_Alignof(short) == 1, "_Alignof(short) == 1");
_Static_assert(__alignof(short) == 1, "__alignof(short) == 1");

_Static_assert(sizeof(unsigned short) == 2, "sizeof(unsigned short) == 2");
_Static_assert(_Alignof(unsigned short) == 1, "_Alignof(unsigned short) == 1");
_Static_assert(__alignof(unsigned short) == 1, "__alignof(unsigned short) == 1");

_Static_assert(sizeof(int) == 2, "sizeof(int) == 2");
_Static_assert(_Alignof(int) == 1, "_Alignof(int) == 1");
_Static_assert(__alignof(int) == 1, "__alignof(int) == 1");

_Static_assert(sizeof(unsigned int) == 2, "sizeof(unsigned int) == 2");
_Static_assert(_Alignof(unsigned int) == 1, "_Alignof(unsigned int) == 1");
_Static_assert(__alignof(unsigned int) == 1, "__alignof(unsigned int) == 1");

_Static_assert(sizeof(long) == 4, "sizeof(long) == 4");
_Static_assert(_Alignof(long) == 1, "_Alignof(long) == 1");
_Static_assert(__alignof(long) == 1, "__alignof(long) == 1");

_Static_assert(sizeof(unsigned long) == 4, "sizeof(unsigned long) == 4");
_Static_assert(_Alignof(unsigned long) == 1, "_Alignof(unsigned long) == 1");
_Static_assert(__alignof(unsigned long) == 1, "__alignof(unsigned long) == 1");

_Static_assert(sizeof(long long) == 8, "sizeof(long long) == 8");
_Static_assert(_Alignof(long long) == 1, "_Alignof(long long) == 1");
_Static_assert(__alignof(long long) == 1, "__alignof(long long) == 1");

_Static_assert(sizeof(unsigned long long) == 8, "sizeof(unsigned long long) == 8");
_Static_assert(_Alignof(unsigned long long) == 1, "_Alignof(unsigned long long) == 1");
_Static_assert(__alignof(unsigned long long) == 1, "__alignof(unsigned long long) == 1");

_Static_assert(sizeof(float) == 4, "sizeof(float) == 4");
_Static_assert(_Alignof(float) == 1, "_Alignof(float) == 1");
_Static_assert(__alignof(float) == 1, "__alignof(float) == 1");

_Static_assert(sizeof(double) == 4, "sizeof(double) == 4");
_Static_assert(_Alignof(double) == 1, "_Alignof(double) == 1");
_Static_assert(__alignof(double) == 1, "__alignof(double) == 1");

_Static_assert(sizeof(long double) == 4, "sizeof(long double) == 4");
_Static_assert(_Alignof(long double) == 1, "_Alignof(long double) == 1");
_Static_assert(__alignof(long double) == 1, "__alignof(long double) == 1");
❯ clang --target=avr -fsyntax-only avr.c
clang: warning: no target microcontroller specified on command line, cannot link standard libraries, please pass -mmcu=<mcu name> [-Wavr-rtlib-linking-quirks]
avr.c:6:16: error: static assertion failed due to requirement '_Alignof(short) == 1': _Alignof(short) == 1
    6 | _Static_assert(_Alignof(short) == 1, "_Alignof(short) == 1");
      |                ^~~~~~~~~~~~~~~~~~~~
avr.c:6:32: note: expression evaluates to '2 == 1'
    6 | _Static_assert(_Alignof(short) == 1, "_Alignof(short) == 1");
      |                ~~~~~~~~~~~~~~~~^~~~
avr.c:7:16: error: static assertion failed due to requirement '__alignof(short) == 1': __alignof(short) == 1
    7 | _Static_assert(__alignof(short) == 1, "__alignof(short) == 1");
      |                ^~~~~~~~~~~~~~~~~~~~~
avr.c:7:33: note: expression evaluates to '2 == 1'
    7 | _Static_assert(__alignof(short) == 1, "__alignof(short) == 1");
      |                ~~~~~~~~~~~~~~~~~^~~~
avr.c:10:16: error: static assertion failed due to requirement '_Alignof(unsigned short) == 1': _Alignof(unsigned short) == 1
   10 | _Static_assert(_Alignof(unsigned short) == 1, "_Alignof(unsigned short) == 1");
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
avr.c:10:41: note: expression evaluates to '2 == 1'
   10 | _Static_assert(_Alignof(unsigned short) == 1, "_Alignof(unsigned short) == 1");
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
avr.c:11:16: error: static assertion failed due to requirement '__alignof(unsigned short) == 1': __alignof(unsigned short) == 1
   11 | _Static_assert(__alignof(unsigned short) == 1, "__alignof(unsigned short) == 1");
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
avr.c:11:42: note: expression evaluates to '2 == 1'
   11 | _Static_assert(__alignof(unsigned short) == 1, "__alignof(unsigned short) == 1");
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
avr.c:31:16: error: static assertion failed due to requirement '__alignof(long long) == 1': __alignof(long long) == 1
   31 | _Static_assert(__alignof(long long) == 1, "__alignof(long long) == 1");
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~
avr.c:31:37: note: expression evaluates to '8 == 1'
   31 | _Static_assert(__alignof(long long) == 1, "__alignof(long long) == 1");
      |                ~~~~~~~~~~~~~~~~~~~~~^~~~
avr.c:35:16: error: static assertion failed due to requirement '__alignof(unsigned long long) == 1': __alignof(unsigned long long) == 1
   35 | _Static_assert(__alignof(unsigned long long) == 1, "__alignof(unsigned long long) == 1");
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
avr.c:35:46: note: expression evaluates to '8 == 1'
   35 | _Static_assert(__alignof(unsigned long long) == 1, "__alignof(unsigned long long) == 1");
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
avr.c:43:16: error: static assertion failed due to requirement '__alignof(double) == 1': __alignof(double) == 1
   43 | _Static_assert(__alignof(double) == 1, "__alignof(double) == 1");
      |                ^~~~~~~~~~~~~~~~~~~~~~
avr.c:43:34: note: expression evaluates to '4 == 1'
   43 | _Static_assert(__alignof(double) == 1, "__alignof(double) == 1");
      |                ~~~~~~~~~~~~~~~~~~^~~~
7 errors generated.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMms9y4jgQxp9GXLqgbMl_8IEDEyZbc9nLHvaYErYw2pElVpIzyR722bdsJ5kJlm2ZkFooimHkr1v0j08K6jI1hpeSsQ2Kv6B4t6C1PSq9oYI96dNir4rnze_Kgqk1A34Ae-QGmqe0TFquJBWgJNgjg1xQWYLhBUP4Dva1hW9gj6oujxa-IZwWQC0IRo0FdWISqARuTM3AKjhwWYCq7QoQ2RrBy6MVzw-m4oLL8uFAc4bIFgU7FLy-JkH3zJU0SrCX0a8YZTu0vQf6qJdlnsNy-ci04Up2gtdhhNe_3d0hnEG8ilbBeXRXyllsN_gyBOF6Fa7Wg9MezLO09GmppHhuRld5bw5qf73w8IellucP1BimLcJrw_9h6oDwOj9S3XxSRHaI7CBs6CKMR65jhDNEvgwkftgKXsqx1KOKieQPdDL7qORd-ik05qiagbd4fM7GIfCGcx7roOOQ-OMZzD-umQWolu3qLmCS1JjSG9lgEge7Ma0_xOkZPcWzsHI5yrJ32Rvg-0gHtZ7AH9VA7jHFZV6boDOsm--zSV7Dygs8Nk3Qc7oplELJ8pfw6Bxh_7o3urNQB7K-wh_VUPZRyWUum2I0Ipzvs2lqI9ILnObB0XdCH6-d51i7DOcQzXKdB8QB2Tz_-cDzmWiWEycJTqkv8-RcY17PnbMt-lHcB6GoHVvwDoE31PNYB0eHxB_dYP5xzSxAhar3go0Rcim8EfWCHYxcGn9IwzNMiObvd9OsBmXz9jwfaoPCmfueFz-_yfpHYUt1ySwiO_qoh4-3rRqRLfygWvLurVTQBUPFc61yJa1WQjAN5sR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