public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "kargl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/67614] ICE on using arithmetic if with null Date: Wed, 23 Sep 2015 23:06:00 -0000 [thread overview] Message-ID: <bug-67614-4-gpuBiP40HE@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-67614-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67614 kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargl at gcc dot gnu.org --- Comment #3 from kargl at gcc dot gnu.org --- I'm inclined to close this PR as WONTFIX. The F2008 in 2.4.8 states: "A pointer that is not associated shall not be referenced or defined." This is not a numbered constraint and so a Fortran processor is not required to report an error. It is the programmer's responsibility to ensure that a referenced pointer is associated. In addition, consider the code program y1 real, pointer :: a real, target :: b b = 42 a => b call foo(a) a => null() call foo(a) contains subroutine foo(x) real, pointer :: x if (2*x+1) 10, 20, 30 10 print *, 'a'; goto 40 20 print *, 'b'; goto 40 30 print *, 'c'; goto 40 40 continue end subroutine end program y1 The evaluation of the scalar-numeric-expr in the arithmetic-if would requires a runtime check that x is in fact an associated pointer. This could be rather costly and prevent possible optimizations if gfortran tried to always ensure any reference to a pointer is properly associated. It is the responsibility of the programmer to write if (associated(x) then if (2*x+1) 10, 20, 30 ... end if Of course, if someone wants to add an -fcheck=pointer-status option, then problems in this PR can be at least checked.
next prev parent reply other threads:[~2015-09-23 23:06 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-09-17 18:03 [Bug fortran/67614] New: " gerhard.steinmetz.fortran@t-online.de 2015-09-17 18:04 ` [Bug fortran/67614] " gerhard.steinmetz.fortran@t-online.de 2015-09-17 23:03 ` dominiq at lps dot ens.fr 2015-09-23 23:06 ` kargl at gcc dot gnu.org [this message] 2015-09-24 14:38 ` gerhard.steinmetz.fortran@t-online.de 2015-09-24 14:40 ` gerhard.steinmetz.fortran@t-online.de 2015-09-25 22:31 ` kargl at gcc dot gnu.org 2015-09-25 22:59 ` kargl at gcc dot gnu.org 2015-09-25 23:03 ` kargl 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-67614-4-gpuBiP40HE@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).