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

Peter Blaha pblaha at theochem.tuwien.ac.at
Tue Oct 31 15:27:25 CET 2017


I can reproduce this.

Apparently, some "clever informatics-guy" has changed the default 
behaviour, namely that

write(*,...    prints to stdout

while

write(6,...    prints to the connected file, and ONLY if it has not been 
connected explicitly via an OPEN statement, it would print to stdout.

Now, in gfortran one has changed that to "*" = "6"  (why this limitation ??)

We have been using this different behaviour of unit=* or 5 and 6 (for 
read and write) in several places, when we want to alert a user of a 
certain fact (like "inversion is (not) present).

I'll change in SRC_symmetry all "write(6," to "write(66,", which should 
fix this problem (and also modify x_lapw for the corresponding def file).

There might be similar problems in other parts. Let me know if you find one.

Regards

On 10/30/2017 06:13 PM, Pavel Ondračka wrote:
> 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
> _______________________________________________
> Wien mailing list
> Wien at zeus.theochem.tuwien.ac.at
> http://zeus.theochem.tuwien.ac.at/mailman/listinfo/wien
> SEARCH the MAILING-LIST at:  http://www.mail-archive.com/wien@zeus.theochem.tuwien.ac.at/index.html
>

-- 

                                       P.Blaha
--------------------------------------------------------------------------
Peter BLAHA, Inst.f. Materials Chemistry, TU Vienna, A-1060 Vienna
Phone: +43-1-58801-165300             FAX: +43-1-58801-165982
Email: blaha at theochem.tuwien.ac.at    WIEN2k: http://www.wien2k.at
WWW:   http://www.imc.tuwien.ac.at/TC_Blaha
--------------------------------------------------------------------------


More information about the Wien mailing list