This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gfortran,patch] Fix spuriouis warnings about anonymous variables


Hi all,

I've been tracking the source of PR29459, which is a warning about a
possibly used-uninitialized anonymous variable. The variable is not,
in fact, used uninitialized, but the middle-end is not smart enough to
see this, causing the warning.

As I said in the PR, after finding the place where this temporary is
generated, I could have set its TREE_NO_WARNING, but it seemed to me
that there is little point to emit warnings about anonymous variables
(front-end generated temporaries) in any case! They don't help the
user, and the corresponding bug-reports tend to be not fixed quickly
because a) it's only a diagnostic problem and b) they can be hard to
track down.

For this reasons, I suggest that we stop emitting warnings for
anonymous variables generated by the front-end, in all cases.
Regtested on x86_64-linux, OK to commit?

FX



:ADDPATCH fortran:

2007-08-15  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

        PR fortran/29459
        * trans.c (gfc_create_var_np): Do not emit warnings for
        anonymous variables.



Index: trans.c
===================================================================
--- trans.c     (revision 127490)
+++ trans.c     (working copy)
@@ -102,7 +102,15 @@ remove_suffix (char *name, int len)
 tree
 gfc_create_var_np (tree type, const char *prefix)
 {
-  return create_tmp_var_raw (type, prefix);
+  tree t;
+
+  t = create_tmp_var_raw (type, prefix);
+
+  /* No warnings for anonymous variables.  */
+  if (prefix == NULL)
+    TREE_NO_WARNING (t) = 1;
+
+  return t;
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]