Hi! This issue would've been prevented if we'd actually use a distinct C++ data type for GCC types, checkable at compile time -- I'm thus CCing Andrew MacLeod for amusement or crying, "one more for the list!". ;-\ (See <https://inbox.sourceware.org/1acd7994-2440-4092-897f-97f14d3fb...@redhat.com> "[TTYPE] Strongly typed tree project. Original document circa 2017".)
On 2023-12-11T12:45:27+0100, Tobias Burnus <tob...@codesourcery.com> wrote: > I included a minor cleanup patch [...] > > I intent to commit that patch as obvious, unless there are further comments. > OpenMP: Minor '!$omp allocators' cleanup > --- a/gcc/fortran/trans-openmp.cc > +++ b/gcc/fortran/trans-openmp.cc > @@ -8361,8 +8361,10 @@ gfc_omp_call_add_alloc (tree ptr) > if (fn == NULL_TREE) > { > fn = build_function_type_list (void_type_node, ptr_type_node, > NULL_TREE); > + 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_add_alloc", fn); > -/* FIXME: attributes. */ > } > return build_call_expr_loc (input_location, fn, 1, ptr); > } > @@ -8380,7 +8382,9 @@ 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); > -/* FIXME: attributes. */ > + 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); > } > return build_call_expr_loc (input_location, fn, 1, ptr); > } Pushed to master branch commit 453e0f45a49f425992bc47ff8909ed8affc29d2e "Resolve ICE in 'gcc/fortran/trans-openmp.cc:gfc_omp_call_is_alloc'", see attached. Grüße Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
>From 453e0f45a49f425992bc47ff8909ed8affc29d2e Mon Sep 17 00:00:00 2001 From: Thomas Schwinge <tho...@codesourcery.com> Date: Mon, 11 Dec 2023 22:52:54 +0100 Subject: [PATCH] Resolve ICE in 'gcc/fortran/trans-openmp.cc:gfc_omp_call_is_alloc' 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc index 95184920cf7..f7c73a5d273 100644 --- a/gcc/fortran/trans-openmp.cc +++ b/gcc/fortran/trans-openmp.cc @@ -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); } -- 2.34.1