Quantcast
Channel: Intel® Fortran Compiler for Linux* and macOS*
Viewing all articles
Browse latest Browse all 2583

Optimizer error with -standard-semantics, c_f_procpointer, and value attribute

$
0
0

Over the last few months there have been some posts about issues involving C_PTR, the VALUE attribute, and the -standard-semantics option.  I'm having a problem with 14.0.2 that I think may be related.

I've got a module that provides an interface to the system dl (dynamic linking) library that stopped working with -standard-semantics and -O1 and above.  I've distilled it down to the following simple example (attached).  It calls a C function to get the address of a C function that computes the square of its argument.  It converts that C_FUNPTR to a Fortran procedure and invokes it to compute the square of 2.  The program works correctly when compiled without -standard-semantics at any optimization level.  It also works correctly when compiled with -standard-semantics but no optimization (-O0).  But when compiled with -standard-semantics and -O1 (or higher) it produces the wrong result.

Poking about in the debugger (I'm not good at it) I think there is nothing at all wrong with the Fortran function pointer that is created and suspect that it is its argument, which should be passed by value, that is not being handled correctly.


Viewing all articles
Browse latest Browse all 2583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>