On Mon, 2016-02-22 at 19:20 -0800, H.J. Lu wrote:
> It caused:
> 
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69911

Apologies. Apparently main_input_filename can be NULL. I am not entirely
sure when that happens. Or how I failed to see that test failure. I
think I didn't have java enabled, causing libffi to be skipped.

I am testing this patch that skips the test in that case:

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 49f6c25..788f07e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2016-02-23  Mark Wielaard  <m...@redhat.com>
+
+       PR c/69911
+       * cgraphunit.c (check_global_declaration): Check main_input_filename
+       is not NULL.
+
 2016-02-20  Mark Wielaard  <m...@redhat.com>
 
        PR c/28901
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 27a073a..6c14be2 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -944,8 +944,9 @@ check_global_declaration (symtab_node *snode)
        || (((warn_unused_variable && ! TREE_READONLY (decl))
            || (warn_unused_const_variable > 0 && TREE_READONLY (decl)
                && (warn_unused_const_variable == 2
-                   || filename_cmp (main_input_filename,
-                                    DECL_SOURCE_FILE (decl)) == 0)))
+                   || (main_input_filename != NULL
+                       && filename_cmp (main_input_filename,
+                                        DECL_SOURCE_FILE (decl)) == 0))))
           && TREE_CODE (decl) == VAR_DECL))
       && ! DECL_IN_SYSTEM_HEADER (decl)
       && ! snode->referred_to_p (/*include_self=*/false)

Reply via email to