https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114030
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Summary|redundant load of inline |redundant load due to
|function's arguments |unions and different size
| |loads
Status|UNCONFIRMED |NEW
Last reconfirmed| |2024-02-21
Severity|normal |enhancement
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase:
```
union U0 {
int f2;
char f4;
};
int g_3;
union U0 g_34 = {-1L};
char func_1() {
int t11 = g_34.f2;
char t1 = g_34.f4;
g_3 = t11;
return t1;
}
```
This is just due to unions. I am not sure if this is important to optimize
really since techincally the original code is undefined by the C/C++ standard
(though GCC does an extension which makes it defined). Unions used in this way
is not used much either.