This patch makes one OpenACC-specific path in nvptx_record_offload_symbol
optional.

        * config/nvptx/nvptx.c (nvptx_record_offload_symbol): Allow missing
        OpenACC attributes.
---
 gcc/config/nvptx/nvptx.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c
index 53850a1..21c59ef 100644
--- a/gcc/config/nvptx/nvptx.c
+++ b/gcc/config/nvptx/nvptx.c
@@ -4026,19 +4026,22 @@ nvptx_record_offload_symbol (tree decl)
 
     case FUNCTION_DECL:
       {
-       tree attr = get_oacc_fn_attrib (decl);
-       tree dims = TREE_VALUE (attr);
-       unsigned ix;
-       
        fprintf (asm_out_file, "//:FUNC_MAP \"%s\"",
                 IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
 
-       for (ix = 0; ix != GOMP_DIM_MAX; ix++, dims = TREE_CHAIN (dims))
+       tree attr = get_oacc_fn_attrib (decl);
+       if (attr)
          {
-           int size = TREE_INT_CST_LOW (TREE_VALUE (dims));
+           tree dims = TREE_VALUE (attr);
+           unsigned ix;
 
-           gcc_assert (!TREE_PURPOSE (dims));
-           fprintf (asm_out_file, ", %#x", size);
+           for (ix = 0; ix != GOMP_DIM_MAX; ix++, dims = TREE_CHAIN (dims))
+           {
+             int size = TREE_INT_CST_LOW (TREE_VALUE (dims));
+
+             gcc_assert (!TREE_PURPOSE (dims));
+             fprintf (asm_out_file, ", %#x", size);
+           }
          }
 
        fprintf (asm_out_file, "\n");

Reply via email to