Message ID | 16bc2d0c-7228-43f8-803b-74a980510370@codesourcery.com |
---|---|
State | New |
Headers | show |
Series | OpenMP: Minor '!$omp allocators' cleanup - and still: Re: [patch] OpenMP/Fortran: Implement omp allocators/allocate for ptr/allocatables | expand |
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-97f14d3fbf45@redhat.com> "[TTYPE] Strongly typed tree project. Original document circa 2017".) On 2023-12-11T12:45:27+0100, Tobias Burnus <tobias@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
On 12/11/23 17:12, Thomas Schwinge wrote: > 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!". ;-\ Perhaps the time has come.... It is definitely under re-consideration for next stage 1... Andrew > (See > <https://inbox.sourceware.org/1acd7994-2440-4092-897f-97f14d3fbf45@redhat.com> > "[TTYPE] Strongly typed tree project. Original document circa 2017".) > > On 2023-12-11T12:45:27+0100, Tobias Burnus <tobias@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
OpenMP: Minor '!$omp allocators' cleanup gcc/fortran/ChangeLog: * trans-openmp.cc (gfc_omp_call_add_alloc, gfc_omp_call_is_alloc): Set 'fn spec'. libgomp/ChangeLog: * libgomp_g.h (GOMP_add_alloc, GOMP_is_alloc): Add. gcc/fortran/trans-openmp.cc | 8 ++++++-- libgomp/libgomp_g.h | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc index 9e166c94f8e..95184920cf7 100644 --- 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); } diff --git a/libgomp/libgomp_g.h b/libgomp/libgomp_g.h index 95046312ae9..ec619f255f2 100644 --- a/libgomp/libgomp_g.h +++ b/libgomp/libgomp_g.h @@ -366,6 +366,9 @@ extern void GOMP_teams_reg (void (*) (void *), void *, unsigned, unsigned, /* allocator.c */ +extern void GOMP_add_alloc (void *); +extern bool GOMP_is_alloc (void *); + extern void *GOMP_alloc (size_t, size_t, uintptr_t); extern void GOMP_free (void *, uintptr_t);