Bug 63701 - trans-expr.c:1424: missing init for local variable "found"
Summary: trans-expr.c:1424: missing init for local variable "found"
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 5.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-31 16:25 UTC by David Binderman
Modified: 2014-11-11 11:56 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2014-10-31 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.