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.
29294 Discussions

Interface diagnostic different Debug vs. Release

scrognoid
Beginner
612 Views
I'm porting an old Fortran 77 program that has a type mismatch by design. It's an FFT routine that can take a real or complex argument - bad practice, but it worked.

The curious thing is that the subroutine compiles quietly in Release but throws an error in Debug.

Is there a bug?
0 Kudos
1 Solution
jimdempseyatthecove
Honored Contributor III
612 Views

In addition to Jugoslav's suggestion about turning the warning message off look in the documentation relating to generic interface and the use of attribute ALIAS. Using generic interface you can declare a single named subroutine that takes different argument lists with the intended effect of dispatching to two different subroutines, but the use of ALIAS can be used here to specify that both of the dispatch subroutines are the same third subroutine (no code generated for the two interviening subroutines.

Let's say you have a subroutine FOO that you call with real arg RARRAY for complex CARRAY. Using generic interface you can specify an interface for FOO that when called with RARRAY will call FOOR and when FOO is called with CARRAY the generic interface calls FOOC. However adding alias, you can specify that FOOR is FOORC and specify FOOC also FOORC.

Although this may seem like a lot of work to avoid what you might view as and unnecessary warning the technique also provides you with the ability to divide the joined routines into two seperate routines or one routine with seperate entry points.

Jim Dempsey


View solution in original post

0 Kudos
3 Replies
TimP
Honored Contributor III
612 Views
Quoting - scrognoid
I'm porting an old Fortran 77 program that has a type mismatch by design. It's an FFT routine that can take a real or complex argument - bad practice, but it worked.

The curious thing is that the subroutine compiles quietly in Release but throws an error in Debug.

Is there a bug?
Your release build simply isn't checking the argument correspondence. I guess you mean it is possible to supply the data as pairs of real values in the order which matches complex. As you say, it probably works OK.
0 Kudos
Jugoslav_Dujic
Valued Contributor II
612 Views
Quoting - scrognoid
The curious thing is that the subroutine compiles quietly in Release but throws an error in Debug.


Because /gen-interfaces and /warn:interfaces options are by default on in Debug configuration. You can switch them off (check the docs where to find them in the Project Properties dialog).
0 Kudos
jimdempseyatthecove
Honored Contributor III
613 Views

In addition to Jugoslav's suggestion about turning the warning message off look in the documentation relating to generic interface and the use of attribute ALIAS. Using generic interface you can declare a single named subroutine that takes different argument lists with the intended effect of dispatching to two different subroutines, but the use of ALIAS can be used here to specify that both of the dispatch subroutines are the same third subroutine (no code generated for the two interviening subroutines.

Let's say you have a subroutine FOO that you call with real arg RARRAY for complex CARRAY. Using generic interface you can specify an interface for FOO that when called with RARRAY will call FOOR and when FOO is called with CARRAY the generic interface calls FOOC. However adding alias, you can specify that FOOR is FOORC and specify FOOC also FOORC.

Although this may seem like a lot of work to avoid what you might view as and unnecessary warning the technique also provides you with the ability to divide the joined routines into two seperate routines or one routine with seperate entry points.

Jim Dempsey


0 Kudos
Reply