https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70871
Bug ID: 70871
Summary: questionable optimisation in fold-const.c
Product: gcc
Version: 5.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
Target Milestone: ---
typedef struct X
{
void *a;
long int b;
int c;
int d;
unsigned int e[3];
unsigned short f;
unsigned char g;
unsigned char h;
unsigned char i;
unsigned char j;
unsigned char k;
unsigned char l;
unsigned char m;
unsigned char n;
};
int somefunc(void)
{
struct X *pX = (0L);
extern void call(void*);
call(&pX);
if(!pX->n && !pX->l)
return 0;
return 1;
}
for -O1 and higher
if(!pX->n && !pX->l)
results in (tree-original)
if ((BIT_FIELD_REF <*pX, 64, 320> & 280379743272960) == 0)
which eventually results in
ASAN_CHECK (6, _1, 8, 8)
when using -fsantize=address
Wheras ASAN really should be reporting a 2x 1 byte load and not 1x 8.
Thanks