http://gcc.gnu.org/onlinedocs/gfortran/GFORTRAN_005fCONVERT_005fUNIT.html Result (on x86_64/Linux): GFORTRAN_CONVERT_UNIT set to "" default:"LITTLE_ENDIAN" native:"LITTLE_ENDIAN" swap:"BIG_ENDIAN" little_endian:"LITTLE_ENDIAN" big_endian:"BIG_ENDIAN" GFORTRAN_CONVERT_UNIT set to "BIG_ENDIAN" ! same with "big_endian" default:"LITTLE_ENDIAN" native:"LITTLE_ENDIAN" swap:"BIG_ENDIAN" little_endian:"LITTLE_ENDIAN" big_endian:"BIG_ENDIAN" Test program program conv implicit none character(20) :: ch CALL GET_ENVIRONMENT_VARIABLE('GFORTRAN_CONVERT_UNIT', ch) print '(3a)', 'GFORTRAN_CONVERT_UNIT set to "',trim(ch),'"' open(11,form='unformatted'); inquire(11,convert=ch) print '(3a)', 'default:"',trim(ch),'"'; close(11,status='delete') open(12,form='unformatted',convert="native") inquire(12,convert=ch) print '(3a)', 'native:"',trim(ch),'"'; close(12,status='delete') open(13,form='unformatted',convert="swap") inquire(13,convert=ch) print '(3a)', 'swap:"',trim(ch),'"'; close(13,status='delete') open(14,form='unformatted',convert="little_endian") inquire(14,convert=ch) print '(3a)', 'little_endian:"',trim(ch),'"'; close(14,status='delete') open(15,form='unformatted',convert="big_endian") inquire(15,convert=ch) print '(3a)', 'big_endian:"',trim(ch),'"'; close(15,status='delete') end program conv
On PPC/darwin7 I get [karma] f90/bug% a.out GFORTRAN_CONVERT_UNIT set to "" default:"BIG_ENDIAN" native:"BIG_ENDIAN" swap:"LITTLE_ENDIAN" little_endian:"LITTLE_ENDIAN" big_endian:"BIG_ENDIAN" [karma] f90/bug% setenv GFORTRAN_CONVERT_UNIT LITTLE_ENDIAN [karma] f90/bug% a.out GFORTRAN_CONVERT_UNIT set to "LITTLE_ENDIAN" default:"BIG_ENDIAN" native:"BIG_ENDIAN" swap:"LITTLE_ENDIAN" little_endian:"LITTLE_ENDIAN" big_endian:"BIG_ENDIAN" However I am confused about what to expect from this test: should the default change or not?
> GFORTRAN_CONVERT_UNIT set to "" > default:"BIG_ENDIAN" > GFORTRAN_CONVERT_UNIT set to "LITTLE_ENDIAN" > default:"BIG_ENDIAN" > However I am confused about what to expect from this test: > should the default change or not? I would expect that the default changes depending on the environment variable. But according to the documentation all should change: "Note that the values specified via the GFORTRAN_CONVERT_UNIT environment variable will override the CONVERT specifier in the open statement. This is to give control over data formats to users who do not have the source code of their program available." Documentation "bug": Such a statement is missing for GFORTRAN_CONVERT_UNIT section; it is only present in the CONVERT specifier section: http://gcc.gnu.org/onlinedocs/gfortran/CONVERT-specifier.html
Subject: Bug number PR31917 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2007-05/msg00900.html
Subject: Bug 31917 Author: burnus Date: Thu May 17 08:39:32 2007 New Revision: 124787 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124787 Log: 2007-05-14 Tobias Burnus <burnus@net-b.de> PR fortran/31917 * runtime/environ.c (mark_range): Fix setting default convert unit. Modified: trunk/libgfortran/ChangeLog trunk/libgfortran/runtime/environ.c
Do you plan a backport? If not, we should close this.
> Do you plan a backport? If not, we should close this. I decided to backport it in the basis that the failures are difficult to track as there is not any feedback whether the environment are in effect or not. Additionally, the fix is very localized. Fixed.
Subject: Bug 31917 Author: burnus Date: Wed May 23 07:44:23 2007 New Revision: 124984 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124984 Log: 2007-05-23 Tobias Burnus <burnus@net-b.de> PR fortran/31917 Backport from trunk. * runtime/environ.c (mark_range): Fix setting default convert unit. Modified: branches/gcc-4_2-branch/libgfortran/ChangeLog branches/gcc-4_2-branch/libgfortran/runtime/environ.c