diff options
Diffstat (limited to 'gcc/tree-ssa.c')
-rw-r--r-- | gcc/tree-ssa.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index f399833..32a01fb 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1613,7 +1613,7 @@ warn_uninit (enum opt_code wc, tree t, tree expr, tree var, const char *gmsgid, void *data) { gimple context = (gimple) data; - location_t location; + location_t location, cfun_loc; expanded_location xloc, floc; if (!ssa_undefined_value_p (t)) @@ -1631,8 +1631,12 @@ warn_uninit (enum opt_code wc, tree t, location = (context != NULL && gimple_has_location (context)) ? gimple_location (context) : DECL_SOURCE_LOCATION (var); + location = linemap_resolve_location (line_table, location, + LRK_SPELLING_LOCATION, + NULL); + cfun_loc = DECL_SOURCE_LOCATION (cfun->decl); xloc = expand_location (location); - floc = expand_location (DECL_SOURCE_LOCATION (cfun->decl)); + floc = expand_location (cfun_loc); if (warning_at (location, wc, gmsgid, expr)) { TREE_NO_WARNING (expr) = 1; @@ -1640,8 +1644,11 @@ warn_uninit (enum opt_code wc, tree t, if (location == DECL_SOURCE_LOCATION (var)) return; if (xloc.file != floc.file - || xloc.line < floc.line - || xloc.line > LOCATION_LINE (cfun->function_end_locus)) + || linemap_location_before_p (line_table, + location, cfun_loc) + || linemap_location_before_p (line_table, + cfun->function_end_locus, + location)) inform (DECL_SOURCE_LOCATION (var), "%qD was declared here", var); } } |