Bug 63701

Summary: trans-expr.c:1424: missing init for local variable "found"
Product: gcc Reporter: David Binderman <dcb314>
Component: fortranAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 5.0   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2014-10-31 00:00:00

Description David Binderman 2014-10-31 16:25:05 UTC
../../src/trunk/gcc/fortran/trans-expr.c:1424:25: warning: variable 'found' is used uninitialized whenever 'for' loop exits because its condition is false [-Wsometimes-uninitialized]

$ fgrep -n found gcc/fortran/trans-expr.c
1409:  bool found;
1438:	    found = true;
1442:  gcc_assert (found && caf_decl);

Missing init of "found" to false at line 1409.
Comment 1 ktkachov 2014-10-31 16:39:47 UTC
found is expected to be always set to true at line 1438, that's what the gcc_assert is for. But I agree that it should be initialised to false.
Comment 2 ktkachov 2014-11-11 11:53:08 UTC
Author: ktkachov
Date: Tue Nov 11 11:52:36 2014
New Revision: 217345

URL: https://gcc.gnu.org/viewcvs?rev=217345&root=gcc&view=rev
Log:
[Fortran] PR 63701 Make sure variable is always used initialised

	PR fortran/63701
	* trans-expr.c (gfc_get_tree_for_caf_expr): Initialise found to false.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-expr.c
Comment 3 ktkachov 2014-11-11 11:56:04 UTC
Fixed on trunk.