[PATCH, Fortran, OpenACC] Fix PR70598, Fortran host_data ICE
Jakub Jelinek
jakub@redhat.com
Thu Jul 21 11:13:00 GMT 2016
On Mon, May 09, 2016 at 10:26:50PM +0800, Chung-Lin Tang wrote:
> 2015-05-09 Chung-Lin Tang <cltang@codesourcery.com>
>
> gcc/
> * fortran/openmp.c (resolve_omp_clauses): Adjust use_device clause
> handling to only allow pointers and arrays.
As has been mentioned earlier, this should go into gcc/fortran/ChangeLog
without fortran/ prefix.
> --- gcc/fortran/openmp.c (revision 236020)
> +++ gcc/fortran/openmp.c (working copy)
> @@ -3743,11 +3743,18 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_claus
> && CLASS_DATA (n->sym)->attr.allocatable))
> gfc_error ("ALLOCATABLE object %qs in %s clause at %L",
> n->sym->name, name, &n->where);
> - if (n->sym->attr.pointer
> - || (n->sym->ts.type == BT_CLASS && CLASS_DATA (n->sym)
> - && CLASS_DATA (n->sym)->attr.class_pointer))
> - gfc_error ("POINTER object %qs in %s clause at %L",
> - n->sym->name, name, &n->where);
> + if (n->sym->attr.flavor == FL_VARIABLE
> + && !n->sym->as && !n->sym->attr.pointer
Better put every && on a separate line if the whole if (...) doesn't fit
on a single line.
> + && !n->sym->attr.cray_pointer
> + && !n->sym->attr.cray_pointee)
This is too ugly. I'd instead move the if after the cray pointer/pointee
tests, i.e.
if (n->sym->attr.cray_pointer)
gfc_error (...);
else if (n->sym->attr.cray_pointee)
gfc_error (...);
else if (n->sym->attr.flavor == FL_VARIABLE
&& !n->sym->as
&& !n->sym->attr.pointer)
gfc_error (...);
> + gfc_error ("%s clause variable %qs at %L is neither "
> + "a pointer nor an array", name,
> + n->sym->name, &n->where);
Why pointer rather than POINTER ?
> + if (n->sym->ts.type == BT_CLASS && CLASS_DATA (n->sym)
> + && CLASS_DATA (n->sym)->attr.class_pointer)
> + gfc_error ("POINTER object %qs of polymorphic type in "
> + "%s clause at %L", n->sym->name, name,
> + &n->where);
And, doesn't this mean you emit 2 errors, the first one because it is not
a pointer nor array, and the second one because it is a class with
attr.class_pointer? Also put && on the next line.
I think best would be to make it else if after the cray pointer/pointee
checks.
Jakub
More information about the Gcc-patches
mailing list