Closed zaikunzhang closed 5 months ago
This turns out not a bug of the compiler or the PRIMA code.
The technical support of NAG commented as follows.
I note that the repository contains C code, and your configuration commands include a C compiler. I quote from our documentation:
“The -C=undefined option is subject to a number of limitations; in particular, it is not binary compatible with Fortran code compiled without that option, and is not compatible with calling C code via a BIND(C) interface.”
The section giving details on the option further states:
“Program units compiled with this option use a different ABI, which means that they are incompatible with program units compiled without this option, and not interoperable with C; thus the whole program must be Fortran code and compiled the same way.”
In principle, -C=undefined can never be interoperable with C, because there is no way of C communicating any definition status changes to Fortran. The definition status information is passed through the argument list, that is why it is a different ABI.
That means that if you are linking with any C code, a segmentation fault is certainly expected. This would not be a compiler bug.
The following code encounters segmentation faults with nagfor 7.1, gcc 13.2, and AppleClang 1.5.0.
Note that only the C tests encounter failures. The Fortran tests work correctly.