Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: rodney@oce.orst.edu (Rodney James)
Subject: Fortran 90 merge statement
Date: 1995/05/31	[thread overview]
Message-ID: <3qhucj$kgg@gaia.ucs.orst.edu> (raw)

I have a question about the Fortran 90 merge statement.

Consider the following Fortran 90 program:

      program merge_test
      integer,parameter:: n=100
      real,dimension(-n:n):: x,y
      integer:: i
      real:: s
      do i=-n,n
         x(i) = real(i)
      enddo
      y = merge(1.0/x,0.0,x.ne.0.0)
      s = sum(y)
      write(*,*) 'sum = ',s
      end

It works fine on an RS/6000 and a CM5, but on a Dec Alpha, I get

	forrtl: error (73): floating divide by zero

at merge statement.

Does the standard specify how the merge is implemented?  Is it legal to 
evaluate the true and false statements _before_  checking the conditional as 
the alpha compiler seems to be doing, or is the alpha compiler generating
incorrect code?

--

-Rodney James (rodney@oce.orst.edu)




             reply	other threads:[~1995-05-31  4:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-05-31  4:00 Rodney James [this message]
1995-05-31  4:00 ` Fortran 90 merge statement Michael METCALF
1995-06-01  4:00 ` Steve Lionel
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox