netcdf-c icon indicating copy to clipboard operation
netcdf-c copied to clipboard

Incompatible function pointer when building with clang-16

Open ufdup89 opened this issue 2 years ago • 1 comments
trafficstars

I am experiencing errors when compiling netcdf 4.9.2 with clang-16 and hdf5 1.14.1. Compiling with clang-15 and same hdf5 version works fine.

OS: macOS Ventura 13.4 (arm)

_ports_science_netcdf/netcdf/work/netcdf-c-4.9.2/libhdf5/hdf5open.c
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_netcdf/netcdf/work/netcdf-c-4.9.2/libhdf5/hdf5open.c:2902:20: error: incompatible function pointer types passing 'int (hid_t, const char *, const H5L_info2_t *, void *)' (aka 'int (long long, const char *, const H5L_info2_t *, void *)') to parameter of type 'H5L_iterate1_t' (aka 'int (*)(long long, const char *, const H5L_info1_t *, void *)') [-Wincompatible-function-pointer-types]
                   read_hdf5_obj, (void *)&udata) < 0)
                   ^~~~~~~~~~~~~
/opt/local/include/H5Lpublic.h:1684:42: note: passing argument to parameter 'op' here
                          H5L_iterate1_t op, void *op_data);
                                         ^
1 error generated.

ufdup89 avatar Jun 18 '23 07:06 ufdup89

Interesting, thank you for letting us know. I will take a look.

WardF avatar Jun 23 '23 16:06 WardF

Taking a look at fixing this, I'm now observing it again after merging #2958. @edwardhartnett do you folks use clang at all? I'm uncertain why this passed the MacOS CI but fails locally using clang.

WardF avatar Aug 13 '24 17:08 WardF

No we don't use clang.

edwardhartnett avatar Aug 13 '24 17:08 edwardhartnett

I'm also seeing this on Frontier builds with Cray and v4.9.2:

InstalledDir: /opt/cray/pe/cce/17.0.0/cce-clang/x86_64/share/../bin Configuration file: /opt/cray/pe/cce/17.0.0/cce-clang/x86_64/bin/clang.cfg

v4.9.3-rc1 does not have an issue and successfully compiled.

brtnfld avatar Aug 22 '24 20:08 brtnfld

Thanks for confirming @brtnfld. I'm prepping the netCDF-Fortran rc1 to go out tomorrow, although there appears to be an FPE-related issue in netCDF-Fortran (reported via our eSupport system) that I am going to open as a github issue; it may need to be addressed at a higher priority once I confirm it.

WardF avatar Aug 22 '24 22:08 WardF