public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "anlauf at gmx dot de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/64097] New: Bug with nested WHERE constructs Date: Thu, 27 Nov 2014 21:45:00 -0000 [thread overview] Message-ID: <bug-64097-4@http.gcc.gnu.org/bugzilla/> (raw) 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.
next reply other threads:[~2014-11-27 21:45 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-11-27 21:45 anlauf at gmx dot de [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-64097-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).