public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/64097] New: Bug with nested WHERE constructs
@ 2014-11-27 21:45 anlauf at gmx dot de
  2015-10-10 10:56 ` [Bug fortran/64097] " dominiq at lps dot ens.fr
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: anlauf at gmx dot de @ 2014-11-27 21:45 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 64097
           Summary: Bug with nested WHERE constructs
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anlauf at gmx dot de

I encountered a problem with nested WHERE constructs, which I discussed at

https://groups.google.com/forum/#!topic/comp.lang.fortran/EG2k49ujggA

It appears that the evaluated of inner masks may not be treated (i.e. masked)
properly.

Example code:

% cat nested-where.f90
program nested_where
  implicit none
  integer, parameter :: n = 100
  real               :: x(n), y(n)
  real               :: z = log (0.5)
  call random_number (x)
  y = 1                   ! "Good initialization"
  y = 0                   ! "Bad  initialization"
  print *, count (x == 1) ! Prints 0
  where (x > 0.5)
     y = x
     where (log (y) > z)  ! The "dangerous mask"
        x = 1
     end where
  end where
  print *, count (x == 1) ! Not reached for y=0
end program nested_where

The code works with NAG, PGI and xlf.  It throws an FP exception when
evaluating the inner ("dangerous") mask with GCC, Intel and Crayftn,
provided FP exceptions for invalid are enabled.

Ian Harvey cited sentence 10 in section 7.2.3.2 of the standard
document, which appears to deal with this case.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-12-18  4:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-27 21:45 [Bug fortran/64097] New: Bug with nested WHERE constructs anlauf at gmx dot de
2015-10-10 10:56 ` [Bug fortran/64097] " dominiq at lps dot ens.fr
2015-10-10 11:46 ` anlauf at gmx dot de
2015-10-10 12:10 ` dominiq at lps dot ens.fr
2021-12-18  4:23 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).