https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125668
Bug ID: 125668
Summary: forwprop increases alignment requirements
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: kristerw at gcc dot gnu.org
Blocks: 118443
Target Milestone: ---
The fix for PR125296 fixed most cases I saw when compiling the Linux kernel
with smtgcc, but there are a few remaining where forwprop increases alignment
requirements by transforming
_1 = &buf_7->y;
_2 ={v} MEM[(volatile int *)_1];
into
_2 ={v} MEM <struct S2> [(volatile int *)p_5(D)].bufs[i_6(D)].y;
This can be seen when compiling the function below on x86_64 with -O2
-fno-strict-aliasing:
struct S {
long x;
int y;
};
struct S2 {
struct S bufs[];
};
void foo(struct S2 *p, int i)
{
struct S *buf = &p->bufs[i];
if (*((volatile int *)&buf->y) < 0)
*((volatile int *)&buf->y) = 0;
}
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118443
[Bug 118443] [Meta bug] Bugs triggered by and blocking more smtgcc testing