https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89593
Bug ID: 89593
Summary: warning "passing argument 3 of
‘_gfortran_caf_{get,send}_by_ref’ from incompatible
pointer type" when building libgfortran
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libfortran
Assignee: unassigned at gcc dot gnu.org
Reporter: ubizjak at gmail dot com
Target Milestone: ---
The following warning is generated when building libgfortran:
../../../git/gcc/libgfortran/caf/single.c: In function
‘_gfortran_caf_sendget_by_ref’:
../../../git/gcc/libgfortran/caf/single.c:2813:57: warning: passing argument 3
of ‘_gfortran_caf_get_by_ref’ from incompatible pointer type
[-Wincompatible-pointer-types]
2813 | _gfortran_caf_get_by_ref (src_token, src_image_index, &temp,
src_refs,
| ^~~~~
| |
| struct
<anonymous> *
../../../git/gcc/libgfortran/caf/single.c:1544:24: note: expected
‘gfc_descriptor_t *’ {aka ‘struct <anonymous> *’} but argument is of type
‘struct <anonymous> *’
1544 | gfc_descriptor_t *dst, caf_reference_t *refs,
| ~~~~~~~~~~~~~~~~~~^~~
../../../git/gcc/libgfortran/caf/single.c:2820:58: warning: passing argument 3
of ‘_gfortran_caf_send_by_ref’ from incompatible pointer type
[-Wincompatible-pointer-types]
2820 | _gfortran_caf_send_by_ref (dst_token, dst_image_index, &temp,
dst_refs,
| ^~~~~
| |
| struct
<anonymous> *
../../../git/gcc/libgfortran/caf/single.c:2434:25: note: expected
‘gfc_descriptor_t *’ {aka ‘struct <anonymous> *’} but argument is of type
‘struct <anonymous> *’
2434 | gfc_descriptor_t *src, caf_reference_t *refs,
| ~~~~~~~~~~~~~~~~~~^~~
Happens in _gfortran_caf_sendget_by_ref, where we have:
--cut here--
void
_gfortran_caf_sendget_by_ref (caf_token_t dst_token, int dst_image_index,
caf_reference_t *dst_refs, caf_token_t src_token,
int src_image_index,
caf_reference_t *src_refs, int dst_kind,
int src_kind, bool may_require_tmp, int
*dst_stat,
int *src_stat, int dst_type, int src_type)
{
GFC_FULL_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, void) temp;
GFC_DESCRIPTOR_DATA (&temp) = NULL;
GFC_DESCRIPTOR_RANK (&temp) = -1;
GFC_DESCRIPTOR_TYPE (&temp) = dst_type;
_gfortran_caf_get_by_ref (src_token, src_image_index, &temp, src_refs,
dst_kind, src_kind, may_require_tmp, true,
src_stat, src_type);
if (src_stat && *src_stat != 0)
return;
_gfortran_caf_send_by_ref (dst_token, dst_image_index, &temp, dst_refs,
dst_kind, dst_kind, may_require_tmp, true,
dst_stat, dst_type);
if (GFC_DESCRIPTOR_DATA (&temp))
free (GFC_DESCRIPTOR_DATA (&temp));
}
--cut here--
GFC_FULL_ARRAY_DESCRIPTOR is defined in libgfortran.h as:
#define GFC_FULL_ARRAY_DESCRIPTOR(r, type) \
struct {\
type *base_addr;\
size_t offset;\
dtype_type dtype;\
index_type span;\
descriptor_dimension dim[r];\
}
GFC_FULL_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, void) temp;
while _gfortran_caf_get_by_ref and _gfortran_caf_send_by_ref expect
gfc_descriptor_t, defined as:
#define GFC_ARRAY_DESCRIPTOR(type) \
struct {\
type *base_addr;\
size_t offset;\
dtype_type dtype;\
index_type span;\
descriptor_dimension dim[];\
}
typedef GFC_ARRAY_DESCRIPTOR (void) gfc_array_void;
typedef gfc_array_void gfc_descriptor_t;
These two structures differ in the last element:
descriptor_dimension dim[GFC_MAX_DIMENSIONS];
vs.
descriptor_dimension dim[];