[Wien] problems with gfortran when unit 6 is associated to file

Pavel Ondračka pavel.ondracka at email.cz
Mon Oct 30 18:13:06 CET 2017


Dear Wien2k mailing list,

this is probably gfortran (I have version 7.2.1) specific. Recently I
saw some problems with dstart crashing in init_lapw for structures
without inversion, when trying to open the complex input files
(case.in1c and case.in2c), which are not present.

In init_lapw the in1c and in2c files are prepared if this test
succeeds:
set b = `grep INVERSION $file.outputs`
if ( $#b == 7 ) then

The problem is that on ifort system the case.outputs contains the line:
PGBSYM: SPACE GROUP DOES NOT CONTAIN INVERSION
and with gfortran there is one extra line:
SPACE GROUP DOES NOT CONTAIN INVERSION
which is printed to stdout with ifort....

Greeping for the error message in SRC_symmetry finds this two
consequent lines: 
SRC_symmetry/pgbsym.f:      WRITE(6,*) 'PGBSYM: SPACE GROUP DOES NOT
CONTAIN INVERSION'
SRC_symmetry/pgbsym.f:      WRITE(*,*) 'SPACE GROUP DOES NOT CONTAIN
INVERSION'

looking at the def file:
6, 'testcase.outputs','unknown','formatted',0
17,'testcase.in2_sy', 'unknown','formatted',0
20,'testcase.struct', 'old',    'formatted',0
21,'testcase.struct_st', 'unknown',    'formatted',0
the unit 6 (usually stdout although IIRC not mandated by the standard)
is attached to testcase.outputs

The question is what is the standard way to do in this case, the
gfortran still treats the asterisk as unit 6 (and hence the WRITE(*,*)
stuff end in the testcase.outputs file), while the ifort still sends
the WRITE(*,*) stuff to stdout.

This manifests later in dstart, x script actually checks for the
inversion by different method and crashes when it tries to open the
in*c files. When looking at the x script, there are also other
instances of redefining the unit 6, so this might be problematic in
more places...

Is this an undefined behavior or a bug in gfortran? Is there maybe some
gfortran switch to force the ifort behavior?

Best regards
Pavel


More information about the Wien mailing list