Using -ipo_c and common block initialization

Using -ipo_c and common block initialization

I am trying to compile a large multi-language simulation, a portion of which is Fortran. I am trying to optimizea subset of this Fortran code with the IPO but am getting multiply definedcommon blockissues. I am following the rules for common block initialization so I don't understand what's wrong.

file1.f has lines:

include 'tables.cmn'
x = A(3)*y

fileA.f has lines to initialize the tables.cmn data

include 'tables.cmn'
! initialize tables.cmn data

DATA A /1,2,3,4/
DATA B /1,2,3,4/

tables.cmn looks like:

integer A(4)
integer B(4)
common /tables/A,B

Compile command:
ifort -ipo_c file1.f file2.f file3.f file4.f -o temp.o
IPO: performing multi-file optimizations
IPO: generating object file temp.o
ifort: warning: multi-file optimation .o file produced; no link
ifort -c fileA.f -o fileA.o
ifort -c fileB.f -o fileB.o
icpc -c fileAA.cpp -o fileAA.o
icpc *.o -o simulator.exe
temp.o: (hex address) multiple definition of 'tables_'
fileA.o: first defined here
ld: Disabling relaxation: it will not work with multiple definitions

Itworks if I compile fileA.f with the command:

ifort -ipo_c -c fileA.f -o fileA.o

Unfortunately, I have about20 other files that have this same problem, and due to some post-compile object file manipulations, the solution cannot be worked in this manner.

Manual isn't clear on linking some .f with -ipo_c and some without. I am missing something?

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.