User account creation filtered due to spam.

Bug 45493

Summary: -Wuninitialized does not warn
Product: gcc Reporter: Tad Hunt <tadhunt>
Component: cAssignee: Not yet assigned to anyone <unassigned>
Severity: normal CC: christoph.mallon, david.cuthbert, dberlin, dhill, fredrik, gcc-bugs, hp, jellegeerts, manu, mark, mueller, P.Schaffnit, pinskia, roche+gccbugs, satyam, tadhunt, thutt, vincent-gcc
Priority: P3    
Version: 4.4.1   
Target Milestone: ---   
Host: x86_64-linux-gnu Target: x86_64-linux-gnu
Build: x86_64-linux-gnu Known to work:
Known to fail: Last reconfirmed:

Description Tad Hunt 2010-09-02 03:40:47 UTC
When the first use of an uninitialized variable is inside a loop, no warning is generated when -Wuninitialized is turned on.

	int len, i;

	for(i = 0; i < 5; i++) {
		printf("%d\n", len);		// no warning!
		len = 10;

	return 0;
Comment 1 Tad Hunt 2010-09-02 03:42:23 UTC
Same behavior on 4.4.3 & 4.4.1 (same host, target & build)

Forgot to mention:

gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5) 
gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu9) 
Comment 2 Richard Biener 2010-09-02 09:12:02 UTC
It's just optimized to always print 10 and the maybe-uninitialized warning
code runs too late.

A dup of some other PR.
Comment 3 Tad Hunt 2010-09-02 16:08:20 UTC
(In reply to comment #2)

Richard, thanks for the confirmation.

This is a great feature that we've come to rely on over the years for catching rookie errors.

This might not appear in comments very often, but I appreciate the hard work you and the rest of the gcc folks put in.
Comment 4 Manuel López-Ibáñez 2010-09-02 22:50:48 UTC
CCP is responsible for this.

*** This bug has been marked as a duplicate of 18501 ***