https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93827

            Bug ID: 93827
           Summary: fails to initialize logical variable
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zmth at yahoo dot com
  Target Milestone: ---

in certain callings of the subroutine the determinant was being returned with
the wrong sign because the logical variable was not being initialized with
the official line

logical*1:: fl=.false.

nor did 

logical*1:: fl /.false./ 

but instead had to specifically do

fl=.false.

which should not have been necessary
NOT it committed the error sometimes whether this was in a module and
called or whether the subroutine was in the same program as the
calling routine in main,not included below because it did same
error on various calling routines but not all,
eg in a file he2.f03 for example

gfortran -O3 -ffast-math he2.f03
gfortran -g -fbacktrace -fcheck=all -Wall -O3 -ffast-math he2.f03

using either of these command lines got the error sometimes
and NO warnings and NO errors reported from gfortran neither at
compile nor runtime  - NO errors reported from gfortran

------------------------------------
subroutine det(n,aa,dt)
real*8 aa(n,n),dt,rm,tmp(n)
integer m(2)
logical*1:: fl=.false.  ! did not work nor did   /.false./ 
! fl=.false. !but had to do this
dt=1
do i=1,n-1
m=maxloc(abs(aa(i:,i:)))
rm=aa(i+m(1)-1,i+m(2)-1)
dt=dt*rm
if(m(1).ne.1)then
fl=.not.fl
tmp(i:)=aa(i,i:)
aa(i,i:)=aa(i+m(1)-1,i:)
aa(i+m(1)-1,i:)=tmp(i:)
endif
if(m(2).ne.1)then
fl=.not.fl
tmp(i:)=aa(i:,i)
aa(i:,i)=aa(i:,i+m(2)-1)
aa(i:,i+m(2)-1)=tmp(i:)
endif

do j=i+1,n
aa(j,i+1:)=aa(j,i+1:)-aa(j,i)*aa(i,i+1:)/rm
enddo
enddo!i
dt=dt*aa(n,n)
if(fl)then;dt=-dt;endif
end
--------------------------
reference

COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/tdm-gcc-32/bin/../libexec/gcc/x86_64-w64-mingw32/4.8.2/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-4.8.2-mingw/configure --host=x86_64-w64-mingw32
--build=x86_64-unkno
wn-linux-gnu --target=x86_64-w64-mingw32
--prefix=/home/gfortran/gcc-home/binary/mingw32/nat
ive/x86_64/gcc/4.8.2
--with-sysroot=/home/gfortran/gcc-home/binary/mingw32/cross/x86_64/gcc/
4.8.2 --with-gcc --with-gnu-ld --with-gnu-as
--with-gmp=/home/gfortran/gcc-home/binary/mingw
32/native/x86_64/gmp
--with-mpfr=/home/gfortran/gcc-home/binary/mingw32/native/x86_64/mpfr -
-with-mpc=/home/gfortran/gcc-home/binary/mingw32/native/x86_64/mpc
--with-cloog=/home/gfortr
an/gcc-home/binary/mingw32/native/x86_64/cloog
--with-isl=/home/gfortran/gcc-home/binary/min
gw32/native/x86_64/isl --enable-cloog-backend=isl
--enable-targets=i686-w64-mingw32,x86_64-w
64-mingw32 --enable-lto --enable-languages=c,c++,fortran --enable-threads=win32
--enable-sta
tic --enable-shared=lto-plugin --enable-plugins --enable-ld=yes
--enable-libquadmath --enabl
e-libquadmath-support --enable-libgomp --disable-nls --disable-tls
--disable-win32-registry
Thread model: win32
gcc version 4.8.2 (GCC)

Reply via email to