https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105917
Bug ID: 105917
Summary: Missed passthru jump function
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ipa
Assignee: unassigned at gcc dot gnu.org
Reporter: hubicka at gcc dot gnu.org
CC: marxin at gcc dot gnu.org
Target Milestone: ---
In this testcase:
struct a {int a;};
struct b {int b; struct a a;};
__attribute__ ((noinline))
static int
reta (struct a a)
{
return a.a;
}
__attribute__ ((noinline))
static int
retba (struct b b)
{
struct a *a = &b.a;
return reta(*a);
}
int
main()
{
struct b b = {1, {0}};
return retba (b);
}
There is aggregat passthru from retba to reta but we get:
_2 = reta (MEM[(struct a *)&b + 4B]);
Analyzing function: retba/1
function retba/1 parameter descriptors:
param #0 b used undescribed_use
Jump functions of caller retba/1:
callsite retba/1 -> reta/0 :
param 0: UNKNOWN
Unknown bits
Unknown VR
I constructed this to check dubious check for MEM_REF requiring offset to be 0.
However surprisingly we miss the following too:
struct a {int a;};
struct b {int b; struct a a;};
__attribute__ ((noinline))
static int
reta (struct a a)
{
return a.a;
}
__attribute__ ((noinline))
static int
retba (struct b b)
{
//struct a *a = &b.a;
//return reta(*a);
return reta (b.a);
}
int
main()
{
struct b b = {1, {0}};
return retba (b);
}
Jump functions of caller retba/1:
callsite retba/1 -> reta/0 :
param 0: UNKNOWN
Unknown bits
Unknown VR
I wonder which cases actually works :)