public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Tobias Burnus <tobias@codesourcery.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>, fortran <fortran@gcc.gnu.org>
Subject: Re: [Patch] Fortran/OpenMP: Add memory routines existing for C/C++
Date: Wed, 18 Aug 2021 11:09:49 +0200	[thread overview]
Message-ID: <20210818090949.GP2380545@tucnak> (raw)
In-Reply-To: <2683f60a-9971-ce70-16af-7dc700039f8e@codesourcery.com>

On Wed, Aug 18, 2021 at 11:00:47AM +0200, Tobias Burnus wrote:
> ---------------- Note 2 -----------------------
> 'omp_lib.h' is included in as declaration-construct in the
> specification-part of a file (i.e. possibly after an implicit statement);
> hence, it cannot contain a use-stmt.  Additionally, it needs to support
> both free- and fixed-form source files.
> While thought to be compatible with Fortran 77, nothing actually requires
> that only Fortran 77 code is used and gfortran only supports -std=f95 or
> higher.
> 
> Hence, (rightly!) assuming that only gfortran compiles that file,
> Fortran 90 + 95 features can be used; the code already uses TYPE.
> 
> However, the the attached patch also BIND(C) + IMPORT, which are
> Fortran 2003 features, effectively preventing the compilation with
> -std=f95.
> 
> My impression is that old code (Fortran IV, 66, 77, older 90/95) code
> tends to use vendor extension (preventing the compilation with -std=f*)
> and users do not care about setting -std=f* flags.
> Or the code is old but still maintained. But in that case, new features
> of Fortran 2003 (and later) intentionally and/or accidentally get used,
> already preventing the compilation with -std=f95.
> 
> Thus, I think it is okay to use a Fortran 2003 feature.

Perhaps we could add some new !GCC$ extension that would temporarily
turn off errors about new language features (or temporarily switch language
version), slightly similar to
#pragma GCC push_options
#pragma GCC ...
...
#pragma GCC pop_options
except that in C/C++ one can't change the language version (but on the other
side we have __extension__ and system headers surpressing some diagnostics).

> libgomp/ChangeLog:
> 
> 	* omp_lib.f90.in (omp_alloc, omp_free, omp_target_alloc,
> 	omp_target_free. omp_target_is_present, omp_target_memcpy,
> 	omp_target_memcpy_rect, omp_target_associate_ptr,
> 	omp_target_disassociate_ptr): Add interface.
> 	* omp_lib.h.in (omp_alloc, omp_free, omp_target_alloc,
> 	omp_target_free. omp_target_is_present, omp_target_memcpy,
> 	omp_target_memcpy_rect, omp_target_associate_ptr,
> 	omp_target_disassociate_ptr): Add interface.
> 	* testsuite/libgomp.fortran/alloc-1.F90: Remove local
> 	interface block for omp_alloc + omp_free.
> 	* testsuite/libgomp.fortran/alloc-4.f90: Likewise.
> 	* testsuite/libgomp.fortran/refcount-1.f90: New test.
> 	* testsuite/libgomp.fortran/target-12.f90: New test.
> 
>  libgomp/omp_lib.f90.in                           |  94 +++++++++++++++
>  libgomp/omp_lib.h.in                             |  97 +++++++++++++++
>  libgomp/testsuite/libgomp.fortran/alloc-1.F90    |  16 ---
>  libgomp/testsuite/libgomp.fortran/alloc-4.f90    |  16 ---
>  libgomp/testsuite/libgomp.fortran/refcount-1.f90 |  61 ++++++++++
>  libgomp/testsuite/libgomp.fortran/target-12.f90  | 147 +++++++++++++++++++++++
>  6 files changed, 399 insertions(+), 32 deletions(-)

Ok.

	Jakub


      reply	other threads:[~2021-08-18  9:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-18  9:00 Tobias Burnus
2021-08-18  9:09 ` Jakub Jelinek [this message]

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=20210818090949.GP2380545@tucnak \
    --to=jakub@redhat.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=tobias@codesourcery.com \
    /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).