AMD GCN symbol output with null cfun
authorJulian Brown <julian@codesourcery.com>
Wed, 20 Nov 2019 17:58:30 +0000 (17:58 +0000)
committerJulian Brown <jules@gcc.gnu.org>
Wed, 20 Nov 2019 17:58:30 +0000 (17:58 +0000)
gcc/
* config/gcn/gcn.c (gcn_asm_output_symbol_ref): Handle null cfun.

Reviewed-by: Andrew Stubbs <ams@codesourcery.com>
From-SVN: r278518

gcc/ChangeLog
gcc/config/gcn/gcn.c

index 0f526b1a9f7f8ac36878524f4737db05d4bad23a..1d9001510ce90476f3c7667ba1f11ba2fabdfbbe 100644 (file)
@@ -1,3 +1,7 @@
+2019-11-20  Julian Brown  <julian@codesourcery.com>
+
+       * config/gcn/gcn.c (gcn_asm_output_symbol_ref): Handle null cfun.
+
 2019-11-20  Jan Hubicka  <jh@suse.cz>
 
        * ipa-fnsummary.c (ipa_fn_summary::account_size_time): Add CALL
index 4401896d4411e0b6ebad6a869ffbea1ede695511..26c1067e52ab78dd7b128f008b716af75be75df2 100644 (file)
@@ -5215,7 +5215,8 @@ void
 gcn_asm_output_symbol_ref (FILE *file, rtx x)
 {
   tree decl;
-  if ((decl = SYMBOL_REF_DECL (x)) != 0
+  if (cfun
+      && (decl = SYMBOL_REF_DECL (x)) != 0
       && TREE_CODE (decl) == VAR_DECL
       && AS_LDS_P (TYPE_ADDR_SPACE (TREE_TYPE (decl))))
     {
@@ -5230,7 +5231,8 @@ gcn_asm_output_symbol_ref (FILE *file, rtx x)
     {
       assemble_name (file, XSTR (x, 0));
       /* FIXME: See above -- this condition is unreachable.  */
-      if ((decl = SYMBOL_REF_DECL (x)) != 0
+      if (cfun
+         && (decl = SYMBOL_REF_DECL (x)) != 0
          && TREE_CODE (decl) == VAR_DECL
          && AS_LDS_P (TYPE_ADDR_SPACE (TREE_TYPE (decl))))
        fputs ("@abs32", file);