I have pgf95 version 6.0
% pgf95 -V
pgf95 6.0-8 32-bit target on x86 Linux
Copyright 1989-2000, The Portland Group, Inc. All Rights Reserved.
Copyright 2000-2005, STMicroelectronics, Inc. All Rights Reserved.
%
Here is my sample code, test.f90:
program test
implicit none
logical :: l = .false.
integer :: i = -99
call set
if (l) print*,'is true'
if (i==10) print*,'is 10'
contains
subroutine set
implicit none
l=.true.
i=10
end subroutine
end program
If I compiled without any flag, I got expected output of “is true”, “is 10”. But if I compiled with -O2, I dont get anything.
There are a couple of workarounds which appears to make the code to “work” (e.g. do not initialize at initialization, print the value) but I want rather be confident that it will always work.
Is this a bug in compiler? If so is there a patch for this?