http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50590
Bug #: 50590
Summary: Initializing a variable to itself yields garbage/UB
and no warning.
Classification: Unclassified
Product: gcc
Version: 4.5.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: [email protected]
ReportedBy: [email protected]
Exact version string:
gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2
This is very similar to: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10538
But weirdly, while:
int x = x + 1;
Does yield a warning, this:
int x = x;
does not.
This may accidentally happen in e.g macros:
#define F(_x) \
int _x = x;
... use _x ...
expands to:
int x = x;
use x;