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

A strange problem of "Number not numeric"

wenbinyu
Novice
808 Views

I need to pass a real number from Fortran to a C library. When I compile it using Intel Fortran 12.1.5.344 build 201206012. It is ok. However, when I compile it using 2021.11.1, build 20231117_000000. The code can be compiled. However, when I ran it, it complains "Number not numeric". Do you know what could be the possible reason? How do I fix it?

0 Kudos
1 Solution
Steve_Lionel
Honored Contributor III
716 Views

That is not a Fortran message, and since you did not include any code or test case. it's difficult to help you here. I will note that you are using a 12-year-old compiler, not that I think it is related to your issue. I recommend installing and using the free Intel oneAPI compiler.

View solution in original post

0 Kudos
4 Replies
Steve_Lionel
Honored Contributor III
717 Views

That is not a Fortran message, and since you did not include any code or test case. it's difficult to help you here. I will note that you are using a 12-year-old compiler, not that I think it is related to your issue. I recommend installing and using the free Intel oneAPI compiler.

0 Kudos
GVautier
New Contributor III
670 Views

Hello

Such problems are very often linked to stack corruption especially during subroutine/functions calls or out of bounds array access.

0 Kudos
jimdempseyatthecove
Honored Contributor III
642 Views

>>"Number not numeric"

Without seeing the code (both sides), I/we can only assume "Number not numeric" refers to a value passed as a text string as opposed to int/float/double. I suggest you print out the value seen at the C side, in particular if the incoming argument is text (that is supposedly numeric) that you print it out as text (%s), then show it here.  You may find your "oops" and fix it yourself.

 

Jim Dempsey

jimdempseyatthecove
Honored Contributor III
640 Views

Please note too, that

character(len=5) :: foo
...
foo = '12.34'
...
call YourCfunc(foo,'56.78')

will pass two non-null terminated values, and which the junk following the text may be found to be non-numeric, or worse, found numeric, but then you have the wrong numbers.

character(len=6) :: foo
...
foo = '12.34'C ! or foo = '12.34' // C_NULL_CHAR
------------ or -----------
use, intrinsic :: iso_c_binding
character(len=5) :: foo
foo = '12.34'
...
call YourCfunc(F_C_STRING(foo),F_C_STRING('56.78'))

or variations of the above.

Reply