Given the following program, IFort refuses to compile it, and rightly so.
program xeq implicit none logical re,pe integer rf,pf equivalence (re, rf), (pe, pf) common/RPCOM/re,pe,rf,pf print *,loc(re),loc(rf) end
However, the error message does not clearly identify the problem, and seems to invite the user to try different alignment directives and compiler options.
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on IA-32, Version 22.214.171.124 Build 20161005 Copyright (C) 1985-2016 Intel Corporation. All rights reserved. xeq.f90(3): error #6501: The equivalences are causing alignment problems. [RE] logical re,pe -------------^ xeq.f90(3): error #6501: The equivalences are causing alignment problems. [PE] logical re,pe ----------------^ compilation aborted for xeq.f90 (code 1)
The real problem with the code is that re and rf occupy the same storage -- the first storage unit of the block; pe and pf do likewise -- the second storage of the block. In other words, the same storage unit appears more than once in the list of common block variables. Gfortran's error message is quite clear:
xeq.f90:7:24: common/RPCOM/re,pe,rf,pf 1 Error: Symbol 'rf' at (1) is already in a COMMON block