public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Koenig <tkoenig@netcologne.de>
To: gcc mailing list <gcc@gcc.gnu.org>,
	"fortran@gcc.gnu.org" <fortran@gcc.gnu.org>
Subject: Function pointers to a nested function / contained procedure
Date: Tue, 26 Mar 2019 21:55:00 -0000	[thread overview]
Message-ID: <1130b0c3-6955-7eb7-c31b-75324427e08c@netcologne.de> (raw)

Hello world,

Fortran allows pointers to contained procedures (other languages
might call this nested functions), and also allows them to be
called using procedure pointers (function pointers in C).  This is
permitted as long as the host instance is still active (the parent
function is still running).

Contained procedures can access variables in their host instance.

gfortran currently allows procedure pointers to contained procedures,
but the association of variables in the host instance fails (PR 85537),
so accessing such a variable (usually) results in a segfault.

At the moment, I am at a loss of how to try to fix this.  Any ideas?
Is there any other language which has such a feature, so a bit of
judicious copy & paste could be applied?

Regards

	Thomas

             reply	other threads:[~2019-03-26 21:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-26 21:55 Thomas Koenig [this message]
2019-03-26 22:25 ` Eric Botcazou
2019-03-27  7:48 Thomas König
2019-03-27  9:02 ` Richard Biener
2019-03-27  9:09   ` Jakub Jelinek
2019-03-27  9:26     ` Richard Biener

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=1130b0c3-6955-7eb7-c31b-75324427e08c@netcologne.de \
    --to=tkoenig@netcologne.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc@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).