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

    <tr>
        <th>Summary</th>
        <td>
            Argument -fshort-enums and __attribute__((packed)) on enums are ignored
        </td>
    </tr>

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

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

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

<pre>
    When specifying `-fshort-enums` in the command line or marking an enum with `__attribute__((packed))`, the size of the enum should be smaller than an `int` if all the values in the enum fit in a `short` or a `char`, however the size of the enum is 4 bytes.
I'm facing this issue on the LLVM 17.0.3 Win32 builds.

## Repro
main.c:
```
#include <assert.h>

enum __attribute__((packed)) BYTE_ENUM {
        A = 0,
        B = 1
};

static_assert(sizeof(enum BYTE_ENUM) == 1, "Size of BYTE_ENUM should be 1 byte.");
```

Command line: `clang main.c -fshort-enums` (or `clang main.c` since we are adding the attribute to the enum anyway)

## Screenshot
![image](https://github.com/llvm/llvm-project/assets/47226783/35a9245c-3212-47fd-b461-fb94a6741bad)

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVEuP2zYQ_jWjy8ACNdTzoMN6vQYKJD00bYOeDEqiLDYSaZDUGu6vL0g_dpsUWAQgaHM0j2--b0jhnDpqKVsotlDsErH6ydj2PF1O0iedGS7t10lqdCfZq_Gi9BGhZJvRTcb6jdTr4qBkqDT6SWJvlkXoAWelJRqLi7DfQojQGFzxrPwU4g8H4b1V3erl4QBUA9Un0X-TA1ATVsmAnmNGp_6RaMb4P6Zwk1nnATuJbhHzLC36SehQAUqmtI9oRhTzHGNexbxKd8cXM4zKh7MIAbGNEGLs1dBPwt7KT-YsX2P-_4GhHObYXbx0KbAdsKdfgKoFR9GHfv2kHCrnVonmWvnTpz8_Y1alLOX4VWlO2K1qHu7Rt504EMff5Mmaq2URSqc98LtDyW7r7q90P6-DRODPwjlpfToBf3mfNML9gHDc_vX7y-Hl1z8-I1Tbe3TzhMB3GMh4mLbRlN3O1Q749n0x54VX_eEKBagOvJkRqI4oHlVCSeC7ayp6RiD6cmP4Dcmb0llkOgWiAPdR8Tsy4v78bgKBP0VJZ6GPeGUSf5hcoNrY793CB6d0L_EsUViJYhiuukp8EInevM2D0JezuAR4P-r5pbdSajcZfzdnUGzVIo4Sih1QPXl_ckFk2gPtj8pPa5f2ZgHaz_Pr_WdzsuZv2XugfeDXO6B9XhGVVc2B9rwQDeVFv-GU0SavxmHT5WW2GbsmF2WVZ50YHviSoeVDwxuRyDYrm7rMmiKrk6ltunIg0TdZzfhQ9owXjBWi6bNM1KzM6kS1xIhnjBqivMjqVDT1yJuhKMasEN04QM7kItScBsypscckXoS2YiWrkll0cnbxtSHS8ny9JUHZYpfYNvbZrUcHOZuV8-4ti1d-lu2TPa6L1P6_QmKQ_KMZN9dHyEVB1VEbK4dktXP70_RHzIH-2NO_AQAA__9A0pmY">