[Bug middle-end/20066] Ordering of logical constants determines if they're correctly emitted

tobi at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sun Feb 20 08:55:00 GMT 2005


------- Additional Comments From tobi at gcc dot gnu dot org  2005-02-19 22:54 -------
One more data point:
depending on the order of the functions test1 and test8 the following testcase
will print different results on ix86:
character*2 :: t(2), f(2), test1, test8

t(1) = test1(1)
f(1) = test1(0)
t(2) = test8(1)
f(2) = test8(0)

print *, t
print *, f
end
function test8(i) result(r)
  integer :: i
  character*2 :: r

  if (i==1) then
     write (r, *) .TRUE._8
  else
     write (r, *) .FALSE._8
  end if
end function test8
function test1(i) result(r)
  integer :: i
  character*2 :: r

  if (i==1) then
     write (r, *) .TRUE._1
  else
     write (r, *) .FALSE._1
  end if
end function test1

if test8 comes in front of test1 we get the correct:
  T T
  F F
if test1 comes first (that is, if the order of the functions, not the calls, is
interchanged):
  T T
  F T
which is wrong in the logical(8) case.

The assembly shows the same anomaly as I pointed out in the initial bug report.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20066



More information about the Gcc-bugs mailing list