]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Resolve ICE in 'gcc/fortran/trans-openmp.cc:gfc_omp_call_is_alloc'
authorThomas Schwinge <thomas@codesourcery.com>
Mon, 11 Dec 2023 21:52:54 +0000 (22:52 +0100)
committerThomas Schwinge <thomas@codesourcery.com>
Mon, 11 Dec 2023 22:07:17 +0000 (23:07 +0100)
Fix-up for recent commit 2505a8b41d3b74a545755a278f3750a29c1340b6
"OpenMP: Minor '!$omp allocators' cleanup", which caused:

    {+FAIL: gfortran.dg/gomp/allocate-5.f90   -O  (internal compiler error: tree check: expected class 'type', have 'declaration' (function_decl) in gfc_omp_call_is_alloc, at fortran/trans-openmp.cc:8386)+}
    [-PASS:-]{+FAIL:+} gfortran.dg/gomp/allocate-5.f90   -O  (test for excess errors)

..., and similarly in 'libgomp.fortran/allocators-1.f90',
'libgomp.fortran/allocators-2.f90', 'libgomp.fortran/allocators-3.f90',
'libgomp.fortran/allocators-4.f90', 'libgomp.fortran/allocators-5.f90'.

gcc/fortran/
* trans-openmp.cc (gfc_omp_call_is_alloc): Resolve ICE.

gcc/fortran/trans-openmp.cc

index 95184920cf7063919b461956eb48cf15f0d8d853..f7c73a5d2734c9ea613ed288bf5e505ff2e9194f 100644 (file)
@@ -8381,10 +8381,10 @@ gfc_omp_call_is_alloc (tree ptr)
     {
       fn = build_function_type_list (boolean_type_node, ptr_type_node,
                                     NULL_TREE);
-      fn = build_fn_decl ("GOMP_is_alloc", fn);
       tree att = build_tree_list (NULL_TREE, build_string (4, ". R "));
       att = tree_cons (get_identifier ("fn spec"), att, TYPE_ATTRIBUTES (fn));
       fn = build_type_attribute_variant (fn, att);
+      fn = build_fn_decl ("GOMP_is_alloc", fn);
     }
   return build_call_expr_loc (input_location, fn, 1, ptr);
 }