[Bug c/50590] New: Initializing a variable to itself yields garbage/UB and no warning.
eyal.lotem at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Oct 2 16:27:00 GMT 2011
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: unassigned@gcc.gnu.org
ReportedBy: eyal.lotem@gmail.com
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;
More information about the Gcc-bugs
mailing list