https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70410
Bug ID: 70410
Summary: no uninitialized variable warning if 'offsetof' is
used in expression
Product: gcc
Version: 4.8.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: sergiusthebest at hotmail dot com
Target Milestone: ---
You can easily reproduce the issue with the following code:
#include
struct C
{
int x;
int y;
};
int main()
{
int a;
int b = a + offsetof(C, y); // <= missing warning that 'a' is uninitialized
return b;
}