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

ifort v11.1.038 anomaly?

Martin_C_
Beginner
948 Views
I am unsure if this is an anomaly, or if I am doing something wrong.
When using ifort v11.1.038 to compile the following:

! Compile as:
! ifort -std95 -diag-disable 7416 -warn errors echo.F90
program echo
implicit none
integer :: iarg
character(len=20) :: namein, buff
namein = 'default'
iarg = iargc()
if (iarg >= 1) then
call getarg(1,buff)
namein = buff
end if
write(*,*) namein
end program echo

I get a link failure: undefined reference to 'MAIN__'
Strangely, removing the "-warn errors" make s the makes the link successful.
It appears the compiler is not producing a warning or error when compiling with both flags and/or is not producing a MAIN__.

Should this be reported as a bug?
0 Kudos
5 Replies
Kevin_D_Intel
Employee
948 Views

No. This is already fixed in the upcoming 11.1 update later this week.

$ ifort -V -std95 -diag-disable 7416 -warn errors u66931.f90
Intel Fortran Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1 Build 20090630 Package ID: l_cprof_p_11.1.046
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.

Intel Fortran 11.1-2536
Cannot disable Fortran error message 7416
u66931.f90(8): error #7416: Fortran 95 does not allow this intrinsic procedure. [IARGC]
iarg = iargc()
-------^
Cannot disable Fortran error message 7416
u66931.f90(10): error #7416: Fortran 95 does not allow this intrinsic procedure. [GETARG]
call getarg(1,buff)
-----^
compilation aborted for u66931.f90 (code 1)

Appears the compiler disallows ignoring warnings elevated to error level. The warning is ignored without -warn errors

$ ifort -V -std95 -diag-disable 7416 u66931.f90
Intel Fortran Intel 64 Compiler Professional for applications running on Intel 64, Version 11.1 Build 20090630 Package ID: l_cprof_p_11.1.046
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.

Intel Fortran 11.1-2536
GNU ld version 2.17.50.0.6-5.el5 20061020
0 Kudos
Martin_C_
Beginner
948 Views
What version is this fixed in?
I now have ifort v11.1.046 and the anomaly is still there.
0 Kudos
Kevin_D_Intel
Employee
948 Views

Perhaps I didn't understand the initial anomaly?

As I showed in the earlier post, the 11.1.046 update contains a fix for the undefined reference to MAIN__ when both options are specified.

Additionally, when using 11.1.046, as the additional compiler diagnostic "Cannot disable Fortran error message 7416" shown in my earlier post indicates, one cannot disable what was a warning (see below) when also elevating warnings to errors.

$ ifort -V -std95 -c u66931.f90
Intel Fortran Compiler Professional for applications running on IA-32, Version 11.1 Build 20090630 Package ID: l_cprof_p_11.1.046
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.

Intel Fortran 11.1-2536
u66931.f90(8): warning #7416: Fortran 95 does not allow this intrinsic procedure. [IARGC]
iarg = iargc()
-------^
u66931.f90(10): warning #7416: Fortran 95 does not allow this intrinsic procedure. [GETARG]
call getarg(1,buff)
-----^

Please let me know if I am misunderstanding the issue.
0 Kudos
Martin_C_
Beginner
948 Views
Yes, you understood the issue, and I did not connect the dots in your answer.
I do know that there are equivalent routines for IARGC and GETARG in the FORTRAN 2003 standard.
However, we support multiple compilers and customers which currently are not up to std 2003.
Is there a way to turn off that single #7416 error message using compiler flags?
During regression testing, we currently use among other file and directory/module/lib/etc flags:
... -save -FR -r8 -std95 -warn all -warn errors -fpe0 -check all -traceback -fp-stack-check -03 ...
We do wish to conform for now to FORTRAN 95 except that one intrinsic function. Any recommendations?
Is there a way to do a #ifdef IFORT version#?
0 Kudos
Steven_L_Intel1
Employee
948 Views

Note that Kevin says you can disable the warning as long as you don't also ask for standards warnings to be errors. But I suppose you could do something like this:

#ifdef __INTEL_COMPILER
... use GET_ARGUMENT_COUNT and GET_COMMAND_ARGUMENT
#else
... use IARGC and GETARG
#endif

There is an easier solution, though. Add:

EXTERNAL IARGC,GETARG

This will disable the warning and should work fine for you. I know there is a reason we made these intrinsics in 8.0, but I no longer remember what it was.
0 Kudos
Reply