[Bug middle-end/57649] [4.7 Regression] ICE in set_is_used

ebotcazou at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jun 19 09:39:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57649

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-06-19
                 CC|                            |ebotcazou at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
We have this patchlet in our 4.7 tree:

--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -590,10 +590,13 @@ add_referenced_var (tree var)
       /* Scan DECL_INITIAL for pointer variables as they may contain
         address arithmetic referencing the address of other
         variables.  As we are only interested in directly referenced
-        globals or referenced locals restrict this to initializers
-        than can refer to local variables.  */
+        globals or referenced locals, restrict this to initializers
+        than can refer to local variables.  But we need to do it for
+        initializers of global variables declared in parent functions
+        lest these variables aren't referenced anywhere else.  */
       if (DECL_INITIAL (var)
-          && DECL_CONTEXT (var) == current_function_decl)
+         && (DECL_CONTEXT (var) == current_function_decl
+             || (!DECL_FILE_SCOPE_P (var) && is_global_var (var))))
        walk_tree (&DECL_INITIAL (var), find_vars_r, NULL, 0);

       return true;


    * tree-dfa.c (add_referenced_var): Find variables referenced in the
    initializers of global variables declared in parent functions.



More information about the Gcc-bugs mailing list