Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29300 Discussions

Hex constants in Intel Fortran/Linux v8

Deleted_U_Intel
Employee
843 Views
I'm trying to compile GEMPAK (a meteorology
visualization package) using Intel Fortran
for Linux v 8.0 and running into a problem
with Hex parameter statements. I've narrowed
it down to a 4-line program

PROGRAM test
CHARACTER*1 CHNULL
PARAMETER(CHNULL=X'00')
END

Here is the compiler message:


fortcom: Error: test.f, line 6: This is an illegal data type value for this parameter. ['00'X]
PARAMETER (CHNULL=X'00')
........................^
compilation aborted for test.f (code 1)

The code compiles using g77 and compiles with warnings
(that the X'00' is a F95 extension) using ifc 6.0 and ifc 7.0.

Is there any way I might get this to compile without having
to go in and modify the source code? I couldn't find any
flags that might help me out.

This GEMPAK is a widely used package in the National
Weather Service, so I'm guessing (perhaps naively), that
even if the statement is nonstandard, that type of construct
is out there in popular packages and should "probably" be
supported in some way :)

Thanks,

Don Morton
Department of Computer Science
The University of Montana
0 Kudos
3 Replies
TimP
Honored Contributor III
843 Views
Fortran hex constants use Z, not X. If in fact this is an extension supported by ifc 7 and g77, but not by ifort, you might file your report and example on premier.intel.com.
0 Kudos
TimP
Honored Contributor III
843 Views
Sorry to have missed this. It's complaining about the attempt to initialize a character to an integer value.
parameter(chnull=char(x'0'))
works. I think the standard requires one of the integer to character conversions there. That was VAX style code. Not only was there no standard between x'af' and z'af' 25 years ago, VAX Fortran did no type checking between character, logical, and integer.
g77 may be partly right, f95 explicitly permits achar() and char() in parameter(), while it was a common extension to f77, apparently sometimes implicit.
0 Kudos
Steven_L_Intel1
Employee
843 Views
Intel Fortran accepts either X or Z. Z is standard.

The standard allows hex constants only in DATA statements. It is an extension to allow them elsewhere. Tim is correct that trying to set a CHARACTER value to a hex constant is not supported. Use CHAR(0) if that's what you want.
0 Kudos
Reply