[Bug middle-end/107047] load introduced of struct/union fields after assigning it to a local variable
absoler at smail dot nju.edu.cn
gcc-bugzilla@gcc.gnu.org
Wed Oct 26 08:31:55 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107047
--- Comment #3 from absoler at smail dot nju.edu.cn ---
and for union there's similar behavior:
union U2 {
long long f0;
unsigned short f2;
int f4;
};
void func_17(union U2 p_20);
void func_1() {
func_17(g_39[0]);
}
void func_17(union U2 e) {
int *f = &g_30;
if (e.f0 || e.f2)
*f = e.f2;
}
are compiled with gcc-12.1 -O1 to:
0000000000402020 <func_1>:
func_17():
/home/csmith-2.3.0/test/output2.c:87
402020: 48 83 3d 68 3e 00 00 cmpq $0x0,0x3e68(%rip) #
405e90 <g_39>
402027: 00
402028: 74 0d je 402037 <func_1+0x17>
/home/csmith-2.3.0/test/output2.c:88
40202a: 0f b7 05 5f 3e 00 00 movzwl 0x3e5f(%rip),%eax #
405e90 <g_39>
402031: 89 05 71 3e 00 00 mov %eax,0x3e71(%rip) #
405ea8 <g_30>
uses of e.f0 and e.f2 are replaced by g_39[0]
More information about the Gcc-bugs
mailing list