public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sven dot buijssen at math dot uni-dortmund dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/15809] ICE Using Pointer Functions
Date: Mon, 21 Nov 2005 18:06:00 -0000	[thread overview]
Message-ID: <20051121180646.14925.qmail@sourceware.org> (raw)
In-Reply-To: <bug-15809-7776@http.gcc.gnu.org/bugzilla/>



------- Comment #15 from sven dot buijssen at math dot uni-dortmund dot de  2005-11-21 18:06 -------
I cannot tell why, but it seems to me that Paul Thomas' test case is no valid
code:

* Compaq Fortran Compiler X5.4A-1684-46B5P gives:
f90: Warning: line 14: An explicit-shaped array is being passed to a routine
that expects a pointer or assumed-shape array
  call a (ptr)
----------^

Ok, that's because of the spare dummy argument l in the subroutine definition.
Omitting it, Compaq compiles, decides that p is associated, but prints an empty
string.

* Same behaviour with g95 (Nov 12 2005): empty string

* Next compiler: Sun Fortran 95 8.1 Patch 117834-03 2005/06/15
The Sun Compiler totally refuses to compile Paul Thomas' test case (but
omitting the spare dummy argument l):

  call a (ptr)
  ^
Line = 14, Column = 3: ERROR: Procedure "A" is defined at line 1.  It must have
an explicit interface specified.

f90comp: 16 SOURCE LINES
f90comp: 1 ERRORS, 0 WARNINGS, 0 OTHER MESSAGES, 0 ANSI

* Rewriting the code to something equivalent

program demo

  character(8), dimension (:), pointer :: ptr
  character(8), dimension (2), target :: tar
  tar = "def"
  ptr => tar
  call a (ptr)
  if (associated (ptr)) print *, "in MAIN, ptr = ", ptr

contains
  subroutine a(p)
    character(8), dimension(:), pointer :: p
    if (associated (p)) then
      print *, p
    else
      print *, "not associated"
    end if
  end subroutine a

end program demo

solves all problems. g95, gfortran (20051113), ifort 9.0, Sun + Compaq Compiler
smoothly compile and print to screen the desired:

 def     def
 in MAIN, ptr = def     def


-- 


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


  parent reply	other threads:[~2005-11-21 18:06 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-15809-7776@http.gcc.gnu.org/bugzilla/>
2005-10-23 13:34 ` sven dot buijssen at math dot uni-dortmund dot de
2005-11-21 15:53 ` pault at gcc dot gnu dot org
2005-11-21 18:06 ` sven dot buijssen at math dot uni-dortmund dot de [this message]
2005-11-21 18:08 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
2005-11-22 20:16 ` pault at gcc dot gnu dot org
2005-11-23 14:26 ` paul dot richard dot thomas at cea dot fr
2005-11-30 17:26 ` pault at gcc dot gnu dot org
2005-11-30 19:26 ` pault at gcc dot gnu dot org
2005-12-05 11:14 ` jakub at gcc dot gnu dot org
2005-12-07  6:20 ` pault at gcc dot gnu dot org
2005-12-12 20:10 ` pinskia at gcc dot gnu dot org
2004-06-03 20:12 [Bug fortran/15809] New: " giese025 at tc dot umn dot edu
2004-06-03 20:13 ` [Bug fortran/15809] " giese025 at tc dot umn dot edu
2004-06-03 20:21 ` pinskia at gcc dot gnu dot org
2004-07-11 17:10 ` tobi at gcc dot gnu dot org
2004-08-25 22:10 ` tobi at gcc dot gnu dot org
2004-09-22  7:48 ` c dot lemmen at fz-juelich dot de
2004-12-14 17:53 ` pinskia at gcc dot gnu dot org
2005-04-03  2:25 ` szalai at mit dot edu
2005-06-05 22:44 ` pault at gcc dot gnu dot org
2005-08-30 20:44 ` erik dot edelmann at iki dot fi
2005-08-31 19:39 ` tobi at gcc dot gnu dot org
2005-09-02 11:34 ` tobi at gcc dot gnu dot org
2005-09-02 11:58 ` erik dot edelmann at iki dot fi
2005-09-02 15:39 ` Tobias dot Schlueter at physik dot uni-muenchen dot de
2005-09-06 21:10 ` erik dot edelmann at iki dot fi
2005-09-08 18:51 ` rsandifo at gcc dot gnu dot org
2005-09-18 19:53 ` tkoenig at gcc dot gnu dot 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=20051121180646.14925.qmail@sourceware.org \
    --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: link
Be 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).