CGNS 3.4.0 - Test cgread_f03 fails on arch ppc64el

Description

Hi,
I've uploadedCGNS 3.4.0 to Debian experimental. So far it builds successfully for all arches but ppc64el where the test cgread_f03 fails with:

Adding some WRITE(,) to the test's source file I found out that the cg_goto_f statement at line 421 returns ier=3 (CG_INCORRECT_PATH). Comparing the data file cgtest.cgns with the one from arch amd64, it seems OK. H5dump shows coherent datatypes differences from H5T_STD_I8LE to H5T_STD_U8LE.

Full build log available at https://buildd.debian.org/status/fetch.php?pkg=libcgns&arch=ppc64el&ver=3.4.0-1%7Eexp1&stamp=1572269974&raw=0

Environment

None

Activity

Show:
gilles.filippini
November 4, 2019, 10:34 PM

See this bug report submitted to GCC devs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92361

The answer says that it is erroneous to call C varargs function from Fortran. Quoting the full answer here:

Fortran has no concept of a varargs call. It is an error to call a procedure with a different number or type of arguments (unless there is an explicit interface and the dummy arguments are optional or ...). Such errors are only poorly detected by gfortran prior to 10.

So, the code is erroneous. Does it matter?

For. x86_64, not so much. The only difference there is that one register is set to the number of floating point values oassen in registers. For POWER, this is different because of some red zone somewhere, I forget the details.

Before the fix, gfortran incorrectly called unknown procedures as taking varargs, even though they were not compiled as such. This led to crashes on POWER when the number of arguments became too big.

So, this fix means that the usage of calling a varargs functuon from Fortran will not work any longer, at least when using an ABI where it makes a difference.

The solution is to fix the code to call non-vararg C functuons, preferably using standard Fortran C interop features.

If you compile the code with current trunk, and the calls are in a single file, you should get some error messages which hopefully are useful in spotting the problems.

 

gilles.filippini
November 15, 2019, 10:08 PM
Edited

Patch proposal attached. Successfully tested on amd64 and ppc64el Debian architectures.

I’m far from being a Fortran expert. Fixes welcome.

Mickael PHILIT
November 24, 2019, 3:55 PM

@gilles.filippini can you create a branch with the patch on github so that we can improve from there ?

 

gilles.filippini
November 24, 2019, 6:47 PM
Edited

Branch ‘gcc-pr92361’ created on my repo pini-gh/CGNS:

I’m not sure how to proceed fron here. Should I submit a pull request against your ‘develop’ branch?

 

Mickael PHILIT
March 8, 2020, 12:49 PM

Sorry for the delay and thanks for creating the branch.

You should submit a pull request against the develop branch.

Assignee

gilles.filippini

Reporter

Anonymous

Components

Fix versions

Affects versions

Priority

Major
Configure