Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28744 Discussions

compiler error with call to c_f_pointer

Robert_van_Amerongen
New Contributor III
815 Views

When calling 

 

c_f_pointer(cptr, fptr [, shape])

 

I made an typo by calling this subroutine with the shape specified but with fptr being a scalar instead of an array. The compiler did not complain but run the program . I have added a small reproducer.

 

For your info: this holds for both compilers in the most recent versions. A previous version of ifx did produce an internal compiler error. 

 

Robert

 

 

 

6 Replies
Barbara_P_Intel
Employee
765 Views

Thanks for reporting this. I like succinct reproducers and so does the compiler team!

I see what you see that both ifx and ifort run ok, but they shouldn't.

I tried an early version of the next version of ifx and it gets a runtime segmentation fault!

I filed a bug report to get the compiler to report an error, CMPLRLLVM-49870.

The Fortran standard does not require an error message for this instance, but it would certainly be a nice-to-have instead of debugging a segmentation fault!

 

0 Kudos
Robert_van_Amerongen
New Contributor III
721 Views
0 Kudos
Barbara_P_Intel
Employee
512 Views

With the compiler that will be released in late March or April an error message will print, "ERROR: Size of SHAPE in C_F_POINTER must be equal to the rank of FPTR".

Thanks again for reporting this.



0 Kudos
Robert_van_Amerongen
New Contributor III
493 Views
0 Kudos
Barbara_P_Intel
Employee
393 Views

The compiler with the fix was released last week. Please try it!



0 Kudos
Robert_van_Amerongen
New Contributor III
343 Views
0 Kudos
Reply