]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix ICE in nested-function-1.c testcase
authorKwok Cheung Yeung <kcy@codesourcery.com>
Fri, 13 May 2022 15:46:36 +0000 (16:46 +0100)
committerKwok Cheung Yeung <kcy@codesourcery.com>
Tue, 28 Jun 2022 20:55:30 +0000 (13:55 -0700)
The ICE occurs during Gimple verification after the ompexp stage because
one of the arguments to the generated builtin call is of a Gimple reg type,
but isn't a Gimple value (because it is marked addressable).

This appears to be fallout from the commit "OpenACC 'kernels' decomposition:
Mark variables used in synthesized data clauses as addressable [PR100280]".
The launch dimensions have been added to the arguments of a builtin call
by oacc_set_fn_attrib, but one of the dimensions has been marked addressable.

Fixed by forcing the added arguments to be re-gimplified.

2022-05-13  Kwok Cheung Yeung  <kcy@codesourcery.com>

gcc/
* omp-expand.cc (expand_omp_target): Gimplify launch dimensions used
in function call.

gcc/ChangeLog.omp
gcc/omp-expand.cc

index 1a9d3c507b55739fc81c3cd451660589cebbe926..29740139fd2a2c0547c35aaa41bac05f11cb8b39 100644 (file)
@@ -1,3 +1,8 @@
+2022-05-13  Kwok Cheung Yeung  <kcy@codesourcery.com>
+
+       * omp-expand.cc (expand_omp_target): Gimplify launch dimensions used
+       in function call.
+
 2022-04-14  Kwok Cheung Yeung  <kcy@codesourcery.com>
 
        * graphite-oacc.cc (find_oacc_tail_marks): Check that data_dep is
index 1c512b385e86fa3a95bc71635bdd0a188464ea07..f228210cc60109bb4867d0fb6365f294b88beaa4 100644 (file)
@@ -10274,7 +10274,15 @@ expand_omp_target (struct omp_region *region)
          oacc_replace_fn_attrib (child_fn, dims);
        }
       else
-       oacc_set_fn_attrib (child_fn, clauses, &args);
+       {
+         unsigned int args_before = args.length ();
+
+         oacc_set_fn_attrib (child_fn, clauses, &args);
+         for (unsigned int ix = args_before; ix < args.length (); ix++)
+           args[ix] = force_gimple_operand_gsi (&gsi, args[ix], true,
+                                                NULL_TREE, true,
+                                                GSI_SAME_STMT);
+       }
       tagging = true;
       /* FALLTHRU */
     case BUILT_IN_GOACC_ENTER_DATA: