]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Avoid ICE when passing VLA vector to accelerator.
authorPrathamesh Kulkarni <prathameshk@nvidia.com>
Thu, 5 Sep 2024 13:22:53 +0000 (18:52 +0530)
committerPrathamesh Kulkarni <prathameshk@nvidia.com>
Thu, 5 Sep 2024 13:22:53 +0000 (18:52 +0530)
gcc/ChangeLog:
* gimplify.cc (omp_add_variable): Check if decl size is not poly_int_tree_p.
(gimplify_adjust_omp_clauses): Likewise.
* omp-low.cc (scan_sharing_clauses): Likewise.
(lower_omp_target): Likewise.

Signed-off-by: Prathamesh Kulkarni <prathameshk@nvidia.com>
gcc/gimplify.cc
gcc/omp-low.cc

index 9300138aa0c719f99356c4d5304bacbf5b23f8f5..ceb53e5d5bb7434398d3e7a1aaf3cd58eff20efc 100644 (file)
@@ -7799,7 +7799,7 @@ omp_add_variable (struct gimplify_omp_ctx *ctx, tree decl, unsigned int flags)
   /* When adding a variable-sized variable, we have to handle all sorts
      of additional bits of data: the pointer replacement variable, and
      the parameters of the type.  */
-  if (DECL_SIZE (decl) && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST)
+  if (DECL_SIZE (decl) && !poly_int_tree_p (DECL_SIZE (decl)))
     {
       /* Add the pointer replacement variable as PRIVATE if the variable
         replacement is private, else FIRSTPRIVATE since we'll need the
@@ -14413,7 +14413,7 @@ gimplify_adjust_omp_clauses (gimple_seq *pre_p, gimple_seq body, tree *list_p,
                }
            }
          else if (DECL_SIZE (decl)
-                  && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST
+                  && !poly_int_tree_p (DECL_SIZE (decl))
                   && OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_POINTER
                   && OMP_CLAUSE_MAP_KIND (c) != GOMP_MAP_FIRSTPRIVATE_POINTER
                   && (OMP_CLAUSE_MAP_KIND (c)
index 4d003f42098a993838792992e721544d714a458d..241f79e34a9f39b12a43c5069e40a203bfd5cd2c 100644 (file)
@@ -1664,7 +1664,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
          if (DECL_P (decl))
            {
              if (DECL_SIZE (decl)
-                 && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST)
+                 && !poly_int_tree_p (DECL_SIZE (decl)))
                {
                  tree decl2 = DECL_VALUE_EXPR (decl);
                  gcc_assert (INDIRECT_REF_P (decl2));
@@ -1906,7 +1906,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
                    = remap_type (TREE_TYPE (decl), &ctx->cb);
                }
              else if (DECL_SIZE (decl)
-                      && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST)
+                      && !poly_int_tree_p (DECL_SIZE (decl)))
                {
                  tree decl2 = DECL_VALUE_EXPR (decl);
                  gcc_assert (INDIRECT_REF_P (decl2));
@@ -12750,7 +12750,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
          }
 
        if (DECL_SIZE (var)
-           && TREE_CODE (DECL_SIZE (var)) != INTEGER_CST)
+           && !poly_int_tree_p (DECL_SIZE (var)))
          {
            tree var2 = DECL_VALUE_EXPR (var);
            gcc_assert (TREE_CODE (var2) == INDIRECT_REF);
@@ -13077,7 +13077,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
            else
              {
                if (DECL_SIZE (ovar)
-                   && TREE_CODE (DECL_SIZE (ovar)) != INTEGER_CST)
+                   && !poly_int_tree_p (DECL_SIZE (ovar)))
                  {
                    tree ovar2 = DECL_VALUE_EXPR (ovar);
                    gcc_assert (TREE_CODE (ovar2) == INDIRECT_REF);