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

Ifx generates 32-bit objects that cannot be linked

Honored Contributor III

The release notes for the OneAPI Fortran compilers (ifort and ifx) say:

"ifx is binary (.o/.obj) and module (.mod) file compatible; binaries and libraries generated with ifort can be linked with binaries and libraries built with ifx, and .mod files generated with one compiler can be used by the other. "

I find that on Windows this is true only for 64-bit objects.

OBJ files produced using ifx in a CMD window opened using the Start Menu entry "Intel oneAPI command prompt for IA32 for Visual Studio 2019" contain two underscores prefixed to external names, whereas ifort generates a single underscore as prefix for each external name. Therefore, 32-bit object files produced by one compiler cannot be linked with object files and libraries produced by the other. Furthermore, the Fortran runtime library does not contain these entry points with two underscores as prefix.

For example, the one line program

print *,'Hello Fortran'; end

when compiled with ifx in a 32-bit CMD window produces:

S:\LANG>ifx pgm.f90
Intel(R) Fortran Compiler for applications running on IA-32, Version 2021.1 Beta Build 20201113
Copyright (C) 1985-2020 Intel Corporation. All rights reserved.

Microsoft (R) Incremental Linker Version 14.28.29334.0
Copyright (C) Microsoft Corporation.  All rights reserved.

pgm.obj : error LNK2019: unresolved external symbol __for_set_reentrancy referenced in function __MAIN__
pgm.obj : error LNK2019: unresolved external symbol __for_write_seq_lis referenced in function __MAIN__
libifcoremt.lib(for_main.obj) : error LNK2019: unresolved external symbol _MAIN__ referenced in function _main
pgm.exe : fatal error LNK1120: 3 unresolved externals

 Please clarify.

0 Kudos
3 Replies
Honored Contributor III

[I wished to add these lines to the first post, but the forum software would not let me do so, hence a separate post.]

In contradiction to the quote from the OneAPI release notes (see the first post), the developer guide and reference  has this at the beginning:

Support for 32-bit targets is deprecated in ifort and may be removed in a future release. ifx does not support 32-bit targets.

In fact, Ifx generates good 32-bit code. There are means to overcome the name decoration issue reported in this thread, so some clarification would be appreciated.

0 Kudos

I filed a bug report.  ifx is not supposed to accept "-m32" as a compiler option or run successfully in a IA32 Command Window.

I'll clarify the release notes regarding mixing and matching.


0 Kudos

This issue with ifx creating 32-bit objects is fixed with the latest compiler release 2021.2.0.  -m32 is no longer accepted.

$ ifx -m32 p.f90
p.f90: error #5535: Target architecture IA-32 is not supported.

 ifx does not support 32-bit objects by design.