2010-09-25 21:23:25 +02:00
|
|
|
\input texinfo @c -*-texinfo-*-
|
2004-05-13 08:41:07 +02:00
|
|
|
@c %**start of header
|
|
|
|
@setfilename gfortran.info
|
2017-01-01 12:31:28 +01:00
|
|
|
@set copyrights-gfortran 1999-2017
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
@include gcc-common.texi
|
|
|
|
|
2006-10-05 01:07:39 +02:00
|
|
|
@settitle The GNU Fortran Compiler
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
@c Create a separate index for command line options
|
|
|
|
@defcodeindex op
|
|
|
|
@c Merge the standard indexes into a single one.
|
|
|
|
@syncodeindex fn cp
|
|
|
|
@syncodeindex vr cp
|
|
|
|
@syncodeindex ky cp
|
|
|
|
@syncodeindex pg cp
|
|
|
|
@syncodeindex tp cp
|
|
|
|
|
2006-12-17 03:41:48 +01:00
|
|
|
@c TODO: The following "Part" definitions are included here temporarily
|
|
|
|
@c until they are incorporated into the official Texinfo distribution.
|
|
|
|
@c They borrow heavily from Texinfo's \unnchapentry definitions.
|
|
|
|
|
|
|
|
@tex
|
|
|
|
\gdef\part#1#2{%
|
|
|
|
\pchapsepmacro
|
|
|
|
\gdef\thischapter{}
|
|
|
|
\begingroup
|
|
|
|
\vglue\titlepagetopglue
|
|
|
|
\titlefonts \rm
|
|
|
|
\leftline{Part #1:@* #2}
|
|
|
|
\vskip4pt \hrule height 4pt width \hsize \vskip4pt
|
|
|
|
\endgroup
|
|
|
|
\writetocentry{part}{#2}{#1}
|
|
|
|
}
|
|
|
|
\gdef\blankpart{%
|
|
|
|
\writetocentry{blankpart}{}{}
|
|
|
|
}
|
|
|
|
% Part TOC-entry definition for summary contents.
|
|
|
|
\gdef\dosmallpartentry#1#2#3#4{%
|
|
|
|
\vskip .5\baselineskip plus.2\baselineskip
|
|
|
|
\begingroup
|
|
|
|
\let\rm=\bf \rm
|
|
|
|
\tocentry{Part #2: #1}{\doshortpageno\bgroup#4\egroup}
|
|
|
|
\endgroup
|
|
|
|
}
|
|
|
|
\gdef\dosmallblankpartentry#1#2#3#4{%
|
|
|
|
\vskip .5\baselineskip plus.2\baselineskip
|
|
|
|
}
|
|
|
|
% Part TOC-entry definition for regular contents. This has to be
|
|
|
|
% equated to an existing entry to not cause problems when the PDF
|
|
|
|
% outline is created.
|
|
|
|
\gdef\dopartentry#1#2#3#4{%
|
|
|
|
\unnchapentry{Part #2: #1}{}{#3}{#4}
|
|
|
|
}
|
|
|
|
\gdef\doblankpartentry#1#2#3#4{}
|
|
|
|
@end tex
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
@c %**end of header
|
|
|
|
|
|
|
|
@c Use with @@smallbook.
|
|
|
|
|
|
|
|
@c %** start of document
|
|
|
|
|
|
|
|
@c Cause even numbered pages to be printed on the left hand side of
|
|
|
|
@c the page and odd numbered pages to be printed on the right hand
|
|
|
|
@c side of the page. Using this, you can print on both sides of a
|
|
|
|
@c sheet of paper and have the text on the same part of the sheet.
|
|
|
|
|
|
|
|
@c The text on right hand pages is pushed towards the right hand
|
|
|
|
@c margin and the text on left hand pages is pushed toward the left
|
|
|
|
@c hand margin.
|
|
|
|
@c (To provide the reverse effect, set bindingoffset to -0.75in.)
|
|
|
|
|
|
|
|
@c @tex
|
|
|
|
@c \global\bindingoffset=0.75in
|
|
|
|
@c \global\normaloffset =0.75in
|
|
|
|
@c @end tex
|
|
|
|
|
|
|
|
@copying
|
|
|
|
Copyright @copyright{} @value{copyrights-gfortran} Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Permission is granted to copy, distribute and/or modify this document
|
2010-06-10 01:46:33 +02:00
|
|
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
2004-05-13 08:41:07 +02:00
|
|
|
any later version published by the Free Software Foundation; with the
|
2008-07-30 07:28:53 +02:00
|
|
|
Invariant Sections being ``Funding Free Software'', the Front-Cover
|
|
|
|
Texts being (a) (see below), and with the Back-Cover Texts being (b)
|
2004-05-13 08:41:07 +02:00
|
|
|
(see below). A copy of the license is included in the section entitled
|
|
|
|
``GNU Free Documentation License''.
|
|
|
|
|
|
|
|
(a) The FSF's Front-Cover Text is:
|
|
|
|
|
|
|
|
A GNU Manual
|
|
|
|
|
|
|
|
(b) The FSF's Back-Cover Text is:
|
|
|
|
|
|
|
|
You have freedom to copy and modify this GNU Manual, like GNU
|
|
|
|
software. Copies published by the Free Software Foundation raise
|
|
|
|
funds for GNU development.
|
|
|
|
@end copying
|
|
|
|
|
|
|
|
@ifinfo
|
2006-06-18 01:22:05 +02:00
|
|
|
@dircategory Software development
|
2004-05-13 08:41:07 +02:00
|
|
|
@direntry
|
2006-10-05 01:07:39 +02:00
|
|
|
* gfortran: (gfortran). The GNU Fortran Compiler.
|
2004-05-13 08:41:07 +02:00
|
|
|
@end direntry
|
|
|
|
This file documents the use and the internals of
|
2006-10-05 01:07:39 +02:00
|
|
|
the GNU Fortran compiler, (@command{gfortran}).
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
Published by the Free Software Foundation
|
2005-06-25 02:40:37 +02:00
|
|
|
51 Franklin Street, Fifth Floor
|
|
|
|
Boston, MA 02110-1301 USA
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
@insertcopying
|
|
|
|
@end ifinfo
|
|
|
|
|
|
|
|
|
|
|
|
@setchapternewpage odd
|
|
|
|
@titlepage
|
2006-10-05 01:07:39 +02:00
|
|
|
@title Using GNU Fortran
|
2007-02-27 07:00:47 +01:00
|
|
|
@versionsubtitle
|
|
|
|
@author The @t{gfortran} team
|
2004-05-13 08:41:07 +02:00
|
|
|
@page
|
|
|
|
@vskip 0pt plus 1filll
|
2007-01-04 02:29:08 +01:00
|
|
|
Published by the Free Software Foundation@*
|
2005-06-25 02:40:37 +02:00
|
|
|
51 Franklin Street, Fifth Floor@*
|
|
|
|
Boston, MA 02110-1301, USA@*
|
2004-05-13 08:41:07 +02:00
|
|
|
@c Last printed ??ber, 19??.@*
|
|
|
|
@c Printed copies are available for $? each.@*
|
|
|
|
@c ISBN ???
|
|
|
|
@sp 1
|
|
|
|
@insertcopying
|
|
|
|
@end titlepage
|
2006-12-17 03:41:48 +01:00
|
|
|
|
|
|
|
@c TODO: The following "Part" definitions are included here temporarily
|
|
|
|
@c until they are incorporated into the official Texinfo distribution.
|
|
|
|
|
|
|
|
@tex
|
|
|
|
\global\let\partentry=\dosmallpartentry
|
|
|
|
\global\let\blankpartentry=\dosmallblankpartentry
|
|
|
|
@end tex
|
2004-05-13 08:41:07 +02:00
|
|
|
@summarycontents
|
2006-12-17 03:41:48 +01:00
|
|
|
|
|
|
|
@tex
|
|
|
|
\global\let\partentry=\dopartentry
|
|
|
|
\global\let\blankpartentry=\doblankpartentry
|
|
|
|
@end tex
|
2004-05-13 08:41:07 +02:00
|
|
|
@contents
|
2006-12-17 03:41:48 +01:00
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
@page
|
|
|
|
|
2007-01-04 03:11:05 +01:00
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
@c TexInfo table of contents.
|
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
|
|
|
|
@ifnottex
|
2005-10-30 21:54:43 +01:00
|
|
|
@node Top
|
2004-05-13 08:41:07 +02:00
|
|
|
@top Introduction
|
|
|
|
@cindex Introduction
|
|
|
|
|
gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
gcc/fortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
(_gfortran_caf_register): Update for locking/critical.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* resolve.c (resolve_critical): New.
(gfc_resolve_code): Call it.
* trans-decl.c (gfor_fndecl_caf_critical,
gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
(gfc_build_builtin_function_decls): Remove critical,
assign locking declarations.
(generate_coarray_sym_init): Handle locking and
critical variables.
* trans-stmt.c (gfc_trans_critical): Add calls to
lock/unlock libcaf functions.
* trans.h (gfc_coarray_type): Update locking, add
critical enum values.
(gfor_fndecl_caf_critical, gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
libgfortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* caf/libcaf.h (caf_register_t): Update for critical.
(_gfortran_caf_critical, _gfortran_caf_end_critical): Remove.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* caf/single.c (_gfortran_caf_register): Handle locking
variables.
(_gfortran_caf_sendget): Re-name args for consistency.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
From-SVN: r213979
2014-08-14 20:39:15 +02:00
|
|
|
This manual documents the use of @command{gfortran},
|
2010-09-24 08:39:20 +02:00
|
|
|
the GNU Fortran compiler. You can find in this manual how to invoke
|
2004-06-05 16:41:42 +02:00
|
|
|
@command{gfortran}, as well as its features and incompatibilities.
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
@ifset DEVELOPMENT
|
|
|
|
@emph{Warning:} This document, and the compiler it describes, are still
|
2005-03-24 19:16:33 +01:00
|
|
|
under development. While efforts are made to keep it up-to-date, it might
|
2006-10-05 01:07:39 +02:00
|
|
|
not accurately reflect the status of the most recent GNU Fortran compiler.
|
2004-05-13 08:41:07 +02:00
|
|
|
@end ifset
|
|
|
|
|
2005-03-24 19:16:33 +01:00
|
|
|
@comment
|
|
|
|
@comment When you add a new menu item, please keep the right hand
|
|
|
|
@comment aligned to the same column. Do not use tabs. This provides
|
|
|
|
@comment better formatting.
|
|
|
|
@comment
|
2004-05-13 08:41:07 +02:00
|
|
|
@menu
|
2007-01-04 03:11:05 +01:00
|
|
|
* Introduction::
|
2006-12-17 03:41:48 +01:00
|
|
|
|
2007-01-04 03:11:05 +01:00
|
|
|
Part I: Invoking GNU Fortran
|
2006-12-17 03:41:48 +01:00
|
|
|
* Invoking GNU Fortran:: Command options supported by @command{gfortran}.
|
2006-02-06 21:12:44 +01:00
|
|
|
* Runtime:: Influencing runtime behavior with environment variables.
|
2006-12-17 03:41:48 +01:00
|
|
|
|
2007-01-04 03:11:05 +01:00
|
|
|
Part II: Language Reference
|
re PR fortran/33197 (Fortran 2008: math functions)
PR fortran/33197
gcc/fortran/
* intrinsic.c (add_functions): Modify intrinsics ACOSH, ASINH,
ATANH, ERF, ERFC and GAMMA. Add intrinsics BESSEL_{J,Y}{0,1,N},
ERFC_SCALED, LOG_GAMMA and HYPOT.
* intrinsic.h (gfc_check_hypot, gfc_simplify_hypot,
gfc_resolve_hypot): New prototypes.
* mathbuiltins.def: Add HYPOT builtin. Make complex versions of
ACOSH, ASINH and ATANH available.
* gfortran.h (GFC_ISYM_ERFC_SCALED, GFC_ISYM_HYPOT): New values.
* lang.opt: Add -std=f2008 option.
* libgfortran.h: Define GFC_STD_F2008.
* lang-specs.h: Add .f08 and .F08 file suffixes.
* iresolve.c (gfc_resolve_hypot): New function.
* parse.c (parse_contained): Allow empty CONTAINS for Fortran 2008.
* check.c (gfc_check_hypot): New function.
* trans-intrinsic.c (gfc_intrinsic_map): Define ERFC_SCALE builtin.
* options.c (set_default_std_flags): Allow Fortran 2008 by default.
(form_from_filename): Add .f08 suffix.
(gfc_handle_option): Handle -std=f2008 option.
* simplify.c (gfc_simplify_hypot): New function.
* gfortran.texi: Document Fortran 2008 status and file extensions.
* intrinsic.texi: Document new BESSEL_{J,Y}{0,1,N} intrinsics,
as well as HYPOT and ERFC_SCALED. Update documentation of ERF,
ERFC, GAMMA, LGAMMA, ASINH, ACOSH and ATANH.
* invoke.texi: Document the new -std=f2008 option.
libgomp/
* testsuite/libgomp.fortran/fortran.exp: Add .f08 and
.F08 file suffixes.
gcc/testsuite/
* gfortran.dg/gomp/gomp.exp: Add .f08 and .F08 file suffixes.
* gfortran.dg/dg.exp: Likewise.
* gfortran.dg/vect/vect.exp: Likewise.
* gfortran.fortran-torture/execute/execute.exp: Likewise.
* gfortran.fortran-torture/compile/compile.exp: Likewise.
* gfortran.dg/gamma_1.f90: Also check log_gamma.
* gfortran.dg/invalid_contains_1.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_2.f90: Add a few error messages.
* gfortran.dg/invalid_contains_2.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_3.f90: Adjust error message.
* gfortran.dg/gamma_4.f90: Test for log_gamma instead of lgamma.
* gfortran.dg/bind_c_usage_9.f03: Adjust error messages.
* gfortran.dg/bessel_1.f90: New test.
* gfortran.dg/recursive_check_3.f90: Remove warnings.
* gfortran.dg/besxy.f90: Also check for new F2008 intrinsics.
* gfortran.dg/derived_function_interface_1.f90: Remove warning.
* gfortran.dg/contains_empty_1.f03: New test.
* gfortran.dg/erfc_scaled_1.f90: New test.
* gfortran.dg/hypot_1.f90: New test.
* gfortran.dg/contains_empty_2.f03: New test.
libgfortran/
* intrinsics/erfc_scaled_inc.c: New file.
* intrinsics/erfc_scaled.c: New file.
* gfortran.map (GFORTRAN_1.0): Add _gfortran_erfc_scaled_r*.
* Makefile.am: Add intrinsics/erfc_scaled.c.
* config.h.in: Regenerate.
* configure: Regenerate.
* Makefile.in: Regenerate.
From-SVN: r132846
2008-03-04 00:46:20 +01:00
|
|
|
* Fortran 2003 and 2008 status:: Fortran 2003 and 2008 features supported by GNU Fortran.
|
2010-04-07 20:01:24 +02:00
|
|
|
* Compiler Characteristics:: User-visible implementation details.
|
2013-02-21 10:23:31 +01:00
|
|
|
* Extensions:: Language extensions implemented by GNU Fortran.
|
2009-06-03 22:32:23 +02:00
|
|
|
* Mixed-Language Programming:: Interoperability with C
|
2014-08-14 20:35:01 +02:00
|
|
|
* Coarray Programming::
|
2006-10-05 01:07:39 +02:00
|
|
|
* Intrinsic Procedures:: Intrinsic procedures supported by GNU Fortran.
|
2007-09-20 13:28:12 +02:00
|
|
|
* Intrinsic Modules:: Intrinsic modules supported by GNU Fortran.
|
2006-12-17 03:41:48 +01:00
|
|
|
|
|
|
|
* Contributing:: How you can help.
|
2005-10-30 21:54:43 +01:00
|
|
|
* Copying:: GNU General Public License says
|
|
|
|
how you can copy and share GNU Fortran.
|
|
|
|
* GNU Free Documentation License::
|
2008-06-15 11:42:13 +02:00
|
|
|
How you can copy and share this manual.
|
2005-10-30 21:54:43 +01:00
|
|
|
* Funding:: How to help assure continued work for free software.
|
2007-04-27 18:52:10 +02:00
|
|
|
* Option Index:: Index of command line options
|
|
|
|
* Keyword Index:: Index of concepts
|
2004-05-13 08:41:07 +02:00
|
|
|
@end menu
|
2007-01-04 03:11:05 +01:00
|
|
|
@end ifnottex
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
@c ---------------------------------------------------------------------
|
2007-01-04 03:11:05 +01:00
|
|
|
@c Introduction
|
2004-05-13 08:41:07 +02:00
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
|
2007-01-04 03:11:05 +01:00
|
|
|
@node Introduction
|
|
|
|
@chapter Introduction
|
|
|
|
|
|
|
|
@c The following duplicates the text on the TexInfo table of contents.
|
|
|
|
@iftex
|
|
|
|
This manual documents the use of @command{gfortran}, the GNU Fortran
|
2010-09-24 08:39:20 +02:00
|
|
|
compiler. You can find in this manual how to invoke @command{gfortran},
|
2007-01-04 03:11:05 +01:00
|
|
|
as well as its features and incompatibilities.
|
|
|
|
|
|
|
|
@ifset DEVELOPMENT
|
|
|
|
@emph{Warning:} This document, and the compiler it describes, are still
|
|
|
|
under development. While efforts are made to keep it up-to-date, it
|
|
|
|
might not accurately reflect the status of the most recent GNU Fortran
|
|
|
|
compiler.
|
|
|
|
@end ifset
|
|
|
|
@end iftex
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2006-10-05 01:07:39 +02:00
|
|
|
The GNU Fortran compiler front end was
|
2004-05-13 08:41:07 +02:00
|
|
|
designed initially as a free replacement for,
|
2013-02-07 12:08:20 +01:00
|
|
|
or alternative to, the Unix @command{f95} command;
|
2011-11-07 23:21:54 +01:00
|
|
|
@command{gfortran} is the command you will use to invoke the compiler.
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2007-01-04 03:11:05 +01:00
|
|
|
@menu
|
|
|
|
* About GNU Fortran:: What you should know about the GNU Fortran compiler.
|
|
|
|
* GNU Fortran and GCC:: You can compile Fortran, C, or other programs.
|
2007-09-10 14:09:17 +02:00
|
|
|
* Preprocessing and conditional compilation:: The Fortran preprocessor
|
2007-01-04 03:11:05 +01:00
|
|
|
* GNU Fortran and G77:: Why we chose to start from scratch.
|
|
|
|
* Project Status:: Status of GNU Fortran, roadmap, proposed extensions.
|
2008-06-15 11:42:13 +02:00
|
|
|
* Standards:: Standards supported by GNU Fortran.
|
2007-01-04 03:11:05 +01:00
|
|
|
@end menu
|
|
|
|
|
|
|
|
|
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
@c About GNU Fortran
|
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
|
|
|
|
@node About GNU Fortran
|
|
|
|
@section About GNU Fortran
|
|
|
|
|
2009-06-03 22:32:23 +02:00
|
|
|
The GNU Fortran compiler supports the Fortran 77, 90 and 95 standards
|
|
|
|
completely, parts of the Fortran 2003 and Fortran 2008 standards, and
|
2010-09-24 08:39:20 +02:00
|
|
|
several vendor extensions. The development goal is to provide the
|
2009-06-03 22:32:23 +02:00
|
|
|
following features:
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
@itemize @bullet
|
|
|
|
@item
|
|
|
|
Read a user's program,
|
|
|
|
stored in a file and containing instructions written
|
re PR fortran/33197 (Fortran 2008: math functions)
PR fortran/33197
gcc/fortran/
* intrinsic.c (add_functions): Modify intrinsics ACOSH, ASINH,
ATANH, ERF, ERFC and GAMMA. Add intrinsics BESSEL_{J,Y}{0,1,N},
ERFC_SCALED, LOG_GAMMA and HYPOT.
* intrinsic.h (gfc_check_hypot, gfc_simplify_hypot,
gfc_resolve_hypot): New prototypes.
* mathbuiltins.def: Add HYPOT builtin. Make complex versions of
ACOSH, ASINH and ATANH available.
* gfortran.h (GFC_ISYM_ERFC_SCALED, GFC_ISYM_HYPOT): New values.
* lang.opt: Add -std=f2008 option.
* libgfortran.h: Define GFC_STD_F2008.
* lang-specs.h: Add .f08 and .F08 file suffixes.
* iresolve.c (gfc_resolve_hypot): New function.
* parse.c (parse_contained): Allow empty CONTAINS for Fortran 2008.
* check.c (gfc_check_hypot): New function.
* trans-intrinsic.c (gfc_intrinsic_map): Define ERFC_SCALE builtin.
* options.c (set_default_std_flags): Allow Fortran 2008 by default.
(form_from_filename): Add .f08 suffix.
(gfc_handle_option): Handle -std=f2008 option.
* simplify.c (gfc_simplify_hypot): New function.
* gfortran.texi: Document Fortran 2008 status and file extensions.
* intrinsic.texi: Document new BESSEL_{J,Y}{0,1,N} intrinsics,
as well as HYPOT and ERFC_SCALED. Update documentation of ERF,
ERFC, GAMMA, LGAMMA, ASINH, ACOSH and ATANH.
* invoke.texi: Document the new -std=f2008 option.
libgomp/
* testsuite/libgomp.fortran/fortran.exp: Add .f08 and
.F08 file suffixes.
gcc/testsuite/
* gfortran.dg/gomp/gomp.exp: Add .f08 and .F08 file suffixes.
* gfortran.dg/dg.exp: Likewise.
* gfortran.dg/vect/vect.exp: Likewise.
* gfortran.fortran-torture/execute/execute.exp: Likewise.
* gfortran.fortran-torture/compile/compile.exp: Likewise.
* gfortran.dg/gamma_1.f90: Also check log_gamma.
* gfortran.dg/invalid_contains_1.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_2.f90: Add a few error messages.
* gfortran.dg/invalid_contains_2.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_3.f90: Adjust error message.
* gfortran.dg/gamma_4.f90: Test for log_gamma instead of lgamma.
* gfortran.dg/bind_c_usage_9.f03: Adjust error messages.
* gfortran.dg/bessel_1.f90: New test.
* gfortran.dg/recursive_check_3.f90: Remove warnings.
* gfortran.dg/besxy.f90: Also check for new F2008 intrinsics.
* gfortran.dg/derived_function_interface_1.f90: Remove warning.
* gfortran.dg/contains_empty_1.f03: New test.
* gfortran.dg/erfc_scaled_1.f90: New test.
* gfortran.dg/hypot_1.f90: New test.
* gfortran.dg/contains_empty_2.f03: New test.
libgfortran/
* intrinsics/erfc_scaled_inc.c: New file.
* intrinsics/erfc_scaled.c: New file.
* gfortran.map (GFORTRAN_1.0): Add _gfortran_erfc_scaled_r*.
* Makefile.am: Add intrinsics/erfc_scaled.c.
* config.h.in: Regenerate.
* configure: Regenerate.
* Makefile.in: Regenerate.
From-SVN: r132846
2008-03-04 00:46:20 +01:00
|
|
|
in Fortran 77, Fortran 90, Fortran 95, Fortran 2003 or Fortran 2008.
|
2004-05-13 08:41:07 +02:00
|
|
|
This file contains @dfn{source code}.
|
|
|
|
|
|
|
|
@item
|
|
|
|
Translate the user's program into instructions a computer
|
|
|
|
can carry out more quickly than it takes to translate the
|
|
|
|
instructions in the first
|
|
|
|
place. The result after compilation of a program is
|
|
|
|
@dfn{machine code},
|
|
|
|
code designed to be efficiently translated and processed
|
|
|
|
by a machine such as your computer.
|
2011-11-07 23:21:54 +01:00
|
|
|
Humans usually are not as good writing machine code
|
2004-05-13 08:41:07 +02:00
|
|
|
as they are at writing Fortran (or C++, Ada, or Java),
|
2008-12-21 19:45:17 +01:00
|
|
|
because it is easy to make tiny mistakes writing machine code.
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
@item
|
|
|
|
Provide the user with information about the reasons why
|
|
|
|
the compiler is unable to create a binary from the source code.
|
|
|
|
Usually this will be the case if the source code is flawed.
|
2008-12-21 19:45:17 +01:00
|
|
|
The Fortran 90 standard requires that the compiler can point out
|
2004-05-13 08:41:07 +02:00
|
|
|
mistakes to the user.
|
|
|
|
An incorrect usage of the language causes an @dfn{error message}.
|
|
|
|
|
|
|
|
The compiler will also attempt to diagnose cases where the
|
|
|
|
user's program contains a correct usage of the language,
|
|
|
|
but instructs the computer to do something questionable.
|
|
|
|
This kind of diagnostics message is called a @dfn{warning message}.
|
|
|
|
|
|
|
|
@item
|
|
|
|
Provide optional information about the translation passes
|
|
|
|
from the source code to machine code.
|
|
|
|
This can help a user of the compiler to find the cause of
|
|
|
|
certain bugs which may not be obvious in the source code,
|
|
|
|
but may be more easily found at a lower level compiler output.
|
|
|
|
It also helps developers to find bugs in the compiler itself.
|
|
|
|
|
|
|
|
@item
|
|
|
|
Provide information in the generated machine code that can
|
|
|
|
make it easier to find bugs in the program (using a debugging tool,
|
gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
gcc/fortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
(_gfortran_caf_register): Update for locking/critical.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* resolve.c (resolve_critical): New.
(gfc_resolve_code): Call it.
* trans-decl.c (gfor_fndecl_caf_critical,
gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
(gfc_build_builtin_function_decls): Remove critical,
assign locking declarations.
(generate_coarray_sym_init): Handle locking and
critical variables.
* trans-stmt.c (gfc_trans_critical): Add calls to
lock/unlock libcaf functions.
* trans.h (gfc_coarray_type): Update locking, add
critical enum values.
(gfor_fndecl_caf_critical, gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
libgfortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* caf/libcaf.h (caf_register_t): Update for critical.
(_gfortran_caf_critical, _gfortran_caf_end_critical): Remove.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* caf/single.c (_gfortran_caf_register): Handle locking
variables.
(_gfortran_caf_sendget): Re-name args for consistency.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
From-SVN: r213979
2014-08-14 20:39:15 +02:00
|
|
|
called a @dfn{debugger}, such as the GNU Debugger @command{gdb}).
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
@item
|
|
|
|
Locate and gather machine code already generated to
|
|
|
|
perform actions requested by statements in the user's program.
|
|
|
|
This machine code is organized into @dfn{modules} and is located
|
gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
gcc/fortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
(_gfortran_caf_register): Update for locking/critical.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* resolve.c (resolve_critical): New.
(gfc_resolve_code): Call it.
* trans-decl.c (gfor_fndecl_caf_critical,
gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
(gfc_build_builtin_function_decls): Remove critical,
assign locking declarations.
(generate_coarray_sym_init): Handle locking and
critical variables.
* trans-stmt.c (gfc_trans_critical): Add calls to
lock/unlock libcaf functions.
* trans.h (gfc_coarray_type): Update locking, add
critical enum values.
(gfor_fndecl_caf_critical, gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
libgfortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* caf/libcaf.h (caf_register_t): Update for critical.
(_gfortran_caf_critical, _gfortran_caf_end_critical): Remove.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* caf/single.c (_gfortran_caf_register): Handle locking
variables.
(_gfortran_caf_sendget): Re-name args for consistency.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
From-SVN: r213979
2014-08-14 20:39:15 +02:00
|
|
|
and @dfn{linked} to the user program.
|
2004-05-13 08:41:07 +02:00
|
|
|
@end itemize
|
|
|
|
|
2006-10-05 01:07:39 +02:00
|
|
|
The GNU Fortran compiler consists of several components:
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
@itemize @bullet
|
|
|
|
@item
|
|
|
|
A version of the @command{gcc} command
|
|
|
|
(which also might be installed as the system's @command{cc} command)
|
|
|
|
that also understands and accepts Fortran source code.
|
|
|
|
The @command{gcc} command is the @dfn{driver} program for
|
|
|
|
all the languages in the GNU Compiler Collection (GCC);
|
|
|
|
With @command{gcc},
|
2005-07-02 02:45:55 +02:00
|
|
|
you can compile the source code of any language for
|
2004-05-13 08:41:07 +02:00
|
|
|
which a front end is available in GCC.
|
|
|
|
|
|
|
|
@item
|
|
|
|
The @command{gfortran} command itself,
|
|
|
|
which also might be installed as the
|
|
|
|
system's @command{f95} command.
|
|
|
|
@command{gfortran} is just another driver program,
|
2006-10-05 01:07:39 +02:00
|
|
|
but specifically for the Fortran compiler only.
|
2004-05-13 08:41:07 +02:00
|
|
|
The difference with @command{gcc} is that @command{gfortran}
|
|
|
|
will automatically link the correct libraries to your program.
|
|
|
|
|
|
|
|
@item
|
|
|
|
A collection of run-time libraries.
|
2005-07-02 02:45:55 +02:00
|
|
|
These libraries contain the machine code needed to support
|
2004-05-13 08:41:07 +02:00
|
|
|
capabilities of the Fortran language that are not directly
|
|
|
|
provided by the machine code generated by the
|
|
|
|
@command{gfortran} compilation phase,
|
|
|
|
such as intrinsic functions and subroutines,
|
|
|
|
and routines for interaction with files and the operating system.
|
|
|
|
@c and mechanisms to spawn,
|
|
|
|
@c unleash and pause threads in parallelized code.
|
|
|
|
|
|
|
|
@item
|
|
|
|
The Fortran compiler itself, (@command{f951}).
|
2006-10-05 01:07:39 +02:00
|
|
|
This is the GNU Fortran parser and code generator,
|
2004-05-13 08:41:07 +02:00
|
|
|
linked to and interfaced with the GCC backend library.
|
|
|
|
@command{f951} ``translates'' the source code to
|
|
|
|
assembler code. You would typically not use this
|
|
|
|
program directly;
|
|
|
|
instead, the @command{gcc} or @command{gfortran} driver
|
|
|
|
programs will call it for you.
|
|
|
|
@end itemize
|
|
|
|
|
|
|
|
|
|
|
|
@c ---------------------------------------------------------------------
|
2006-10-05 01:07:39 +02:00
|
|
|
@c GNU Fortran and GCC
|
2004-05-13 08:41:07 +02:00
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
|
2006-10-05 01:07:39 +02:00
|
|
|
@node GNU Fortran and GCC
|
2007-01-04 03:11:05 +01:00
|
|
|
@section GNU Fortran and GCC
|
2004-05-13 08:41:07 +02:00
|
|
|
@cindex GNU Compiler Collection
|
2007-01-04 03:21:38 +01:00
|
|
|
@cindex GCC
|
|
|
|
|
|
|
|
GNU Fortran is a part of GCC, the @dfn{GNU Compiler Collection}. GCC
|
|
|
|
consists of a collection of front ends for various languages, which
|
|
|
|
translate the source code into a language-independent form called
|
|
|
|
@dfn{GENERIC}. This is then processed by a common middle end which
|
|
|
|
provides optimization, and then passed to one of a collection of back
|
|
|
|
ends which generate code for different computer architectures and
|
|
|
|
operating systems.
|
|
|
|
|
|
|
|
Functionally, this is implemented with a driver program (@command{gcc})
|
|
|
|
which provides the command-line interface for the compiler. It calls
|
|
|
|
the relevant compiler front-end program (e.g., @command{f951} for
|
|
|
|
Fortran) for each file in the source code, and then calls the assembler
|
2010-09-24 08:39:20 +02:00
|
|
|
and linker as appropriate to produce the compiled output. In a copy of
|
2007-01-04 03:21:38 +01:00
|
|
|
GCC which has been compiled with Fortran language support enabled,
|
2007-10-27 16:43:53 +02:00
|
|
|
@command{gcc} will recognize files with @file{.f}, @file{.for}, @file{.ftn},
|
re PR fortran/33197 (Fortran 2008: math functions)
PR fortran/33197
gcc/fortran/
* intrinsic.c (add_functions): Modify intrinsics ACOSH, ASINH,
ATANH, ERF, ERFC and GAMMA. Add intrinsics BESSEL_{J,Y}{0,1,N},
ERFC_SCALED, LOG_GAMMA and HYPOT.
* intrinsic.h (gfc_check_hypot, gfc_simplify_hypot,
gfc_resolve_hypot): New prototypes.
* mathbuiltins.def: Add HYPOT builtin. Make complex versions of
ACOSH, ASINH and ATANH available.
* gfortran.h (GFC_ISYM_ERFC_SCALED, GFC_ISYM_HYPOT): New values.
* lang.opt: Add -std=f2008 option.
* libgfortran.h: Define GFC_STD_F2008.
* lang-specs.h: Add .f08 and .F08 file suffixes.
* iresolve.c (gfc_resolve_hypot): New function.
* parse.c (parse_contained): Allow empty CONTAINS for Fortran 2008.
* check.c (gfc_check_hypot): New function.
* trans-intrinsic.c (gfc_intrinsic_map): Define ERFC_SCALE builtin.
* options.c (set_default_std_flags): Allow Fortran 2008 by default.
(form_from_filename): Add .f08 suffix.
(gfc_handle_option): Handle -std=f2008 option.
* simplify.c (gfc_simplify_hypot): New function.
* gfortran.texi: Document Fortran 2008 status and file extensions.
* intrinsic.texi: Document new BESSEL_{J,Y}{0,1,N} intrinsics,
as well as HYPOT and ERFC_SCALED. Update documentation of ERF,
ERFC, GAMMA, LGAMMA, ASINH, ACOSH and ATANH.
* invoke.texi: Document the new -std=f2008 option.
libgomp/
* testsuite/libgomp.fortran/fortran.exp: Add .f08 and
.F08 file suffixes.
gcc/testsuite/
* gfortran.dg/gomp/gomp.exp: Add .f08 and .F08 file suffixes.
* gfortran.dg/dg.exp: Likewise.
* gfortran.dg/vect/vect.exp: Likewise.
* gfortran.fortran-torture/execute/execute.exp: Likewise.
* gfortran.fortran-torture/compile/compile.exp: Likewise.
* gfortran.dg/gamma_1.f90: Also check log_gamma.
* gfortran.dg/invalid_contains_1.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_2.f90: Add a few error messages.
* gfortran.dg/invalid_contains_2.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_3.f90: Adjust error message.
* gfortran.dg/gamma_4.f90: Test for log_gamma instead of lgamma.
* gfortran.dg/bind_c_usage_9.f03: Adjust error messages.
* gfortran.dg/bessel_1.f90: New test.
* gfortran.dg/recursive_check_3.f90: Remove warnings.
* gfortran.dg/besxy.f90: Also check for new F2008 intrinsics.
* gfortran.dg/derived_function_interface_1.f90: Remove warning.
* gfortran.dg/contains_empty_1.f03: New test.
* gfortran.dg/erfc_scaled_1.f90: New test.
* gfortran.dg/hypot_1.f90: New test.
* gfortran.dg/contains_empty_2.f03: New test.
libgfortran/
* intrinsics/erfc_scaled_inc.c: New file.
* intrinsics/erfc_scaled.c: New file.
* gfortran.map (GFORTRAN_1.0): Add _gfortran_erfc_scaled_r*.
* Makefile.am: Add intrinsics/erfc_scaled.c.
* config.h.in: Regenerate.
* configure: Regenerate.
* Makefile.in: Regenerate.
From-SVN: r132846
2008-03-04 00:46:20 +01:00
|
|
|
@file{.f90}, @file{.f95}, @file{.f03} and @file{.f08} extensions as
|
2010-09-24 08:39:20 +02:00
|
|
|
Fortran source code, and compile it accordingly. A @command{gfortran}
|
re PR fortran/33197 (Fortran 2008: math functions)
PR fortran/33197
gcc/fortran/
* intrinsic.c (add_functions): Modify intrinsics ACOSH, ASINH,
ATANH, ERF, ERFC and GAMMA. Add intrinsics BESSEL_{J,Y}{0,1,N},
ERFC_SCALED, LOG_GAMMA and HYPOT.
* intrinsic.h (gfc_check_hypot, gfc_simplify_hypot,
gfc_resolve_hypot): New prototypes.
* mathbuiltins.def: Add HYPOT builtin. Make complex versions of
ACOSH, ASINH and ATANH available.
* gfortran.h (GFC_ISYM_ERFC_SCALED, GFC_ISYM_HYPOT): New values.
* lang.opt: Add -std=f2008 option.
* libgfortran.h: Define GFC_STD_F2008.
* lang-specs.h: Add .f08 and .F08 file suffixes.
* iresolve.c (gfc_resolve_hypot): New function.
* parse.c (parse_contained): Allow empty CONTAINS for Fortran 2008.
* check.c (gfc_check_hypot): New function.
* trans-intrinsic.c (gfc_intrinsic_map): Define ERFC_SCALE builtin.
* options.c (set_default_std_flags): Allow Fortran 2008 by default.
(form_from_filename): Add .f08 suffix.
(gfc_handle_option): Handle -std=f2008 option.
* simplify.c (gfc_simplify_hypot): New function.
* gfortran.texi: Document Fortran 2008 status and file extensions.
* intrinsic.texi: Document new BESSEL_{J,Y}{0,1,N} intrinsics,
as well as HYPOT and ERFC_SCALED. Update documentation of ERF,
ERFC, GAMMA, LGAMMA, ASINH, ACOSH and ATANH.
* invoke.texi: Document the new -std=f2008 option.
libgomp/
* testsuite/libgomp.fortran/fortran.exp: Add .f08 and
.F08 file suffixes.
gcc/testsuite/
* gfortran.dg/gomp/gomp.exp: Add .f08 and .F08 file suffixes.
* gfortran.dg/dg.exp: Likewise.
* gfortran.dg/vect/vect.exp: Likewise.
* gfortran.fortran-torture/execute/execute.exp: Likewise.
* gfortran.fortran-torture/compile/compile.exp: Likewise.
* gfortran.dg/gamma_1.f90: Also check log_gamma.
* gfortran.dg/invalid_contains_1.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_2.f90: Add a few error messages.
* gfortran.dg/invalid_contains_2.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_3.f90: Adjust error message.
* gfortran.dg/gamma_4.f90: Test for log_gamma instead of lgamma.
* gfortran.dg/bind_c_usage_9.f03: Adjust error messages.
* gfortran.dg/bessel_1.f90: New test.
* gfortran.dg/recursive_check_3.f90: Remove warnings.
* gfortran.dg/besxy.f90: Also check for new F2008 intrinsics.
* gfortran.dg/derived_function_interface_1.f90: Remove warning.
* gfortran.dg/contains_empty_1.f03: New test.
* gfortran.dg/erfc_scaled_1.f90: New test.
* gfortran.dg/hypot_1.f90: New test.
* gfortran.dg/contains_empty_2.f03: New test.
libgfortran/
* intrinsics/erfc_scaled_inc.c: New file.
* intrinsics/erfc_scaled.c: New file.
* gfortran.map (GFORTRAN_1.0): Add _gfortran_erfc_scaled_r*.
* Makefile.am: Add intrinsics/erfc_scaled.c.
* config.h.in: Regenerate.
* configure: Regenerate.
* Makefile.in: Regenerate.
From-SVN: r132846
2008-03-04 00:46:20 +01:00
|
|
|
driver program is also provided, which is identical to @command{gcc}
|
|
|
|
except that it automatically links the Fortran runtime libraries into the
|
|
|
|
compiled program.
|
2007-01-04 03:21:38 +01:00
|
|
|
|
2007-11-25 16:57:55 +01:00
|
|
|
Source files with @file{.f}, @file{.for}, @file{.fpp}, @file{.ftn}, @file{.F},
|
|
|
|
@file{.FOR}, @file{.FPP}, and @file{.FTN} extensions are treated as fixed form.
|
re PR fortran/33197 (Fortran 2008: math functions)
PR fortran/33197
gcc/fortran/
* intrinsic.c (add_functions): Modify intrinsics ACOSH, ASINH,
ATANH, ERF, ERFC and GAMMA. Add intrinsics BESSEL_{J,Y}{0,1,N},
ERFC_SCALED, LOG_GAMMA and HYPOT.
* intrinsic.h (gfc_check_hypot, gfc_simplify_hypot,
gfc_resolve_hypot): New prototypes.
* mathbuiltins.def: Add HYPOT builtin. Make complex versions of
ACOSH, ASINH and ATANH available.
* gfortran.h (GFC_ISYM_ERFC_SCALED, GFC_ISYM_HYPOT): New values.
* lang.opt: Add -std=f2008 option.
* libgfortran.h: Define GFC_STD_F2008.
* lang-specs.h: Add .f08 and .F08 file suffixes.
* iresolve.c (gfc_resolve_hypot): New function.
* parse.c (parse_contained): Allow empty CONTAINS for Fortran 2008.
* check.c (gfc_check_hypot): New function.
* trans-intrinsic.c (gfc_intrinsic_map): Define ERFC_SCALE builtin.
* options.c (set_default_std_flags): Allow Fortran 2008 by default.
(form_from_filename): Add .f08 suffix.
(gfc_handle_option): Handle -std=f2008 option.
* simplify.c (gfc_simplify_hypot): New function.
* gfortran.texi: Document Fortran 2008 status and file extensions.
* intrinsic.texi: Document new BESSEL_{J,Y}{0,1,N} intrinsics,
as well as HYPOT and ERFC_SCALED. Update documentation of ERF,
ERFC, GAMMA, LGAMMA, ASINH, ACOSH and ATANH.
* invoke.texi: Document the new -std=f2008 option.
libgomp/
* testsuite/libgomp.fortran/fortran.exp: Add .f08 and
.F08 file suffixes.
gcc/testsuite/
* gfortran.dg/gomp/gomp.exp: Add .f08 and .F08 file suffixes.
* gfortran.dg/dg.exp: Likewise.
* gfortran.dg/vect/vect.exp: Likewise.
* gfortran.fortran-torture/execute/execute.exp: Likewise.
* gfortran.fortran-torture/compile/compile.exp: Likewise.
* gfortran.dg/gamma_1.f90: Also check log_gamma.
* gfortran.dg/invalid_contains_1.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_2.f90: Add a few error messages.
* gfortran.dg/invalid_contains_2.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_3.f90: Adjust error message.
* gfortran.dg/gamma_4.f90: Test for log_gamma instead of lgamma.
* gfortran.dg/bind_c_usage_9.f03: Adjust error messages.
* gfortran.dg/bessel_1.f90: New test.
* gfortran.dg/recursive_check_3.f90: Remove warnings.
* gfortran.dg/besxy.f90: Also check for new F2008 intrinsics.
* gfortran.dg/derived_function_interface_1.f90: Remove warning.
* gfortran.dg/contains_empty_1.f03: New test.
* gfortran.dg/erfc_scaled_1.f90: New test.
* gfortran.dg/hypot_1.f90: New test.
* gfortran.dg/contains_empty_2.f03: New test.
libgfortran/
* intrinsics/erfc_scaled_inc.c: New file.
* intrinsics/erfc_scaled.c: New file.
* gfortran.map (GFORTRAN_1.0): Add _gfortran_erfc_scaled_r*.
* Makefile.am: Add intrinsics/erfc_scaled.c.
* config.h.in: Regenerate.
* configure: Regenerate.
* Makefile.in: Regenerate.
From-SVN: r132846
2008-03-04 00:46:20 +01:00
|
|
|
Source files with @file{.f90}, @file{.f95}, @file{.f03}, @file{.f08},
|
|
|
|
@file{.F90}, @file{.F95}, @file{.F03} and @file{.F08} extensions are
|
|
|
|
treated as free form. The capitalized versions of either form are run
|
2010-09-24 08:39:20 +02:00
|
|
|
through preprocessing. Source files with the lower case @file{.fpp}
|
re PR fortran/33197 (Fortran 2008: math functions)
PR fortran/33197
gcc/fortran/
* intrinsic.c (add_functions): Modify intrinsics ACOSH, ASINH,
ATANH, ERF, ERFC and GAMMA. Add intrinsics BESSEL_{J,Y}{0,1,N},
ERFC_SCALED, LOG_GAMMA and HYPOT.
* intrinsic.h (gfc_check_hypot, gfc_simplify_hypot,
gfc_resolve_hypot): New prototypes.
* mathbuiltins.def: Add HYPOT builtin. Make complex versions of
ACOSH, ASINH and ATANH available.
* gfortran.h (GFC_ISYM_ERFC_SCALED, GFC_ISYM_HYPOT): New values.
* lang.opt: Add -std=f2008 option.
* libgfortran.h: Define GFC_STD_F2008.
* lang-specs.h: Add .f08 and .F08 file suffixes.
* iresolve.c (gfc_resolve_hypot): New function.
* parse.c (parse_contained): Allow empty CONTAINS for Fortran 2008.
* check.c (gfc_check_hypot): New function.
* trans-intrinsic.c (gfc_intrinsic_map): Define ERFC_SCALE builtin.
* options.c (set_default_std_flags): Allow Fortran 2008 by default.
(form_from_filename): Add .f08 suffix.
(gfc_handle_option): Handle -std=f2008 option.
* simplify.c (gfc_simplify_hypot): New function.
* gfortran.texi: Document Fortran 2008 status and file extensions.
* intrinsic.texi: Document new BESSEL_{J,Y}{0,1,N} intrinsics,
as well as HYPOT and ERFC_SCALED. Update documentation of ERF,
ERFC, GAMMA, LGAMMA, ASINH, ACOSH and ATANH.
* invoke.texi: Document the new -std=f2008 option.
libgomp/
* testsuite/libgomp.fortran/fortran.exp: Add .f08 and
.F08 file suffixes.
gcc/testsuite/
* gfortran.dg/gomp/gomp.exp: Add .f08 and .F08 file suffixes.
* gfortran.dg/dg.exp: Likewise.
* gfortran.dg/vect/vect.exp: Likewise.
* gfortran.fortran-torture/execute/execute.exp: Likewise.
* gfortran.fortran-torture/compile/compile.exp: Likewise.
* gfortran.dg/gamma_1.f90: Also check log_gamma.
* gfortran.dg/invalid_contains_1.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_2.f90: Add a few error messages.
* gfortran.dg/invalid_contains_2.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_3.f90: Adjust error message.
* gfortran.dg/gamma_4.f90: Test for log_gamma instead of lgamma.
* gfortran.dg/bind_c_usage_9.f03: Adjust error messages.
* gfortran.dg/bessel_1.f90: New test.
* gfortran.dg/recursive_check_3.f90: Remove warnings.
* gfortran.dg/besxy.f90: Also check for new F2008 intrinsics.
* gfortran.dg/derived_function_interface_1.f90: Remove warning.
* gfortran.dg/contains_empty_1.f03: New test.
* gfortran.dg/erfc_scaled_1.f90: New test.
* gfortran.dg/hypot_1.f90: New test.
* gfortran.dg/contains_empty_2.f03: New test.
libgfortran/
* intrinsics/erfc_scaled_inc.c: New file.
* intrinsics/erfc_scaled.c: New file.
* gfortran.map (GFORTRAN_1.0): Add _gfortran_erfc_scaled_r*.
* Makefile.am: Add intrinsics/erfc_scaled.c.
* config.h.in: Regenerate.
* configure: Regenerate.
* Makefile.in: Regenerate.
From-SVN: r132846
2008-03-04 00:46:20 +01:00
|
|
|
extension are also run through preprocessing.
|
2007-11-25 16:57:55 +01:00
|
|
|
|
2007-01-04 03:21:38 +01:00
|
|
|
This manual specifically documents the Fortran front end, which handles
|
|
|
|
the programming language's syntax and semantics. The aspects of GCC
|
|
|
|
which relate to the optimization passes and the back-end code generation
|
|
|
|
are documented in the GCC manual; see
|
|
|
|
@ref{Top,,Introduction,gcc,Using the GNU Compiler Collection (GCC)}.
|
|
|
|
The two manuals together provide a complete reference for the GNU
|
|
|
|
Fortran compiler.
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
|
2007-09-10 14:09:17 +02:00
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
@c Preprocessing and conditional compilation
|
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
|
|
|
|
@node Preprocessing and conditional compilation
|
|
|
|
@section Preprocessing and conditional compilation
|
|
|
|
@cindex CPP
|
|
|
|
@cindex FPP
|
|
|
|
@cindex Conditional compilation
|
|
|
|
@cindex Preprocessing
|
2008-08-18 22:46:08 +02:00
|
|
|
@cindex preprocessor, include file handling
|
2007-09-10 14:09:17 +02:00
|
|
|
|
2007-11-25 16:57:55 +01:00
|
|
|
Many Fortran compilers including GNU Fortran allow passing the source code
|
|
|
|
through a C preprocessor (CPP; sometimes also called the Fortran preprocessor,
|
2010-09-24 08:39:20 +02:00
|
|
|
FPP) to allow for conditional compilation. In the case of GNU Fortran,
|
|
|
|
this is the GNU C Preprocessor in the traditional mode. On systems with
|
2007-09-10 14:09:17 +02:00
|
|
|
case-preserving file names, the preprocessor is automatically invoked if the
|
2010-09-24 08:39:20 +02:00
|
|
|
filename extension is @file{.F}, @file{.FOR}, @file{.FTN}, @file{.fpp},
|
|
|
|
@file{.FPP}, @file{.F90}, @file{.F95}, @file{.F03} or @file{.F08}. To manually
|
re PR fortran/18428 (No preprocessing option -cpp for gfortran)
gcc:
2008-05-26 Daniel Franke <franke.daniel@gmail.com>
PR fortran/18428
* c.opt: Removed undocumented option '-lang-fortran'.
* c-common.h: Removed global variable 'lang_fortran'.
* c-opts.c (c_common_handle_option): Removed code to handle
option '-lang-fortran'. Updated includes.
* c-cppbuiltin.c (c_cpp_builtins): Removed conditional
definition of '__GFORTRAN__'.
(define__GNUC__): Reimplemented to use BASEVER and
cpp_define_formatted.
(builtin_define_with_value_n): Removed.
* c-incpath.h: Renamed to ...
* incpath.h: ... this.
* c-incpath.c: Renamed to ...
* incpath.c: ... this. Updated includes.
* fix-header.c: Updated includes.
* Makefile.in: Replaced c-incpath.[ch] by incpath.[ch].
(c-cppbuiltin.o): Added dependency on and definition of BASEVER.
(OBJ-archive): Added cppdefault.o, incpath.o and prefix.o.
gcc/cp:
2008-05-26 Daniel Franke <franke.daniel@gmail.com>
* Makefile.in: Adjusted dependencies on c-incpath.o.
gcc/fortran:
2008-05-26 Daniel Franke <franke.daniel@gmail.com>
PR fortran/18428
* lang.opt (A, C, CC, D, E, H, P, U, cpp, d, fworking-directory,
imultilib, iprefix, iquote, isysroot, isystem, nocpp, nostdinc,
o, undef, v): New options.
* options.c (gfc_init_options): Also initialize preprocessor
options.
(gfc_post_options): Also handle post-initialization of preprocessor
options.
(gfc_handle_option): Check if option is a preprocessor option.
If yes, let gfc_cpp_handle_option() handle the option.
* lang-specs.h: Reorganized to handle new options.
* scanner.c (gfc_new_file): Read temporary file instead of
input source if preprocessing is enabled.
* f95-lang.c (gfc_init): Initialize preprocessor.
(gfc_finish): Clean up preprocessor.
* cpp.c: New.
* cpp.h: New.
* Make-lang.in: Added new objects and dependencies.
* gfortran.texi: Updated section "Preprocessing and
conditional compilation".
* invoke.texi: Added new section "Preprocessing Options",
listed and documented the preprocessing options handled by gfortran.
From-SVN: r135882
2008-05-26 00:37:41 +02:00
|
|
|
invoke the preprocessor on any file, use @option{-cpp}, to disable
|
|
|
|
preprocessing on files where the preprocessor is run automatically, use
|
|
|
|
@option{-nocpp}.
|
2007-09-10 14:09:17 +02:00
|
|
|
|
2008-08-18 22:46:08 +02:00
|
|
|
If a preprocessed file includes another file with the Fortran @code{INCLUDE}
|
2010-09-24 08:39:20 +02:00
|
|
|
statement, the included file is not preprocessed. To preprocess included
|
2008-08-18 22:46:08 +02:00
|
|
|
files, use the equivalent preprocessor statement @code{#include}.
|
|
|
|
|
|
|
|
If GNU Fortran invokes the preprocessor, @code{__GFORTRAN__}
|
2007-09-10 14:09:17 +02:00
|
|
|
is defined and @code{__GNUC__}, @code{__GNUC_MINOR__} and
|
|
|
|
@code{__GNUC_PATCHLEVEL__} can be used to determine the version of the
|
2010-09-24 08:39:20 +02:00
|
|
|
compiler. See @ref{Top,,Overview,cpp,The C Preprocessor} for details.
|
2007-09-10 14:09:17 +02:00
|
|
|
|
|
|
|
While CPP is the de-facto standard for preprocessing Fortran code,
|
|
|
|
Part 3 of the Fortran 95 standard (ISO/IEC 1539-3:1998) defines
|
|
|
|
Conditional Compilation, which is not widely used and not directly
|
2010-09-24 08:39:20 +02:00
|
|
|
supported by the GNU Fortran compiler. You can use the program coco
|
2010-09-01 18:34:14 +02:00
|
|
|
to preprocess such files (@uref{http://www.daniellnagle.com/coco.html}).
|
2007-09-10 14:09:17 +02:00
|
|
|
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
@c ---------------------------------------------------------------------
|
2006-10-05 01:07:39 +02:00
|
|
|
@c GNU Fortran and G77
|
2004-05-13 08:41:07 +02:00
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
|
2006-10-05 01:07:39 +02:00
|
|
|
@node GNU Fortran and G77
|
2007-01-04 03:11:05 +01:00
|
|
|
@section GNU Fortran and G77
|
2004-05-13 08:41:07 +02:00
|
|
|
@cindex Fortran 77
|
2007-04-29 12:49:08 +02:00
|
|
|
@cindex @command{g77}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2007-04-29 12:49:08 +02:00
|
|
|
The GNU Fortran compiler is the successor to @command{g77}, the Fortran
|
|
|
|
77 front end included in GCC prior to version 4. It is an entirely new
|
|
|
|
program that has been designed to provide Fortran 95 support and
|
|
|
|
extensibility for future Fortran language standards, as well as providing
|
|
|
|
backwards compatibility for Fortran 77 and nearly all of the GNU language
|
|
|
|
extensions supported by @command{g77}.
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
@c Project Status
|
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
|
|
|
|
@node Project Status
|
2007-01-04 03:11:05 +01:00
|
|
|
@section Project Status
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
@quotation
|
2006-10-05 01:07:39 +02:00
|
|
|
As soon as @command{gfortran} can parse all of the statements correctly,
|
2004-05-13 08:41:07 +02:00
|
|
|
it will be in the ``larva'' state.
|
|
|
|
When we generate code, the ``puppa'' state.
|
2006-10-05 01:07:39 +02:00
|
|
|
When @command{gfortran} is done,
|
2004-05-13 08:41:07 +02:00
|
|
|
we'll see if it will be a beautiful butterfly,
|
|
|
|
or just a big bug....
|
|
|
|
|
|
|
|
--Andy Vaught, April 2000
|
|
|
|
@end quotation
|
|
|
|
|
|
|
|
The start of the GNU Fortran 95 project was announced on
|
|
|
|
the GCC homepage in March 18, 2000
|
|
|
|
(even though Andy had already been working on it for a while,
|
2005-07-02 02:45:55 +02:00
|
|
|
of course).
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2006-10-05 06:58:18 +02:00
|
|
|
The GNU Fortran compiler is able to compile nearly all
|
|
|
|
standard-compliant Fortran 95, Fortran 90, and Fortran 77 programs,
|
|
|
|
including a number of standard and non-standard extensions, and can be
|
|
|
|
used on real-world programs. In particular, the supported extensions
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
include OpenMP, Cray-style pointers, some old vendor extensions, and several
|
|
|
|
Fortran 2003 and Fortran 2008 features, including TR 15581. However, it is
|
|
|
|
still under development and has a few remaining rough edges.
|
Merge current set of OpenACC changes from gomp-4_0-branch.
contrib/
* gcc_update (files_and_dependencies): Update rules for new
libgomp/plugin/Makefrag.am and libgomp/plugin/configfrag.ac files.
gcc/
* builtin-types.def (BT_FN_VOID_INT_INT_VAR)
(BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR)
(BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR):
New function types.
* builtins.c: Include "gomp-constants.h".
(expand_builtin_acc_on_device): New function.
(expand_builtin, is_inexpensive_builtin): Handle
BUILT_IN_ACC_ON_DEVICE.
* builtins.def (DEF_GOACC_BUILTIN, DEF_GOACC_BUILTIN_COMPILER):
New macros.
* cgraph.c (cgraph_node::create): Consider flag_openacc next to
flag_openmp.
* config.gcc <nvptx-*> (tm_file): Add nvptx/offload.h.
<*-intelmic-* | *-intelmicemul-*> (tm_file): Add
i386/intelmic-offload.h.
* gcc.c (LINK_COMMAND_SPEC, GOMP_SELF_SPECS): For -fopenacc, link
to libgomp and its dependencies.
* config/arc/arc.h (LINK_COMMAND_SPEC): Likewise.
* config/darwin.h (LINK_COMMAND_SPEC_A): Likewise.
* config/i386/mingw32.h (GOMP_SELF_SPECS): Likewise.
* config/ia64/hpux.h (LIB_SPEC): Likewise.
* config/pa/pa-hpux11.h (LIB_SPEC): Likewise.
* config/pa/pa64-hpux.h (LIB_SPEC): Likewise.
* doc/generic.texi: Update for OpenACC changes.
* doc/gimple.texi: Likewise.
* doc/invoke.texi: Likewise.
* doc/sourcebuild.texi: Likewise.
* gimple-pretty-print.c (dump_gimple_omp_for): Handle
GF_OMP_FOR_KIND_OACC_LOOP.
(dump_gimple_omp_target): Handle GF_OMP_TARGET_KIND_OACC_KERNELS,
GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_DATA,
GF_OMP_TARGET_KIND_OACC_UPDATE,
GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA.
Dump more data.
* gimple.c: Update comments for OpenACC changes.
* gimple.def: Likewise.
* gimple.h: Likewise.
(enum gf_mask): Add GF_OMP_FOR_KIND_OACC_LOOP,
GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS,
GF_OMP_TARGET_KIND_OACC_DATA, GF_OMP_TARGET_KIND_OACC_UPDATE,
GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA.
(gimple_omp_for_cond, gimple_omp_for_set_cond): Sort in the
appropriate place.
(is_gimple_omp_oacc, is_gimple_omp_offloaded): New functions.
* gimplify.c: Include "gomp-constants.h".
Update comments for OpenACC changes.
(is_gimple_stmt): Handle OACC_PARALLEL, OACC_KERNELS, OACC_DATA,
OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE, OACC_ENTER_DATA,
OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP.
(gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle
OMP_CLAUSE__CACHE_, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT,
OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS,
OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER,
OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT,
OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_AUTO,
OMP_CLAUSE_SEQ.
(gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Use
GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use
OMP_CLAUSE_SET_MAP_KIND.
(gimplify_oacc_cache): New function.
(gimplify_omp_for): Handle OACC_LOOP.
(gimplify_omp_workshare): Handle OACC_KERNELS, OACC_PARALLEL,
OACC_DATA.
(gimplify_omp_target_update): Handle OACC_ENTER_DATA,
OACC_EXIT_DATA, OACC_UPDATE.
(gimplify_expr): Handle OACC_LOOP, OACC_CACHE, OACC_HOST_DATA,
OACC_DECLARE, OACC_KERNELS, OACC_PARALLEL, OACC_DATA,
OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE.
(gimplify_body): Consider flag_openacc next to flag_openmp.
* lto-streamer-out.c: Include "gomp-constants.h".
* omp-builtins.def (BUILT_IN_ACC_GET_DEVICE_TYPE)
(BUILT_IN_GOACC_DATA_START, BUILT_IN_GOACC_DATA_END)
(BUILT_IN_GOACC_ENTER_EXIT_DATA, BUILT_IN_GOACC_PARALLEL)
(BUILT_IN_GOACC_UPDATE, BUILT_IN_GOACC_WAIT)
(BUILT_IN_GOACC_GET_THREAD_NUM, BUILT_IN_GOACC_GET_NUM_THREADS)
(BUILT_IN_ACC_ON_DEVICE): New builtins.
* omp-low.c: Include "gomp-constants.h".
Update comments for OpenACC changes.
(struct omp_context): Add reduction_map, gwv_below, gwv_this
members.
(extract_omp_for_data, use_pointer_for_field, install_var_field)
(new_omp_context, delete_omp_context, scan_sharing_clauses)
(create_omp_child_function, scan_omp_for, scan_omp_target)
(check_omp_nesting_restrictions, lower_reduction_clauses)
(build_omp_regions_1, diagnose_sb_0, make_gimple_omp_edges):
Update for OpenACC changes.
(scan_sharing_clauses): Handle OMP_CLAUSE_NUM_GANGS:
OMP_CLAUSE_NUM_WORKERS: OMP_CLAUSE_VECTOR_LENGTH,
OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_GANG,
OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT,
OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_INDEPENDENT,
OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ. Use GOMP_MAP_* instead of
OMP_CLAUSE_MAP_*.
(expand_omp_for_static_nochunk, expand_omp_for_static_chunk):
Handle GF_OMP_FOR_KIND_OACC_LOOP.
(expand_omp_target, lower_omp_target): Handle
GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS,
GF_OMP_TARGET_KIND_OACC_UPDATE,
GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA,
GF_OMP_TARGET_KIND_OACC_DATA.
(pass_expand_omp::execute, execute_lower_omp)
(pass_diagnose_omp_blocks::gate): Consider flag_openacc next to
flag_openmp.
(offload_symbol_decl): New variable.
(oacc_get_reduction_array_id, oacc_max_threads)
(get_offload_symbol_decl, get_base_type, lookup_oacc_reduction)
(maybe_lookup_oacc_reduction, enclosing_target_ctx)
(oacc_loop_or_target_p, oacc_lower_reduction_var_helper)
(oacc_gimple_assign, oacc_initialize_reduction_data)
(oacc_finalize_reduction_data, oacc_process_reduction_data): New
functions.
(is_targetreg_ctx): Remove function.
* tree-core.h (enum omp_clause_code): Add OMP_CLAUSE__CACHE_,
OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE,
OMP_CLAUSE_GANG, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT,
OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT,
OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_NUM_GANGS,
OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH.
* tree.c (omp_clause_code_name, walk_tree_1): Update accordingly.
* tree.h (OMP_CLAUSE_GANG_EXPR, OMP_CLAUSE_GANG_STATIC_EXPR)
(OMP_CLAUSE_ASYNC_EXPR, OMP_CLAUSE_WAIT_EXPR)
(OMP_CLAUSE_VECTOR_EXPR, OMP_CLAUSE_WORKER_EXPR)
(OMP_CLAUSE_NUM_GANGS_EXPR, OMP_CLAUSE_NUM_WORKERS_EXPR)
(OMP_CLAUSE_VECTOR_LENGTH_EXPR): New macros.
* tree-core.h: Update comments for OpenACC changes.
(enum omp_clause_map_kind): Remove.
(struct tree_omp_clause): Change type of map_kind member from enum
omp_clause_map_kind to unsigned char.
* tree-inline.c: Update comments for OpenACC changes.
* tree-nested.c: Likewise. Include "gomp-constants.h".
(convert_nonlocal_reference_stmt, convert_local_reference_stmt)
(convert_tramp_reference_stmt, convert_gimple_call): Update for
OpenACC changes. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use
OMP_CLAUSE_SET_MAP_KIND.
* tree-pretty-print.c: Include "gomp-constants.h".
(dump_omp_clause): Handle OMP_CLAUSE_DEVICE_RESIDENT,
OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_GANG,
OMP_CLAUSE_ASYNC, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ,
OMP_CLAUSE_WAIT, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR,
OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS,
OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_INDEPENDENT. Use GOMP_MAP_*
instead of OMP_CLAUSE_MAP_*.
(dump_generic_node): Handle OACC_PARALLEL, OACC_KERNELS,
OACC_DATA, OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE,
OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP.
* tree-streamer-in.c: Include "gomp-constants.h".
(unpack_ts_omp_clause_value_fields) Use GOMP_MAP_* instead of
OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND.
* tree-streamer-out.c: Include "gomp-constants.h".
(pack_ts_omp_clause_value_fields): Use GOMP_MAP_* instead of
OMP_CLAUSE_MAP_*.
* tree.def (OACC_PARALLEL, OACC_KERNELS, OACC_DATA)
(OACC_HOST_DATA, OACC_LOOP, OACC_CACHE, OACC_DECLARE)
(OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE): New tree codes.
* tree.c (omp_clause_num_ops): Update accordingly.
* tree.h (OMP_BODY, OMP_CLAUSES, OMP_LOOP_CHECK, OMP_CLAUSE_SIZE):
Likewise.
(OACC_PARALLEL_BODY, OACC_PARALLEL_CLAUSES, OACC_KERNELS_BODY)
(OACC_KERNELS_CLAUSES, OACC_DATA_BODY, OACC_DATA_CLAUSES)
(OACC_HOST_DATA_BODY, OACC_HOST_DATA_CLAUSES, OACC_CACHE_CLAUSES)
(OACC_DECLARE_CLAUSES, OACC_ENTER_DATA_CLAUSES)
(OACC_EXIT_DATA_CLAUSES, OACC_UPDATE_CLAUSES)
(OACC_KERNELS_COMBINED, OACC_PARALLEL_COMBINED): New macros.
* tree.h (OMP_CLAUSE_MAP_KIND): Cast it to enum gomp_map_kind.
(OMP_CLAUSE_SET_MAP_KIND): New macro.
* varpool.c (varpool_node::get_create): Consider flag_openacc next
to flag_openmp.
* config/i386/intelmic-offload.h: New file.
* config/nvptx/offload.h: Likewise.
gcc/ada/
* gcc-interface/utils.c (DEF_FUNCTION_TYPE_VAR_8)
(DEF_FUNCTION_TYPE_VAR_12): New macros.
gcc/c-family/
* c.opt (fopenacc): New option.
* c-cppbuiltin.c (c_cpp_builtins): Conditionally define _OPENACC.
* c-common.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12):
New macros.
* c-common.h (c_finish_oacc_wait): New prototype.
* c-omp.c: Include "omp-low.h" and "gomp-constants.h".
(c_finish_oacc_wait): New function.
* c-pragma.c (oacc_pragmas): New variable.
(c_pp_lookup_pragma, init_pragma): Handle it.
* c-pragma.h (enum pragma_kind): Add PRAGMA_OACC_CACHE,
PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA,
PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP, PRAGMA_OACC_PARALLEL,
PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT.
(enum pragma_omp_clause): Add PRAGMA_OACC_CLAUSE_ASYNC,
PRAGMA_OACC_CLAUSE_AUTO, PRAGMA_OACC_CLAUSE_COLLAPSE,
PRAGMA_OACC_CLAUSE_COPY, PRAGMA_OACC_CLAUSE_COPYIN,
PRAGMA_OACC_CLAUSE_COPYOUT, PRAGMA_OACC_CLAUSE_CREATE,
PRAGMA_OACC_CLAUSE_DELETE, PRAGMA_OACC_CLAUSE_DEVICE,
PRAGMA_OACC_CLAUSE_DEVICEPTR, PRAGMA_OACC_CLAUSE_FIRSTPRIVATE,
PRAGMA_OACC_CLAUSE_GANG, PRAGMA_OACC_CLAUSE_HOST,
PRAGMA_OACC_CLAUSE_IF, PRAGMA_OACC_CLAUSE_NUM_GANGS,
PRAGMA_OACC_CLAUSE_NUM_WORKERS, PRAGMA_OACC_CLAUSE_PRESENT,
PRAGMA_OACC_CLAUSE_PRESENT_OR_COPY,
PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYIN,
PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYOUT,
PRAGMA_OACC_CLAUSE_PRESENT_OR_CREATE, PRAGMA_OACC_CLAUSE_PRIVATE,
PRAGMA_OACC_CLAUSE_REDUCTION, PRAGMA_OACC_CLAUSE_SELF,
PRAGMA_OACC_CLAUSE_SEQ, PRAGMA_OACC_CLAUSE_VECTOR,
PRAGMA_OACC_CLAUSE_VECTOR_LENGTH, PRAGMA_OACC_CLAUSE_WAIT,
PRAGMA_OACC_CLAUSE_WORKER.
gcc/c/
* c-parser.c: Include "gomp-constants.h".
(c_parser_omp_clause_map): Use enum gomp_map_kind instead of enum
omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*.
Use OMP_CLAUSE_SET_MAP_KIND.
(c_parser_pragma): Handle PRAGMA_OACC_ENTER_DATA,
PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_UPDATE.
(c_parser_omp_construct): Handle PRAGMA_OACC_CACHE,
PRAGMA_OACC_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP,
PRAGMA_OACC_PARALLEL, PRAGMA_OACC_WAIT.
(c_parser_omp_clause_name): Handle "auto", "async", "copy",
"copyout", "create", "delete", "deviceptr", "gang", "host",
"num_gangs", "num_workers", "present", "present_or_copy", "pcopy",
"present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout",
"present_or_create", "pcreate", "seq", "self", "vector",
"vector_length", "wait", "worker".
(OACC_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK)
(OACC_ENTER_DATA_CLAUSE_MASK, OACC_EXIT_DATA_CLAUSE_MASK)
(OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK)
(OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros.
(c_parser_omp_variable_list): Handle OMP_CLAUSE__CACHE_.
(c_parser_oacc_wait_list, c_parser_oacc_data_clause)
(c_parser_oacc_data_clause_deviceptr)
(c_parser_omp_clause_num_gangs, c_parser_omp_clause_num_workers)
(c_parser_oacc_clause_async, c_parser_oacc_clause_wait)
(c_parser_omp_clause_vector_length, c_parser_oacc_all_clauses)
(c_parser_oacc_cache, c_parser_oacc_data, c_parser_oacc_kernels)
(c_parser_oacc_enter_exit_data, c_parser_oacc_loop)
(c_parser_oacc_parallel, c_parser_oacc_update)
(c_parser_oacc_wait): New functions.
* c-tree.h (c_finish_oacc_parallel, c_finish_oacc_kernels)
(c_finish_oacc_data): New prototypes.
* c-typeck.c: Include "gomp-constants.h".
(handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use
GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use
OMP_CLAUSE_SET_MAP_KIND.
(c_finish_oacc_parallel, c_finish_oacc_kernels)
(c_finish_oacc_data): New functions.
(c_finish_omp_clauses): Handle OMP_CLAUSE__CACHE_,
OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS,
OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT,
OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_GANG,
OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, and OMP_CLAUSE_MAP's
GOMP_MAP_FORCE_DEVICEPTR.
gcc/cp/
* parser.c: Include "gomp-constants.h".
(cp_parser_omp_clause_map): Use enum gomp_map_kind instead of enum
omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*.
Use OMP_CLAUSE_SET_MAP_KIND.
(cp_parser_omp_construct, cp_parser_pragma): Handle
PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA,
PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_PARALLEL,
PRAGMA_OACC_LOOP, PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT.
(cp_parser_omp_clause_name): Handle "async", "copy", "copyout",
"create", "delete", "deviceptr", "host", "num_gangs",
"num_workers", "present", "present_or_copy", "pcopy",
"present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout",
"present_or_create", "pcreate", "vector_length", "wait".
(OACC_DATA_CLAUSE_MASK, OACC_ENTER_DATA_CLAUSE_MASK)
(OACC_EXIT_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK)
(OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK)
(OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros.
(cp_parser_omp_var_list_no_open): Handle OMP_CLAUSE__CACHE_.
(cp_parser_oacc_data_clause, cp_parser_oacc_data_clause_deviceptr)
(cp_parser_oacc_clause_vector_length, cp_parser_oacc_wait_list)
(cp_parser_oacc_clause_wait, cp_parser_omp_clause_num_gangs)
(cp_parser_omp_clause_num_workers, cp_parser_oacc_clause_async)
(cp_parser_oacc_all_clauses, cp_parser_oacc_cache)
(cp_parser_oacc_data, cp_parser_oacc_enter_exit_data)
(cp_parser_oacc_kernels, cp_parser_oacc_loop)
(cp_parser_oacc_parallel, cp_parser_oacc_update)
(cp_parser_oacc_wait): New functions.
* cp-tree.h (finish_oacc_data, finish_oacc_kernels)
(finish_oacc_parallel): New prototypes.
* semantics.c: Include "gomp-constants.h".
(handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use
GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use
OMP_CLAUSE_SET_MAP_KIND.
(finish_omp_clauses): Handle OMP_CLAUSE_ASYNC,
OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_WAIT, OMP_CLAUSE__CACHE_.
Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*.
(finish_oacc_data, finish_oacc_kernels, finish_oacc_parallel): New
functions.
gcc/fortran/
* lang.opt (fopenacc): New option.
* cpp.c (cpp_define_builtins): Conditionally define _OPENACC.
* dump-parse-tree.c (show_omp_node): Split part of it into...
(show_omp_clauses): ... this new function.
(show_omp_node, show_code_node): Handle EXEC_OACC_PARALLEL_LOOP,
EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS,
EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP,
EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE,
EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA.
(show_namespace): Update for OpenACC.
* f95-lang.c (DEF_FUNCTION_TYPE_VAR_2, DEF_FUNCTION_TYPE_VAR_8)
(DEF_FUNCTION_TYPE_VAR_12, DEF_GOACC_BUILTIN)
(DEF_GOACC_BUILTIN_COMPILER): New macros.
* types.def (BT_FN_VOID_INT_INT_VAR)
(BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR)
(BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR):
New function types.
* gfortran.h (gfc_statement): Add ST_OACC_PARALLEL_LOOP,
ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL,
ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_DATA,
ST_OACC_END_DATA, ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA,
ST_OACC_LOOP, ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE,
ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_KERNELS_LOOP,
ST_OACC_END_KERNELS_LOOP, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA,
ST_OACC_ROUTINE.
(struct gfc_expr_list): New data type.
(gfc_get_expr_list): New macro.
(gfc_omp_map_op): Add OMP_MAP_FORCE_ALLOC, OMP_MAP_FORCE_DEALLOC,
OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM, OMP_MAP_FORCE_TOFROM,
OMP_MAP_FORCE_PRESENT, OMP_MAP_FORCE_DEVICEPTR.
(OMP_LIST_FIRST, OMP_LIST_DEVICE_RESIDENT, OMP_LIST_USE_DEVICE)
(OMP_LIST_CACHE): New enumerators.
(struct gfc_omp_clauses): Add async_expr, gang_expr, worker_expr,
vector_expr, num_gangs_expr, num_workers_expr, vector_length_expr,
wait_list, tile_list, async, gang, worker, vector, seq,
independent, wait, par_auto, gang_static, and loc members.
(struct gfc_namespace): Add oacc_declare_clauses member.
(gfc_exec_op): Add EXEC_OACC_KERNELS_LOOP,
EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS,
EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP,
EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE,
EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA.
(gfc_free_expr_list, gfc_resolve_oacc_directive)
(gfc_resolve_oacc_declare, gfc_resolve_oacc_parallel_loop_blocks)
(gfc_resolve_oacc_blocks): New prototypes.
* match.c (match_exit_cycle): Handle EXEC_OACC_LOOP and
EXEC_OACC_PARALLEL_LOOP.
* match.h (gfc_match_oacc_cache, gfc_match_oacc_wait)
(gfc_match_oacc_update, gfc_match_oacc_declare)
(gfc_match_oacc_loop, gfc_match_oacc_host_data)
(gfc_match_oacc_data, gfc_match_oacc_kernels)
(gfc_match_oacc_kernels_loop, gfc_match_oacc_parallel)
(gfc_match_oacc_parallel_loop, gfc_match_oacc_enter_data)
(gfc_match_oacc_exit_data, gfc_match_oacc_routine): New
prototypes.
* openmp.c: Include "diagnostic.h" and "gomp-constants.h".
(gfc_free_omp_clauses): Update for members added to struct
gfc_omp_clauses.
(gfc_match_omp_clauses): Change mask paramter to uint64_t. Add
openacc parameter.
(resolve_omp_clauses): Add openacc parameter. Update for OpenACC.
(struct fortran_omp_context): Add is_openmp member.
(gfc_resolve_omp_parallel_blocks): Initialize it.
(gfc_resolve_do_iterator): Update for OpenACC.
(gfc_resolve_omp_directive): Call
resolve_omp_directive_inside_oacc_region.
(OMP_CLAUSE_PRIVATE, OMP_CLAUSE_FIRSTPRIVATE)
(OMP_CLAUSE_LASTPRIVATE, OMP_CLAUSE_COPYPRIVATE)
(OMP_CLAUSE_SHARED, OMP_CLAUSE_COPYIN, OMP_CLAUSE_REDUCTION)
(OMP_CLAUSE_IF, OMP_CLAUSE_NUM_THREADS, OMP_CLAUSE_SCHEDULE)
(OMP_CLAUSE_DEFAULT, OMP_CLAUSE_ORDERED, OMP_CLAUSE_COLLAPSE)
(OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE)
(OMP_CLAUSE_ALIGNED, OMP_CLAUSE_DEPEND, OMP_CLAUSE_INBRANCH)
(OMP_CLAUSE_LINEAR, OMP_CLAUSE_NOTINBRANCH, OMP_CLAUSE_PROC_BIND)
(OMP_CLAUSE_SAFELEN, OMP_CLAUSE_SIMDLEN, OMP_CLAUSE_UNIFORM)
(OMP_CLAUSE_DEVICE, OMP_CLAUSE_MAP, OMP_CLAUSE_TO)
(OMP_CLAUSE_FROM, OMP_CLAUSE_NUM_TEAMS, OMP_CLAUSE_THREAD_LIMIT)
(OMP_CLAUSE_DIST_SCHEDULE): Use uint64_t.
(OMP_CLAUSE_ASYNC, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS)
(OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_COPY, OMP_CLAUSE_COPYOUT)
(OMP_CLAUSE_CREATE, OMP_CLAUSE_PRESENT)
(OMP_CLAUSE_PRESENT_OR_COPY, OMP_CLAUSE_PRESENT_OR_COPYIN)
(OMP_CLAUSE_PRESENT_OR_COPYOUT, OMP_CLAUSE_PRESENT_OR_CREATE)
(OMP_CLAUSE_DEVICEPTR, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER)
(OMP_CLAUSE_VECTOR, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT)
(OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_DEVICE_RESIDENT)
(OMP_CLAUSE_HOST_SELF, OMP_CLAUSE_OACC_DEVICE, OMP_CLAUSE_WAIT)
(OMP_CLAUSE_DELETE, OMP_CLAUSE_AUTO, OMP_CLAUSE_TILE): New macros.
(gfc_match_omp_clauses): Handle those.
(OACC_PARALLEL_CLAUSES, OACC_KERNELS_CLAUSES, OACC_DATA_CLAUSES)
(OACC_LOOP_CLAUSES, OACC_PARALLEL_LOOP_CLAUSES)
(OACC_KERNELS_LOOP_CLAUSES, OACC_HOST_DATA_CLAUSES)
(OACC_DECLARE_CLAUSES, OACC_UPDATE_CLAUSES)
(OACC_ENTER_DATA_CLAUSES, OACC_EXIT_DATA_CLAUSES)
(OACC_WAIT_CLAUSES): New macros.
(gfc_free_expr_list, match_oacc_expr_list, match_oacc_clause_gang)
(gfc_match_omp_map_clause, gfc_match_oacc_parallel_loop)
(gfc_match_oacc_parallel, gfc_match_oacc_kernels_loop)
(gfc_match_oacc_kernels, gfc_match_oacc_data)
(gfc_match_oacc_host_data, gfc_match_oacc_loop)
(gfc_match_oacc_declare, gfc_match_oacc_update)
(gfc_match_oacc_enter_data, gfc_match_oacc_exit_data)
(gfc_match_oacc_wait, gfc_match_oacc_cache)
(gfc_match_oacc_routine, oacc_is_loop)
(resolve_oacc_scalar_int_expr, resolve_oacc_positive_int_expr)
(check_symbol_not_pointer, check_array_not_assumed)
(resolve_oacc_data_clauses, resolve_oacc_deviceptr_clause)
(oacc_compatible_clauses, oacc_is_parallel, oacc_is_kernels)
(omp_code_to_statement, oacc_code_to_statement)
(resolve_oacc_directive_inside_omp_region)
(resolve_omp_directive_inside_oacc_region)
(resolve_oacc_nested_loops, resolve_oacc_params_in_parallel)
(resolve_oacc_loop_blocks, gfc_resolve_oacc_blocks)
(resolve_oacc_loop, resolve_oacc_cache, gfc_resolve_oacc_declare)
(gfc_resolve_oacc_directive): New functions.
* parse.c (next_free): Update for OpenACC. Move some code into...
(verify_token_free): ... this new function.
(next_fixed): Update for OpenACC. Move some code into...
(verify_token_fixed): ... this new function.
(case_executable): Add ST_OACC_UPDATE, ST_OACC_WAIT,
ST_OACC_CACHE, ST_OACC_ENTER_DATA, and ST_OACC_EXIT_DATA.
(case_exec_markers): Add ST_OACC_PARALLEL_LOOP, ST_OACC_PARALLEL,
ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA, ST_OACC_LOOP,
ST_OACC_KERNELS_LOOP.
(case_decl): Add ST_OACC_ROUTINE.
(push_state, parse_critical_block, parse_progunit): Update for
OpenACC.
(gfc_ascii_statement): Handle ST_OACC_PARALLEL_LOOP,
ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL,
ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_KERNELS_LOOP,
ST_OACC_END_KERNELS_LOOP, ST_OACC_DATA, ST_OACC_END_DATA,
ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA, ST_OACC_LOOP,
ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE, ST_OACC_WAIT,
ST_OACC_CACHE, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA,
ST_OACC_ROUTINE.
(verify_st_order, parse_spec): Handle ST_OACC_DECLARE.
(parse_executable): Handle ST_OACC_PARALLEL_LOOP,
ST_OACC_KERNELS_LOOP, ST_OACC_LOOP, ST_OACC_PARALLEL,
ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA.
(decode_oacc_directive, parse_oacc_structured_block)
(parse_oacc_loop, is_oacc): New functions.
* parse.h (struct gfc_state_data): Add oacc_declare_clauses
member.
(is_oacc): New prototype.
* resolve.c (gfc_resolve_blocks, gfc_resolve_code): Handle
EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL,
EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA,
EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE,
EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA,
EXEC_OACC_EXIT_DATA.
(resolve_codes): Call gfc_resolve_oacc_declare.
* scanner.c (openacc_flag, openacc_locus): New variables.
(skip_free_comments): Update for OpenACC. Move some code into...
(skip_omp_attribute): ... this new function.
(skip_oacc_attribute): New function.
(skip_fixed_comments, gfc_next_char_literal): Update for OpenACC.
* st.c (gfc_free_statement): Handle EXEC_OACC_PARALLEL_LOOP,
EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS,
EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP,
EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE,
EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA.
* trans-decl.c (gfc_generate_function_code): Update for OpenACC.
* trans-openmp.c: Include "gomp-constants.h".
(gfc_omp_finish_clause, gfc_trans_omp_clauses): Use GOMP_MAP_*
instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND.
(gfc_trans_omp_clauses): Handle OMP_LIST_USE_DEVICE,
OMP_LIST_DEVICE_RESIDENT, OMP_LIST_CACHE, and OMP_MAP_FORCE_ALLOC,
OMP_MAP_FORCE_DEALLOC, OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM,
OMP_MAP_FORCE_TOFROM, OMP_MAP_FORCE_PRESENT,
OMP_MAP_FORCE_DEVICEPTR, and gfc_omp_clauses' async, seq,
independent, wait_list, num_gangs_expr, num_workers_expr,
vector_length_expr, vector, vector_expr, worker, worker_expr,
gang, gang_expr members.
(gfc_trans_omp_do): Handle EXEC_OACC_LOOP.
(gfc_convert_expr_to_tree, gfc_trans_oacc_construct)
(gfc_trans_oacc_executable_directive)
(gfc_trans_oacc_wait_directive, gfc_trans_oacc_combined_directive)
(gfc_trans_oacc_declare, gfc_trans_oacc_directive): New functions.
* trans-stmt.c (gfc_trans_block_construct): Update for OpenACC.
* trans-stmt.h (gfc_trans_oacc_directive, gfc_trans_oacc_declare):
New prototypes.
* trans.c (tranc_code): Handle EXEC_OACC_CACHE, EXEC_OACC_WAIT,
EXEC_OACC_UPDATE, EXEC_OACC_LOOP, EXEC_OACC_HOST_DATA,
EXEC_OACC_DATA, EXEC_OACC_KERNELS, EXEC_OACC_KERNELS_LOOP,
EXEC_OACC_PARALLEL, EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_ENTER_DATA,
EXEC_OACC_EXIT_DATA.
* gfortran.texi: Update for OpenACC.
* intrinsic.texi: Likewise.
* invoke.texi: Likewise.
gcc/lto/
* lto-lang.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12):
New macros.
* lto.c: Include "gomp-constants.h".
gcc/testsuite/
* lib/target-supports.exp (check_effective_target_fopenacc): New
procedure.
* g++.dg/goacc-gomp/goacc-gomp.exp: New file.
* g++.dg/goacc/goacc.exp: Likewise.
* gcc.dg/goacc-gomp/goacc-gomp.exp: Likewise.
* gcc.dg/goacc/goacc.exp: Likewise.
* gfortran.dg/goacc/goacc.exp: Likewise.
* c-c++-common/cpp/openacc-define-1.c: New file.
* c-c++-common/cpp/openacc-define-2.c: Likewise.
* c-c++-common/cpp/openacc-define-3.c: Likewise.
* c-c++-common/goacc-gomp/nesting-1.c: Likewise.
* c-c++-common/goacc-gomp/nesting-fail-1.c: Likewise.
* c-c++-common/goacc/acc_on_device-2-off.c: Likewise.
* c-c++-common/goacc/acc_on_device-2.c: Likewise.
* c-c++-common/goacc/asyncwait-1.c: Likewise.
* c-c++-common/goacc/cache-1.c: Likewise.
* c-c++-common/goacc/clauses-fail.c: Likewise.
* c-c++-common/goacc/collapse-1.c: Likewise.
* c-c++-common/goacc/data-1.c: Likewise.
* c-c++-common/goacc/data-2.c: Likewise.
* c-c++-common/goacc/data-clause-duplicate-1.c: Likewise.
* c-c++-common/goacc/deviceptr-1.c: Likewise.
* c-c++-common/goacc/deviceptr-2.c: Likewise.
* c-c++-common/goacc/deviceptr-3.c: Likewise.
* c-c++-common/goacc/if-clause-1.c: Likewise.
* c-c++-common/goacc/if-clause-2.c: Likewise.
* c-c++-common/goacc/kernels-1.c: Likewise.
* c-c++-common/goacc/loop-1.c: Likewise.
* c-c++-common/goacc/loop-private-1.c: Likewise.
* c-c++-common/goacc/nesting-1.c: Likewise.
* c-c++-common/goacc/nesting-data-1.c: Likewise.
* c-c++-common/goacc/nesting-fail-1.c: Likewise.
* c-c++-common/goacc/parallel-1.c: Likewise.
* c-c++-common/goacc/pcopy.c: Likewise.
* c-c++-common/goacc/pcopyin.c: Likewise.
* c-c++-common/goacc/pcopyout.c: Likewise.
* c-c++-common/goacc/pcreate.c: Likewise.
* c-c++-common/goacc/pragma_context.c: Likewise.
* c-c++-common/goacc/present-1.c: Likewise.
* c-c++-common/goacc/reduction-1.c: Likewise.
* c-c++-common/goacc/reduction-2.c: Likewise.
* c-c++-common/goacc/reduction-3.c: Likewise.
* c-c++-common/goacc/reduction-4.c: Likewise.
* c-c++-common/goacc/sb-1.c: Likewise.
* c-c++-common/goacc/sb-2.c: Likewise.
* c-c++-common/goacc/sb-3.c: Likewise.
* c-c++-common/goacc/update-1.c: Likewise.
* gcc.dg/goacc/acc_on_device-1.c: Likewise.
* gfortran.dg/goacc/acc_on_device-1.f95: Likewise.
* gfortran.dg/goacc/acc_on_device-2-off.f95: Likewise.
* gfortran.dg/goacc/acc_on_device-2.f95: Likewise.
* gfortran.dg/goacc/assumed.f95: Likewise.
* gfortran.dg/goacc/asyncwait-1.f95: Likewise.
* gfortran.dg/goacc/asyncwait-2.f95: Likewise.
* gfortran.dg/goacc/asyncwait-3.f95: Likewise.
* gfortran.dg/goacc/asyncwait-4.f95: Likewise.
* gfortran.dg/goacc/branch.f95: Likewise.
* gfortran.dg/goacc/cache-1.f95: Likewise.
* gfortran.dg/goacc/coarray.f95: Likewise.
* gfortran.dg/goacc/continuation-free-form.f95: Likewise.
* gfortran.dg/goacc/cray.f95: Likewise.
* gfortran.dg/goacc/critical.f95: Likewise.
* gfortran.dg/goacc/data-clauses.f95: Likewise.
* gfortran.dg/goacc/data-tree.f95: Likewise.
* gfortran.dg/goacc/declare-1.f95: Likewise.
* gfortran.dg/goacc/enter-exit-data.f95: Likewise.
* gfortran.dg/goacc/fixed-1.f: Likewise.
* gfortran.dg/goacc/fixed-2.f: Likewise.
* gfortran.dg/goacc/fixed-3.f: Likewise.
* gfortran.dg/goacc/fixed-4.f: Likewise.
* gfortran.dg/goacc/host_data-tree.f95: Likewise.
* gfortran.dg/goacc/if.f95: Likewise.
* gfortran.dg/goacc/kernels-tree.f95: Likewise.
* gfortran.dg/goacc/list.f95: Likewise.
* gfortran.dg/goacc/literal.f95: Likewise.
* gfortran.dg/goacc/loop-1.f95: Likewise.
* gfortran.dg/goacc/loop-2.f95: Likewise.
* gfortran.dg/goacc/loop-3.f95: Likewise.
* gfortran.dg/goacc/loop-tree-1.f90: Likewise.
* gfortran.dg/goacc/omp.f95: Likewise.
* gfortran.dg/goacc/parallel-kernels-clauses.f95: Likewise.
* gfortran.dg/goacc/parallel-kernels-regions.f95: Likewise.
* gfortran.dg/goacc/parallel-tree.f95: Likewise.
* gfortran.dg/goacc/parameter.f95: Likewise.
* gfortran.dg/goacc/private-1.f95: Likewise.
* gfortran.dg/goacc/private-2.f95: Likewise.
* gfortran.dg/goacc/private-3.f95: Likewise.
* gfortran.dg/goacc/pure-elemental-procedures.f95: Likewise.
* gfortran.dg/goacc/reduction-2.f95: Likewise.
* gfortran.dg/goacc/reduction.f95: Likewise.
* gfortran.dg/goacc/routine-1.f90: Likewise.
* gfortran.dg/goacc/routine-2.f90: Likewise.
* gfortran.dg/goacc/sentinel-free-form.f95: Likewise.
* gfortran.dg/goacc/several-directives.f95: Likewise.
* gfortran.dg/goacc/sie.f95: Likewise.
* gfortran.dg/goacc/subarrays.f95: Likewise.
* gfortran.dg/gomp/map-1.f90: Likewise.
* gfortran.dg/openacc-define-1.f90: Likewise.
* gfortran.dg/openacc-define-2.f90: Likewise.
* gfortran.dg/openacc-define-3.f90: Likewise.
* g++.dg/gomp/block-1.C: Update for changed compiler output.
* g++.dg/gomp/block-2.C: Likewise.
* g++.dg/gomp/block-3.C: Likewise.
* g++.dg/gomp/block-5.C: Likewise.
* g++.dg/gomp/target-1.C: Likewise.
* g++.dg/gomp/target-2.C: Likewise.
* g++.dg/gomp/taskgroup-1.C: Likewise.
* g++.dg/gomp/teams-1.C: Likewise.
* gcc.dg/cilk-plus/jump-openmp.c: Likewise.
* gcc.dg/cilk-plus/jump.c: Likewise.
* gcc.dg/gomp/block-1.c: Likewise.
* gcc.dg/gomp/block-10.c: Likewise.
* gcc.dg/gomp/block-2.c: Likewise.
* gcc.dg/gomp/block-3.c: Likewise.
* gcc.dg/gomp/block-4.c: Likewise.
* gcc.dg/gomp/block-5.c: Likewise.
* gcc.dg/gomp/block-6.c: Likewise.
* gcc.dg/gomp/block-7.c: Likewise.
* gcc.dg/gomp/block-8.c: Likewise.
* gcc.dg/gomp/block-9.c: Likewise.
* gcc.dg/gomp/target-1.c: Likewise.
* gcc.dg/gomp/target-2.c: Likewise.
* gcc.dg/gomp/taskgroup-1.c: Likewise.
* gcc.dg/gomp/teams-1.c: Likewise.
include/
* gomp-constants.h: New file.
libgomp/
* Makefile.am (search_path): Add $(top_srcdir)/../include.
(libgomp_la_SOURCES): Add splay-tree.c, libgomp-plugin.c,
oacc-parallel.c, oacc-host.c, oacc-init.c, oacc-mem.c,
oacc-async.c, oacc-plugin.c, oacc-cuda.c.
[USE_FORTRAN] (libgomp_la_SOURCES): Add openacc.f90.
Include $(top_srcdir)/plugin/Makefrag.am.
(nodist_libsubinclude_HEADERS): Add openacc.h.
[USE_FORTRAN] (nodist_finclude_HEADERS): Add openacc_lib.h,
openacc.f90, openacc.mod, openacc_kinds.mod.
(omp_lib.mod): Generalize into...
(%.mod): ... this new rule.
(openacc_kinds.mod, openacc.mod): New rules.
* plugin/configfrag.ac: New file.
* configure.ac: Move plugin/offloading support into it. Include
it. Instantiate testsuite/libgomp-test-support.pt.exp.
* plugin/Makefrag.am: New file.
* testsuite/Makefile.am (OFFLOAD_TARGETS)
(OFFLOAD_ADDITIONAL_OPTIONS, OFFLOAD_ADDITIONAL_LIB_PATHS): Don't
export.
(libgomp-test-support.exp): New rule.
(all-local): Depend on it.
* Makefile.in: Regenerate.
* testsuite/Makefile.in: Regenerate.
* config.h.in: Likewise.
* configure: Likewise.
* configure.tgt: Harden shell syntax.
* env.c: Include "oacc-int.h".
(parse_acc_device_type): New function.
(gomp_debug_var, goacc_device_type, goacc_device_num): New
variables.
(initialize_env): Initialize those. Call
goacc_runtime_initialize.
* error.c (gomp_vdebug, gomp_debug, gomp_vfatal): New functions.
(gomp_fatal): Call gomp_vfatal.
* libgomp.h: Include "libgomp-plugin.h" and <stdarg.h>.
(gomp_debug_var, goacc_device_type, goacc_device_num, gomp_vdebug)
(gomp_debug, gomp_verror, gomp_vfatal, gomp_init_targets_once)
(splay_tree_node, splay_tree, splay_tree_key)
(struct target_mem_desc, struct splay_tree_key_s)
(struct gomp_memory_mapping, struct acc_dispatch_t)
(struct gomp_device_descr, gomp_acc_insert_pointer)
(gomp_acc_remove_pointer, target_mem_desc, gomp_copy_from_async)
(gomp_unmap_vars, gomp_init_device, gomp_init_tables)
(gomp_free_memmap, gomp_fini_device): New declarations.
(gomp_vdebug, gomp_debug): New macros.
Include "splay-tree.h".
* libgomp.map (OACC_2.0): New symbol version. Use for
acc_get_num_devices, acc_get_num_devices_h_, acc_set_device_type,
acc_set_device_type_h_, acc_get_device_type,
acc_get_device_type_h_, acc_set_device_num, acc_set_device_num_h_,
acc_get_device_num, acc_get_device_num_h_, acc_async_test,
acc_async_test_h_, acc_async_test_all, acc_async_test_all_h_,
acc_wait, acc_wait_h_, acc_wait_async, acc_wait_async_h_,
acc_wait_all, acc_wait_all_h_, acc_wait_all_async,
acc_wait_all_async_h_, acc_init, acc_init_h_, acc_shutdown,
acc_shutdown_h_, acc_on_device, acc_on_device_h_, acc_malloc,
acc_free, acc_copyin, acc_copyin_32_h_, acc_copyin_64_h_,
acc_copyin_array_h_, acc_present_or_copyin,
acc_present_or_copyin_32_h_, acc_present_or_copyin_64_h_,
acc_present_or_copyin_array_h_, acc_create, acc_create_32_h_,
acc_create_64_h_, acc_create_array_h_, acc_present_or_create,
acc_present_or_create_32_h_, acc_present_or_create_64_h_,
acc_present_or_create_array_h_, acc_copyout, acc_copyout_32_h_,
acc_copyout_64_h_, acc_copyout_array_h_, acc_delete,
acc_delete_32_h_, acc_delete_64_h_, acc_delete_array_h_,
acc_update_device, acc_update_device_32_h_,
acc_update_device_64_h_, acc_update_device_array_h_,
acc_update_self, acc_update_self_32_h_, acc_update_self_64_h_,
acc_update_self_array_h_, acc_map_data, acc_unmap_data,
acc_deviceptr, acc_hostptr, acc_is_present, acc_is_present_32_h_,
acc_is_present_64_h_, acc_is_present_array_h_,
acc_memcpy_to_device, acc_memcpy_from_device,
acc_get_current_cuda_device, acc_get_current_cuda_context,
acc_get_cuda_stream, acc_set_cuda_stream.
(GOACC_2.0): New symbol version. Use for GOACC_data_end,
GOACC_data_start, GOACC_enter_exit_data, GOACC_parallel,
GOACC_update, GOACC_wait, GOACC_get_thread_num,
GOACC_get_num_threads.
(GOMP_PLUGIN_1.0): New symbol version. Use for
GOMP_PLUGIN_malloc, GOMP_PLUGIN_malloc_cleared,
GOMP_PLUGIN_realloc, GOMP_PLUGIN_debug, GOMP_PLUGIN_error,
GOMP_PLUGIN_fatal, GOMP_PLUGIN_async_unmap_vars,
GOMP_PLUGIN_acc_thread.
* libgomp.texi: Update for OpenACC changes, and GOMP_DEBUG
environment variable.
* libgomp_g.h (GOACC_data_start, GOACC_data_end)
(GOACC_enter_exit_data, GOACC_parallel, GOACC_update, GOACC_wait)
(GOACC_get_num_threads, GOACC_get_thread_num): New declarations.
* splay-tree.h (splay_tree_lookup, splay_tree_insert)
(splay_tree_remove): New declarations.
(rotate_left, rotate_right, splay_tree_splay, splay_tree_insert)
(splay_tree_remove, splay_tree_lookup): Move into...
* splay-tree.c: ... this new file.
* target.c: Include "oacc-plugin.h", "oacc-int.h", <assert.h>.
(splay_tree_node, splay_tree, splay_tree_key)
(struct target_mem_desc, struct splay_tree_key_s)
(struct gomp_device_descr): Don't declare.
(num_devices_openmp): New variable.
(gomp_get_num_devices ): Use it.
(gomp_init_targets_once): New function.
(gomp_get_num_devices ): Use it.
(get_kind, gomp_copy_from_async, gomp_free_memmap)
(gomp_fini_device, gomp_register_image_for_device): New functions.
(gomp_map_vars): Add devaddrs parameter.
(gomp_update): Add mm parameter.
(gomp_init_device): Move most of it into...
(gomp_init_tables): ... this new function.
(gomp_register_images_for_device): Remove function.
(splay_compare, gomp_map_vars, gomp_unmap_vars, gomp_init_device):
Make them hidden instead of static.
(gomp_map_vars_existing, gomp_map_vars, gomp_unmap_vars)
(gomp_update, gomp_init_device, GOMP_target, GOMP_target_data)
(GOMP_target_end_data, GOMP_target_update)
(gomp_load_plugin_for_device, gomp_target_init): Update for
OpenACC changes.
* oacc-async.c: New file.
* oacc-cuda.c: Likewise.
* oacc-host.c: Likewise.
* oacc-init.c: Likewise.
* oacc-int.h: Likewise.
* oacc-mem.c: Likewise.
* oacc-parallel.c: Likewise.
* oacc-plugin.c: Likewise.
* oacc-plugin.h: Likewise.
* oacc-ptx.h: Likewise.
* openacc.f90: Likewise.
* openacc.h: Likewise.
* openacc_lib.h: Likewise.
* plugin/plugin-host.c: Likewise.
* plugin/plugin-nvptx.c: Likewise.
* libgomp-plugin.c: Likewise.
* libgomp-plugin.h: Likewise.
* libgomp_target.h: Remove file after merging content into the
former file. Update all users.
* testsuite/lib/libgomp.exp: Load libgomp-test-support.exp.
(offload_targets_s, offload_targets_s_openacc): New variables.
(check_effective_target_openacc_nvidia_accel_present)
(check_effective_target_openacc_nvidia_accel_selected): New
procedures.
(libgomp_init): Update for OpenACC changes.
* testsuite/libgomp-test-support.exp.in: New file.
* testsuite/libgomp.oacc-c++/c++.exp: Likewise.
* testsuite/libgomp.oacc-c/c.exp: Likewise.
* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
* testsuite/libgomp.oacc-c-c++-common/abort-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/abort-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/abort-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/abort-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/asyncwait-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/cache-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/clauses-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/clauses-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/collapse-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/collapse-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/collapse-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/collapse-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/context-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/context-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/context-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/context-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-5.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-6.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-7.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-8.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/deviceptr-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/if-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-empty.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-10.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-11.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-12.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-13.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-14.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-15.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-16.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-17.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-18.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-19.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-20.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-21.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-22.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-23.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-24.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-25.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-26.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-27.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-28.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-29.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-30.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-31.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-32.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-33.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-34.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-35.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-36.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-37.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-38.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-39.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-40.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-41.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-42.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-43.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-44.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-45.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-46.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-47.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-48.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-49.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-5.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-50.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-51.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-52.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-53.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-54.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-55.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-56.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-57.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-58.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-59.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-6.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-60.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-61.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-62.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-63.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-64.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-65.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-66.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-67.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-68.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-69.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-7.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-70.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-71.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-72.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-73.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-74.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-75.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-76.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-77.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-78.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-79.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-80.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-81.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-82.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-83.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-84.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-85.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-86.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-87.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-88.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-89.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-9.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-90.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-91.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-92.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/nested-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/nested-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/offset-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/parallel-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/parallel-empty.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/pointer-align-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/present-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/present-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-initial-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/subr.h: Likewise.
* testsuite/libgomp.oacc-c-c++-common/subr.ptx: Likewise.
* testsuite/libgomp.oacc-c-c++-common/timer.h: Likewise.
* testsuite/libgomp.oacc-c-c++-common/update-1-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/update-1.c: Likewise.
* testsuite/libgomp.oacc-fortran/abort-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/abort-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f: Likewise.
* testsuite/libgomp.oacc-fortran/asyncwait-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/asyncwait-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/asyncwait-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-4.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-5.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-6.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-7.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-8.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-4-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-4.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-1.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-3.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-4.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-5.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-6.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-7.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-8.f: Likewise.
* testsuite/libgomp.oacc-fortran/lib-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-10.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/lib-3.f: Likewise.
* testsuite/libgomp.oacc-fortran/lib-4.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-5.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-6.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-7.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-8.f90: Likewise.
* testsuite/libgomp.oacc-fortran/map-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/openacc_version-1.f: Likewise.
* testsuite/libgomp.oacc-fortran/openacc_version-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/pointer-align-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/pset-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-4.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-5.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-6.f90: Likewise.
* testsuite/libgomp.oacc-fortran/routine-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/routine-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/routine-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/routine-4.f90: Likewise.
* testsuite/libgomp.oacc-fortran/subarrays-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/subarrays-2.f90: Likewise.
liboffloadmic/
* plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_get_name)
(GOMP_OFFLOAD_get_caps, GOMP_OFFLOAD_fini_device): New functions.
Co-Authored-By: Bernd Schmidt <bernds@codesourcery.com>
Co-Authored-By: Cesar Philippidis <cesar@codesourcery.com>
Co-Authored-By: Dmitry Bocharnikov <dmitry.b@samsung.com>
Co-Authored-By: Evgeny Gavrin <e.gavrin@samsung.com>
Co-Authored-By: Ilmir Usmanov <i.usmanov@samsung.com>
Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
Co-Authored-By: James Norris <jnorris@codesourcery.com>
Co-Authored-By: Julian Brown <julian@codesourcery.com>
Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
Co-Authored-By: Tobias Burnus <burnus@net-b.de>
Co-Authored-By: Tom de Vries <tom@codesourcery.com>
From-SVN: r219682
2015-01-15 21:11:12 +01:00
|
|
|
There also is initial support for OpenACC.
|
|
|
|
Note that this is an experimental feature, incomplete, and subject to
|
|
|
|
change in future versions of GCC. See
|
|
|
|
@uref{https://gcc.gnu.org/wiki/OpenACC} for more information.
|
2006-10-05 06:58:18 +02:00
|
|
|
|
|
|
|
At present, the GNU Fortran compiler passes the
|
|
|
|
@uref{http://www.fortran-2000.com/ArnaudRecipes/fcvs21_f95.html,
|
|
|
|
NIST Fortran 77 Test Suite}, and produces acceptable results on the
|
|
|
|
@uref{http://www.netlib.org/lapack/faq.html#1.21, LAPACK Test Suite}.
|
|
|
|
It also provides respectable performance on
|
2014-05-23 22:32:04 +02:00
|
|
|
the @uref{http://www.polyhedron.com/fortran-compiler-comparisons/polyhedron-benchmark-suite,
|
|
|
|
Polyhedron Fortran
|
2006-10-05 06:58:18 +02:00
|
|
|
compiler benchmarks} and the
|
2014-05-23 22:32:04 +02:00
|
|
|
@uref{http://www.netlib.org/benchmark/livermore,
|
2006-10-05 06:58:18 +02:00
|
|
|
Livermore Fortran Kernels test}. It has been used to compile a number of
|
|
|
|
large real-world programs, including
|
2014-05-26 21:03:17 +02:00
|
|
|
@uref{http://hirlam.org/, the HARMONIE and HIRLAM weather forecasting code} and
|
2014-05-23 22:32:04 +02:00
|
|
|
@uref{http://physical-chemistry.scb.uwa.edu.au/tonto/wiki/index.php/Main_Page,
|
|
|
|
the Tonto quantum chemistry package}; see
|
|
|
|
@url{https://gcc.gnu.org/@/wiki/@/GfortranApps} for an extended list.
|
2006-10-05 06:58:18 +02:00
|
|
|
|
|
|
|
Among other things, the GNU Fortran compiler is intended as a replacement
|
|
|
|
for G77. At this point, nearly all programs that could be compiled with
|
|
|
|
G77 can be compiled with GNU Fortran, although there are a few minor known
|
|
|
|
regressions.
|
|
|
|
|
|
|
|
The primary work remaining to be done on GNU Fortran falls into three
|
|
|
|
categories: bug fixing (primarily regarding the treatment of invalid code
|
|
|
|
and providing useful error messages), improving the compiler optimizations
|
|
|
|
and the performance of compiled code, and extending the compiler to support
|
2009-06-03 22:32:23 +02:00
|
|
|
future standards---in particular, Fortran 2003 and Fortran 2008.
|
2006-10-05 06:58:18 +02:00
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2006-12-17 03:41:48 +01:00
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
@c Standards
|
|
|
|
@c ---------------------------------------------------------------------
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2006-12-17 03:41:48 +01:00
|
|
|
@node Standards
|
2007-01-04 03:11:05 +01:00
|
|
|
@section Standards
|
2006-12-17 03:41:48 +01:00
|
|
|
@cindex Standards
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2009-06-03 22:32:23 +02:00
|
|
|
@menu
|
|
|
|
* Varying Length Character Strings::
|
|
|
|
@end menu
|
|
|
|
|
2006-12-17 03:41:48 +01:00
|
|
|
The GNU Fortran compiler implements
|
|
|
|
ISO/IEC 1539:1997 (Fortran 95). As such, it can also compile essentially all
|
|
|
|
standard-compliant Fortran 90 and Fortran 77 programs. It also supports
|
2010-09-24 08:39:20 +02:00
|
|
|
the ISO/IEC TR-15581 enhancements to allocatable arrays.
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2013-02-07 12:08:20 +01:00
|
|
|
GNU Fortran also have a partial support for ISO/IEC 1539-1:2004 (Fortran
|
|
|
|
2003), ISO/IEC 1539-1:2010 (Fortran 2008), the Technical Specification
|
|
|
|
@code{Further Interoperability of Fortran with C} (ISO/IEC TS 29113:2012).
|
|
|
|
Full support of those standards and future Fortran standards is planned.
|
|
|
|
The current status of the support is can be found in the
|
2015-12-14 20:31:51 +01:00
|
|
|
@ref{Fortran 2003 status}, @ref{Fortran 2008 status}, @ref{TS 29113 status}
|
|
|
|
and @ref{TS 18508 status} sections of the documentation.
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2009-06-03 22:32:23 +02:00
|
|
|
Additionally, the GNU Fortran compilers supports the OpenMP specification
|
2016-11-10 18:05:18 +01:00
|
|
|
(version 4.0 and most of the features of the 4.5 version,
|
|
|
|
@url{http://openmp.org/@/wp/@/openmp-specifications/}).
|
Merge current set of OpenACC changes from gomp-4_0-branch.
contrib/
* gcc_update (files_and_dependencies): Update rules for new
libgomp/plugin/Makefrag.am and libgomp/plugin/configfrag.ac files.
gcc/
* builtin-types.def (BT_FN_VOID_INT_INT_VAR)
(BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR)
(BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR):
New function types.
* builtins.c: Include "gomp-constants.h".
(expand_builtin_acc_on_device): New function.
(expand_builtin, is_inexpensive_builtin): Handle
BUILT_IN_ACC_ON_DEVICE.
* builtins.def (DEF_GOACC_BUILTIN, DEF_GOACC_BUILTIN_COMPILER):
New macros.
* cgraph.c (cgraph_node::create): Consider flag_openacc next to
flag_openmp.
* config.gcc <nvptx-*> (tm_file): Add nvptx/offload.h.
<*-intelmic-* | *-intelmicemul-*> (tm_file): Add
i386/intelmic-offload.h.
* gcc.c (LINK_COMMAND_SPEC, GOMP_SELF_SPECS): For -fopenacc, link
to libgomp and its dependencies.
* config/arc/arc.h (LINK_COMMAND_SPEC): Likewise.
* config/darwin.h (LINK_COMMAND_SPEC_A): Likewise.
* config/i386/mingw32.h (GOMP_SELF_SPECS): Likewise.
* config/ia64/hpux.h (LIB_SPEC): Likewise.
* config/pa/pa-hpux11.h (LIB_SPEC): Likewise.
* config/pa/pa64-hpux.h (LIB_SPEC): Likewise.
* doc/generic.texi: Update for OpenACC changes.
* doc/gimple.texi: Likewise.
* doc/invoke.texi: Likewise.
* doc/sourcebuild.texi: Likewise.
* gimple-pretty-print.c (dump_gimple_omp_for): Handle
GF_OMP_FOR_KIND_OACC_LOOP.
(dump_gimple_omp_target): Handle GF_OMP_TARGET_KIND_OACC_KERNELS,
GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_DATA,
GF_OMP_TARGET_KIND_OACC_UPDATE,
GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA.
Dump more data.
* gimple.c: Update comments for OpenACC changes.
* gimple.def: Likewise.
* gimple.h: Likewise.
(enum gf_mask): Add GF_OMP_FOR_KIND_OACC_LOOP,
GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS,
GF_OMP_TARGET_KIND_OACC_DATA, GF_OMP_TARGET_KIND_OACC_UPDATE,
GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA.
(gimple_omp_for_cond, gimple_omp_for_set_cond): Sort in the
appropriate place.
(is_gimple_omp_oacc, is_gimple_omp_offloaded): New functions.
* gimplify.c: Include "gomp-constants.h".
Update comments for OpenACC changes.
(is_gimple_stmt): Handle OACC_PARALLEL, OACC_KERNELS, OACC_DATA,
OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE, OACC_ENTER_DATA,
OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP.
(gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle
OMP_CLAUSE__CACHE_, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT,
OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS,
OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER,
OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT,
OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_AUTO,
OMP_CLAUSE_SEQ.
(gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Use
GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use
OMP_CLAUSE_SET_MAP_KIND.
(gimplify_oacc_cache): New function.
(gimplify_omp_for): Handle OACC_LOOP.
(gimplify_omp_workshare): Handle OACC_KERNELS, OACC_PARALLEL,
OACC_DATA.
(gimplify_omp_target_update): Handle OACC_ENTER_DATA,
OACC_EXIT_DATA, OACC_UPDATE.
(gimplify_expr): Handle OACC_LOOP, OACC_CACHE, OACC_HOST_DATA,
OACC_DECLARE, OACC_KERNELS, OACC_PARALLEL, OACC_DATA,
OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE.
(gimplify_body): Consider flag_openacc next to flag_openmp.
* lto-streamer-out.c: Include "gomp-constants.h".
* omp-builtins.def (BUILT_IN_ACC_GET_DEVICE_TYPE)
(BUILT_IN_GOACC_DATA_START, BUILT_IN_GOACC_DATA_END)
(BUILT_IN_GOACC_ENTER_EXIT_DATA, BUILT_IN_GOACC_PARALLEL)
(BUILT_IN_GOACC_UPDATE, BUILT_IN_GOACC_WAIT)
(BUILT_IN_GOACC_GET_THREAD_NUM, BUILT_IN_GOACC_GET_NUM_THREADS)
(BUILT_IN_ACC_ON_DEVICE): New builtins.
* omp-low.c: Include "gomp-constants.h".
Update comments for OpenACC changes.
(struct omp_context): Add reduction_map, gwv_below, gwv_this
members.
(extract_omp_for_data, use_pointer_for_field, install_var_field)
(new_omp_context, delete_omp_context, scan_sharing_clauses)
(create_omp_child_function, scan_omp_for, scan_omp_target)
(check_omp_nesting_restrictions, lower_reduction_clauses)
(build_omp_regions_1, diagnose_sb_0, make_gimple_omp_edges):
Update for OpenACC changes.
(scan_sharing_clauses): Handle OMP_CLAUSE_NUM_GANGS:
OMP_CLAUSE_NUM_WORKERS: OMP_CLAUSE_VECTOR_LENGTH,
OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_GANG,
OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT,
OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_INDEPENDENT,
OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ. Use GOMP_MAP_* instead of
OMP_CLAUSE_MAP_*.
(expand_omp_for_static_nochunk, expand_omp_for_static_chunk):
Handle GF_OMP_FOR_KIND_OACC_LOOP.
(expand_omp_target, lower_omp_target): Handle
GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS,
GF_OMP_TARGET_KIND_OACC_UPDATE,
GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA,
GF_OMP_TARGET_KIND_OACC_DATA.
(pass_expand_omp::execute, execute_lower_omp)
(pass_diagnose_omp_blocks::gate): Consider flag_openacc next to
flag_openmp.
(offload_symbol_decl): New variable.
(oacc_get_reduction_array_id, oacc_max_threads)
(get_offload_symbol_decl, get_base_type, lookup_oacc_reduction)
(maybe_lookup_oacc_reduction, enclosing_target_ctx)
(oacc_loop_or_target_p, oacc_lower_reduction_var_helper)
(oacc_gimple_assign, oacc_initialize_reduction_data)
(oacc_finalize_reduction_data, oacc_process_reduction_data): New
functions.
(is_targetreg_ctx): Remove function.
* tree-core.h (enum omp_clause_code): Add OMP_CLAUSE__CACHE_,
OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE,
OMP_CLAUSE_GANG, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT,
OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT,
OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_NUM_GANGS,
OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH.
* tree.c (omp_clause_code_name, walk_tree_1): Update accordingly.
* tree.h (OMP_CLAUSE_GANG_EXPR, OMP_CLAUSE_GANG_STATIC_EXPR)
(OMP_CLAUSE_ASYNC_EXPR, OMP_CLAUSE_WAIT_EXPR)
(OMP_CLAUSE_VECTOR_EXPR, OMP_CLAUSE_WORKER_EXPR)
(OMP_CLAUSE_NUM_GANGS_EXPR, OMP_CLAUSE_NUM_WORKERS_EXPR)
(OMP_CLAUSE_VECTOR_LENGTH_EXPR): New macros.
* tree-core.h: Update comments for OpenACC changes.
(enum omp_clause_map_kind): Remove.
(struct tree_omp_clause): Change type of map_kind member from enum
omp_clause_map_kind to unsigned char.
* tree-inline.c: Update comments for OpenACC changes.
* tree-nested.c: Likewise. Include "gomp-constants.h".
(convert_nonlocal_reference_stmt, convert_local_reference_stmt)
(convert_tramp_reference_stmt, convert_gimple_call): Update for
OpenACC changes. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use
OMP_CLAUSE_SET_MAP_KIND.
* tree-pretty-print.c: Include "gomp-constants.h".
(dump_omp_clause): Handle OMP_CLAUSE_DEVICE_RESIDENT,
OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_GANG,
OMP_CLAUSE_ASYNC, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ,
OMP_CLAUSE_WAIT, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR,
OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS,
OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_INDEPENDENT. Use GOMP_MAP_*
instead of OMP_CLAUSE_MAP_*.
(dump_generic_node): Handle OACC_PARALLEL, OACC_KERNELS,
OACC_DATA, OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE,
OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP.
* tree-streamer-in.c: Include "gomp-constants.h".
(unpack_ts_omp_clause_value_fields) Use GOMP_MAP_* instead of
OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND.
* tree-streamer-out.c: Include "gomp-constants.h".
(pack_ts_omp_clause_value_fields): Use GOMP_MAP_* instead of
OMP_CLAUSE_MAP_*.
* tree.def (OACC_PARALLEL, OACC_KERNELS, OACC_DATA)
(OACC_HOST_DATA, OACC_LOOP, OACC_CACHE, OACC_DECLARE)
(OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE): New tree codes.
* tree.c (omp_clause_num_ops): Update accordingly.
* tree.h (OMP_BODY, OMP_CLAUSES, OMP_LOOP_CHECK, OMP_CLAUSE_SIZE):
Likewise.
(OACC_PARALLEL_BODY, OACC_PARALLEL_CLAUSES, OACC_KERNELS_BODY)
(OACC_KERNELS_CLAUSES, OACC_DATA_BODY, OACC_DATA_CLAUSES)
(OACC_HOST_DATA_BODY, OACC_HOST_DATA_CLAUSES, OACC_CACHE_CLAUSES)
(OACC_DECLARE_CLAUSES, OACC_ENTER_DATA_CLAUSES)
(OACC_EXIT_DATA_CLAUSES, OACC_UPDATE_CLAUSES)
(OACC_KERNELS_COMBINED, OACC_PARALLEL_COMBINED): New macros.
* tree.h (OMP_CLAUSE_MAP_KIND): Cast it to enum gomp_map_kind.
(OMP_CLAUSE_SET_MAP_KIND): New macro.
* varpool.c (varpool_node::get_create): Consider flag_openacc next
to flag_openmp.
* config/i386/intelmic-offload.h: New file.
* config/nvptx/offload.h: Likewise.
gcc/ada/
* gcc-interface/utils.c (DEF_FUNCTION_TYPE_VAR_8)
(DEF_FUNCTION_TYPE_VAR_12): New macros.
gcc/c-family/
* c.opt (fopenacc): New option.
* c-cppbuiltin.c (c_cpp_builtins): Conditionally define _OPENACC.
* c-common.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12):
New macros.
* c-common.h (c_finish_oacc_wait): New prototype.
* c-omp.c: Include "omp-low.h" and "gomp-constants.h".
(c_finish_oacc_wait): New function.
* c-pragma.c (oacc_pragmas): New variable.
(c_pp_lookup_pragma, init_pragma): Handle it.
* c-pragma.h (enum pragma_kind): Add PRAGMA_OACC_CACHE,
PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA,
PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP, PRAGMA_OACC_PARALLEL,
PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT.
(enum pragma_omp_clause): Add PRAGMA_OACC_CLAUSE_ASYNC,
PRAGMA_OACC_CLAUSE_AUTO, PRAGMA_OACC_CLAUSE_COLLAPSE,
PRAGMA_OACC_CLAUSE_COPY, PRAGMA_OACC_CLAUSE_COPYIN,
PRAGMA_OACC_CLAUSE_COPYOUT, PRAGMA_OACC_CLAUSE_CREATE,
PRAGMA_OACC_CLAUSE_DELETE, PRAGMA_OACC_CLAUSE_DEVICE,
PRAGMA_OACC_CLAUSE_DEVICEPTR, PRAGMA_OACC_CLAUSE_FIRSTPRIVATE,
PRAGMA_OACC_CLAUSE_GANG, PRAGMA_OACC_CLAUSE_HOST,
PRAGMA_OACC_CLAUSE_IF, PRAGMA_OACC_CLAUSE_NUM_GANGS,
PRAGMA_OACC_CLAUSE_NUM_WORKERS, PRAGMA_OACC_CLAUSE_PRESENT,
PRAGMA_OACC_CLAUSE_PRESENT_OR_COPY,
PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYIN,
PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYOUT,
PRAGMA_OACC_CLAUSE_PRESENT_OR_CREATE, PRAGMA_OACC_CLAUSE_PRIVATE,
PRAGMA_OACC_CLAUSE_REDUCTION, PRAGMA_OACC_CLAUSE_SELF,
PRAGMA_OACC_CLAUSE_SEQ, PRAGMA_OACC_CLAUSE_VECTOR,
PRAGMA_OACC_CLAUSE_VECTOR_LENGTH, PRAGMA_OACC_CLAUSE_WAIT,
PRAGMA_OACC_CLAUSE_WORKER.
gcc/c/
* c-parser.c: Include "gomp-constants.h".
(c_parser_omp_clause_map): Use enum gomp_map_kind instead of enum
omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*.
Use OMP_CLAUSE_SET_MAP_KIND.
(c_parser_pragma): Handle PRAGMA_OACC_ENTER_DATA,
PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_UPDATE.
(c_parser_omp_construct): Handle PRAGMA_OACC_CACHE,
PRAGMA_OACC_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP,
PRAGMA_OACC_PARALLEL, PRAGMA_OACC_WAIT.
(c_parser_omp_clause_name): Handle "auto", "async", "copy",
"copyout", "create", "delete", "deviceptr", "gang", "host",
"num_gangs", "num_workers", "present", "present_or_copy", "pcopy",
"present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout",
"present_or_create", "pcreate", "seq", "self", "vector",
"vector_length", "wait", "worker".
(OACC_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK)
(OACC_ENTER_DATA_CLAUSE_MASK, OACC_EXIT_DATA_CLAUSE_MASK)
(OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK)
(OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros.
(c_parser_omp_variable_list): Handle OMP_CLAUSE__CACHE_.
(c_parser_oacc_wait_list, c_parser_oacc_data_clause)
(c_parser_oacc_data_clause_deviceptr)
(c_parser_omp_clause_num_gangs, c_parser_omp_clause_num_workers)
(c_parser_oacc_clause_async, c_parser_oacc_clause_wait)
(c_parser_omp_clause_vector_length, c_parser_oacc_all_clauses)
(c_parser_oacc_cache, c_parser_oacc_data, c_parser_oacc_kernels)
(c_parser_oacc_enter_exit_data, c_parser_oacc_loop)
(c_parser_oacc_parallel, c_parser_oacc_update)
(c_parser_oacc_wait): New functions.
* c-tree.h (c_finish_oacc_parallel, c_finish_oacc_kernels)
(c_finish_oacc_data): New prototypes.
* c-typeck.c: Include "gomp-constants.h".
(handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use
GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use
OMP_CLAUSE_SET_MAP_KIND.
(c_finish_oacc_parallel, c_finish_oacc_kernels)
(c_finish_oacc_data): New functions.
(c_finish_omp_clauses): Handle OMP_CLAUSE__CACHE_,
OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS,
OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT,
OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_GANG,
OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, and OMP_CLAUSE_MAP's
GOMP_MAP_FORCE_DEVICEPTR.
gcc/cp/
* parser.c: Include "gomp-constants.h".
(cp_parser_omp_clause_map): Use enum gomp_map_kind instead of enum
omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*.
Use OMP_CLAUSE_SET_MAP_KIND.
(cp_parser_omp_construct, cp_parser_pragma): Handle
PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA,
PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_PARALLEL,
PRAGMA_OACC_LOOP, PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT.
(cp_parser_omp_clause_name): Handle "async", "copy", "copyout",
"create", "delete", "deviceptr", "host", "num_gangs",
"num_workers", "present", "present_or_copy", "pcopy",
"present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout",
"present_or_create", "pcreate", "vector_length", "wait".
(OACC_DATA_CLAUSE_MASK, OACC_ENTER_DATA_CLAUSE_MASK)
(OACC_EXIT_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK)
(OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK)
(OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros.
(cp_parser_omp_var_list_no_open): Handle OMP_CLAUSE__CACHE_.
(cp_parser_oacc_data_clause, cp_parser_oacc_data_clause_deviceptr)
(cp_parser_oacc_clause_vector_length, cp_parser_oacc_wait_list)
(cp_parser_oacc_clause_wait, cp_parser_omp_clause_num_gangs)
(cp_parser_omp_clause_num_workers, cp_parser_oacc_clause_async)
(cp_parser_oacc_all_clauses, cp_parser_oacc_cache)
(cp_parser_oacc_data, cp_parser_oacc_enter_exit_data)
(cp_parser_oacc_kernels, cp_parser_oacc_loop)
(cp_parser_oacc_parallel, cp_parser_oacc_update)
(cp_parser_oacc_wait): New functions.
* cp-tree.h (finish_oacc_data, finish_oacc_kernels)
(finish_oacc_parallel): New prototypes.
* semantics.c: Include "gomp-constants.h".
(handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use
GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use
OMP_CLAUSE_SET_MAP_KIND.
(finish_omp_clauses): Handle OMP_CLAUSE_ASYNC,
OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_WAIT, OMP_CLAUSE__CACHE_.
Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*.
(finish_oacc_data, finish_oacc_kernels, finish_oacc_parallel): New
functions.
gcc/fortran/
* lang.opt (fopenacc): New option.
* cpp.c (cpp_define_builtins): Conditionally define _OPENACC.
* dump-parse-tree.c (show_omp_node): Split part of it into...
(show_omp_clauses): ... this new function.
(show_omp_node, show_code_node): Handle EXEC_OACC_PARALLEL_LOOP,
EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS,
EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP,
EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE,
EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA.
(show_namespace): Update for OpenACC.
* f95-lang.c (DEF_FUNCTION_TYPE_VAR_2, DEF_FUNCTION_TYPE_VAR_8)
(DEF_FUNCTION_TYPE_VAR_12, DEF_GOACC_BUILTIN)
(DEF_GOACC_BUILTIN_COMPILER): New macros.
* types.def (BT_FN_VOID_INT_INT_VAR)
(BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR)
(BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR):
New function types.
* gfortran.h (gfc_statement): Add ST_OACC_PARALLEL_LOOP,
ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL,
ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_DATA,
ST_OACC_END_DATA, ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA,
ST_OACC_LOOP, ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE,
ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_KERNELS_LOOP,
ST_OACC_END_KERNELS_LOOP, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA,
ST_OACC_ROUTINE.
(struct gfc_expr_list): New data type.
(gfc_get_expr_list): New macro.
(gfc_omp_map_op): Add OMP_MAP_FORCE_ALLOC, OMP_MAP_FORCE_DEALLOC,
OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM, OMP_MAP_FORCE_TOFROM,
OMP_MAP_FORCE_PRESENT, OMP_MAP_FORCE_DEVICEPTR.
(OMP_LIST_FIRST, OMP_LIST_DEVICE_RESIDENT, OMP_LIST_USE_DEVICE)
(OMP_LIST_CACHE): New enumerators.
(struct gfc_omp_clauses): Add async_expr, gang_expr, worker_expr,
vector_expr, num_gangs_expr, num_workers_expr, vector_length_expr,
wait_list, tile_list, async, gang, worker, vector, seq,
independent, wait, par_auto, gang_static, and loc members.
(struct gfc_namespace): Add oacc_declare_clauses member.
(gfc_exec_op): Add EXEC_OACC_KERNELS_LOOP,
EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS,
EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP,
EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE,
EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA.
(gfc_free_expr_list, gfc_resolve_oacc_directive)
(gfc_resolve_oacc_declare, gfc_resolve_oacc_parallel_loop_blocks)
(gfc_resolve_oacc_blocks): New prototypes.
* match.c (match_exit_cycle): Handle EXEC_OACC_LOOP and
EXEC_OACC_PARALLEL_LOOP.
* match.h (gfc_match_oacc_cache, gfc_match_oacc_wait)
(gfc_match_oacc_update, gfc_match_oacc_declare)
(gfc_match_oacc_loop, gfc_match_oacc_host_data)
(gfc_match_oacc_data, gfc_match_oacc_kernels)
(gfc_match_oacc_kernels_loop, gfc_match_oacc_parallel)
(gfc_match_oacc_parallel_loop, gfc_match_oacc_enter_data)
(gfc_match_oacc_exit_data, gfc_match_oacc_routine): New
prototypes.
* openmp.c: Include "diagnostic.h" and "gomp-constants.h".
(gfc_free_omp_clauses): Update for members added to struct
gfc_omp_clauses.
(gfc_match_omp_clauses): Change mask paramter to uint64_t. Add
openacc parameter.
(resolve_omp_clauses): Add openacc parameter. Update for OpenACC.
(struct fortran_omp_context): Add is_openmp member.
(gfc_resolve_omp_parallel_blocks): Initialize it.
(gfc_resolve_do_iterator): Update for OpenACC.
(gfc_resolve_omp_directive): Call
resolve_omp_directive_inside_oacc_region.
(OMP_CLAUSE_PRIVATE, OMP_CLAUSE_FIRSTPRIVATE)
(OMP_CLAUSE_LASTPRIVATE, OMP_CLAUSE_COPYPRIVATE)
(OMP_CLAUSE_SHARED, OMP_CLAUSE_COPYIN, OMP_CLAUSE_REDUCTION)
(OMP_CLAUSE_IF, OMP_CLAUSE_NUM_THREADS, OMP_CLAUSE_SCHEDULE)
(OMP_CLAUSE_DEFAULT, OMP_CLAUSE_ORDERED, OMP_CLAUSE_COLLAPSE)
(OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE)
(OMP_CLAUSE_ALIGNED, OMP_CLAUSE_DEPEND, OMP_CLAUSE_INBRANCH)
(OMP_CLAUSE_LINEAR, OMP_CLAUSE_NOTINBRANCH, OMP_CLAUSE_PROC_BIND)
(OMP_CLAUSE_SAFELEN, OMP_CLAUSE_SIMDLEN, OMP_CLAUSE_UNIFORM)
(OMP_CLAUSE_DEVICE, OMP_CLAUSE_MAP, OMP_CLAUSE_TO)
(OMP_CLAUSE_FROM, OMP_CLAUSE_NUM_TEAMS, OMP_CLAUSE_THREAD_LIMIT)
(OMP_CLAUSE_DIST_SCHEDULE): Use uint64_t.
(OMP_CLAUSE_ASYNC, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS)
(OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_COPY, OMP_CLAUSE_COPYOUT)
(OMP_CLAUSE_CREATE, OMP_CLAUSE_PRESENT)
(OMP_CLAUSE_PRESENT_OR_COPY, OMP_CLAUSE_PRESENT_OR_COPYIN)
(OMP_CLAUSE_PRESENT_OR_COPYOUT, OMP_CLAUSE_PRESENT_OR_CREATE)
(OMP_CLAUSE_DEVICEPTR, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER)
(OMP_CLAUSE_VECTOR, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT)
(OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_DEVICE_RESIDENT)
(OMP_CLAUSE_HOST_SELF, OMP_CLAUSE_OACC_DEVICE, OMP_CLAUSE_WAIT)
(OMP_CLAUSE_DELETE, OMP_CLAUSE_AUTO, OMP_CLAUSE_TILE): New macros.
(gfc_match_omp_clauses): Handle those.
(OACC_PARALLEL_CLAUSES, OACC_KERNELS_CLAUSES, OACC_DATA_CLAUSES)
(OACC_LOOP_CLAUSES, OACC_PARALLEL_LOOP_CLAUSES)
(OACC_KERNELS_LOOP_CLAUSES, OACC_HOST_DATA_CLAUSES)
(OACC_DECLARE_CLAUSES, OACC_UPDATE_CLAUSES)
(OACC_ENTER_DATA_CLAUSES, OACC_EXIT_DATA_CLAUSES)
(OACC_WAIT_CLAUSES): New macros.
(gfc_free_expr_list, match_oacc_expr_list, match_oacc_clause_gang)
(gfc_match_omp_map_clause, gfc_match_oacc_parallel_loop)
(gfc_match_oacc_parallel, gfc_match_oacc_kernels_loop)
(gfc_match_oacc_kernels, gfc_match_oacc_data)
(gfc_match_oacc_host_data, gfc_match_oacc_loop)
(gfc_match_oacc_declare, gfc_match_oacc_update)
(gfc_match_oacc_enter_data, gfc_match_oacc_exit_data)
(gfc_match_oacc_wait, gfc_match_oacc_cache)
(gfc_match_oacc_routine, oacc_is_loop)
(resolve_oacc_scalar_int_expr, resolve_oacc_positive_int_expr)
(check_symbol_not_pointer, check_array_not_assumed)
(resolve_oacc_data_clauses, resolve_oacc_deviceptr_clause)
(oacc_compatible_clauses, oacc_is_parallel, oacc_is_kernels)
(omp_code_to_statement, oacc_code_to_statement)
(resolve_oacc_directive_inside_omp_region)
(resolve_omp_directive_inside_oacc_region)
(resolve_oacc_nested_loops, resolve_oacc_params_in_parallel)
(resolve_oacc_loop_blocks, gfc_resolve_oacc_blocks)
(resolve_oacc_loop, resolve_oacc_cache, gfc_resolve_oacc_declare)
(gfc_resolve_oacc_directive): New functions.
* parse.c (next_free): Update for OpenACC. Move some code into...
(verify_token_free): ... this new function.
(next_fixed): Update for OpenACC. Move some code into...
(verify_token_fixed): ... this new function.
(case_executable): Add ST_OACC_UPDATE, ST_OACC_WAIT,
ST_OACC_CACHE, ST_OACC_ENTER_DATA, and ST_OACC_EXIT_DATA.
(case_exec_markers): Add ST_OACC_PARALLEL_LOOP, ST_OACC_PARALLEL,
ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA, ST_OACC_LOOP,
ST_OACC_KERNELS_LOOP.
(case_decl): Add ST_OACC_ROUTINE.
(push_state, parse_critical_block, parse_progunit): Update for
OpenACC.
(gfc_ascii_statement): Handle ST_OACC_PARALLEL_LOOP,
ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL,
ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_KERNELS_LOOP,
ST_OACC_END_KERNELS_LOOP, ST_OACC_DATA, ST_OACC_END_DATA,
ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA, ST_OACC_LOOP,
ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE, ST_OACC_WAIT,
ST_OACC_CACHE, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA,
ST_OACC_ROUTINE.
(verify_st_order, parse_spec): Handle ST_OACC_DECLARE.
(parse_executable): Handle ST_OACC_PARALLEL_LOOP,
ST_OACC_KERNELS_LOOP, ST_OACC_LOOP, ST_OACC_PARALLEL,
ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA.
(decode_oacc_directive, parse_oacc_structured_block)
(parse_oacc_loop, is_oacc): New functions.
* parse.h (struct gfc_state_data): Add oacc_declare_clauses
member.
(is_oacc): New prototype.
* resolve.c (gfc_resolve_blocks, gfc_resolve_code): Handle
EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL,
EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA,
EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE,
EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA,
EXEC_OACC_EXIT_DATA.
(resolve_codes): Call gfc_resolve_oacc_declare.
* scanner.c (openacc_flag, openacc_locus): New variables.
(skip_free_comments): Update for OpenACC. Move some code into...
(skip_omp_attribute): ... this new function.
(skip_oacc_attribute): New function.
(skip_fixed_comments, gfc_next_char_literal): Update for OpenACC.
* st.c (gfc_free_statement): Handle EXEC_OACC_PARALLEL_LOOP,
EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS,
EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP,
EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE,
EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA.
* trans-decl.c (gfc_generate_function_code): Update for OpenACC.
* trans-openmp.c: Include "gomp-constants.h".
(gfc_omp_finish_clause, gfc_trans_omp_clauses): Use GOMP_MAP_*
instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND.
(gfc_trans_omp_clauses): Handle OMP_LIST_USE_DEVICE,
OMP_LIST_DEVICE_RESIDENT, OMP_LIST_CACHE, and OMP_MAP_FORCE_ALLOC,
OMP_MAP_FORCE_DEALLOC, OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM,
OMP_MAP_FORCE_TOFROM, OMP_MAP_FORCE_PRESENT,
OMP_MAP_FORCE_DEVICEPTR, and gfc_omp_clauses' async, seq,
independent, wait_list, num_gangs_expr, num_workers_expr,
vector_length_expr, vector, vector_expr, worker, worker_expr,
gang, gang_expr members.
(gfc_trans_omp_do): Handle EXEC_OACC_LOOP.
(gfc_convert_expr_to_tree, gfc_trans_oacc_construct)
(gfc_trans_oacc_executable_directive)
(gfc_trans_oacc_wait_directive, gfc_trans_oacc_combined_directive)
(gfc_trans_oacc_declare, gfc_trans_oacc_directive): New functions.
* trans-stmt.c (gfc_trans_block_construct): Update for OpenACC.
* trans-stmt.h (gfc_trans_oacc_directive, gfc_trans_oacc_declare):
New prototypes.
* trans.c (tranc_code): Handle EXEC_OACC_CACHE, EXEC_OACC_WAIT,
EXEC_OACC_UPDATE, EXEC_OACC_LOOP, EXEC_OACC_HOST_DATA,
EXEC_OACC_DATA, EXEC_OACC_KERNELS, EXEC_OACC_KERNELS_LOOP,
EXEC_OACC_PARALLEL, EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_ENTER_DATA,
EXEC_OACC_EXIT_DATA.
* gfortran.texi: Update for OpenACC.
* intrinsic.texi: Likewise.
* invoke.texi: Likewise.
gcc/lto/
* lto-lang.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12):
New macros.
* lto.c: Include "gomp-constants.h".
gcc/testsuite/
* lib/target-supports.exp (check_effective_target_fopenacc): New
procedure.
* g++.dg/goacc-gomp/goacc-gomp.exp: New file.
* g++.dg/goacc/goacc.exp: Likewise.
* gcc.dg/goacc-gomp/goacc-gomp.exp: Likewise.
* gcc.dg/goacc/goacc.exp: Likewise.
* gfortran.dg/goacc/goacc.exp: Likewise.
* c-c++-common/cpp/openacc-define-1.c: New file.
* c-c++-common/cpp/openacc-define-2.c: Likewise.
* c-c++-common/cpp/openacc-define-3.c: Likewise.
* c-c++-common/goacc-gomp/nesting-1.c: Likewise.
* c-c++-common/goacc-gomp/nesting-fail-1.c: Likewise.
* c-c++-common/goacc/acc_on_device-2-off.c: Likewise.
* c-c++-common/goacc/acc_on_device-2.c: Likewise.
* c-c++-common/goacc/asyncwait-1.c: Likewise.
* c-c++-common/goacc/cache-1.c: Likewise.
* c-c++-common/goacc/clauses-fail.c: Likewise.
* c-c++-common/goacc/collapse-1.c: Likewise.
* c-c++-common/goacc/data-1.c: Likewise.
* c-c++-common/goacc/data-2.c: Likewise.
* c-c++-common/goacc/data-clause-duplicate-1.c: Likewise.
* c-c++-common/goacc/deviceptr-1.c: Likewise.
* c-c++-common/goacc/deviceptr-2.c: Likewise.
* c-c++-common/goacc/deviceptr-3.c: Likewise.
* c-c++-common/goacc/if-clause-1.c: Likewise.
* c-c++-common/goacc/if-clause-2.c: Likewise.
* c-c++-common/goacc/kernels-1.c: Likewise.
* c-c++-common/goacc/loop-1.c: Likewise.
* c-c++-common/goacc/loop-private-1.c: Likewise.
* c-c++-common/goacc/nesting-1.c: Likewise.
* c-c++-common/goacc/nesting-data-1.c: Likewise.
* c-c++-common/goacc/nesting-fail-1.c: Likewise.
* c-c++-common/goacc/parallel-1.c: Likewise.
* c-c++-common/goacc/pcopy.c: Likewise.
* c-c++-common/goacc/pcopyin.c: Likewise.
* c-c++-common/goacc/pcopyout.c: Likewise.
* c-c++-common/goacc/pcreate.c: Likewise.
* c-c++-common/goacc/pragma_context.c: Likewise.
* c-c++-common/goacc/present-1.c: Likewise.
* c-c++-common/goacc/reduction-1.c: Likewise.
* c-c++-common/goacc/reduction-2.c: Likewise.
* c-c++-common/goacc/reduction-3.c: Likewise.
* c-c++-common/goacc/reduction-4.c: Likewise.
* c-c++-common/goacc/sb-1.c: Likewise.
* c-c++-common/goacc/sb-2.c: Likewise.
* c-c++-common/goacc/sb-3.c: Likewise.
* c-c++-common/goacc/update-1.c: Likewise.
* gcc.dg/goacc/acc_on_device-1.c: Likewise.
* gfortran.dg/goacc/acc_on_device-1.f95: Likewise.
* gfortran.dg/goacc/acc_on_device-2-off.f95: Likewise.
* gfortran.dg/goacc/acc_on_device-2.f95: Likewise.
* gfortran.dg/goacc/assumed.f95: Likewise.
* gfortran.dg/goacc/asyncwait-1.f95: Likewise.
* gfortran.dg/goacc/asyncwait-2.f95: Likewise.
* gfortran.dg/goacc/asyncwait-3.f95: Likewise.
* gfortran.dg/goacc/asyncwait-4.f95: Likewise.
* gfortran.dg/goacc/branch.f95: Likewise.
* gfortran.dg/goacc/cache-1.f95: Likewise.
* gfortran.dg/goacc/coarray.f95: Likewise.
* gfortran.dg/goacc/continuation-free-form.f95: Likewise.
* gfortran.dg/goacc/cray.f95: Likewise.
* gfortran.dg/goacc/critical.f95: Likewise.
* gfortran.dg/goacc/data-clauses.f95: Likewise.
* gfortran.dg/goacc/data-tree.f95: Likewise.
* gfortran.dg/goacc/declare-1.f95: Likewise.
* gfortran.dg/goacc/enter-exit-data.f95: Likewise.
* gfortran.dg/goacc/fixed-1.f: Likewise.
* gfortran.dg/goacc/fixed-2.f: Likewise.
* gfortran.dg/goacc/fixed-3.f: Likewise.
* gfortran.dg/goacc/fixed-4.f: Likewise.
* gfortran.dg/goacc/host_data-tree.f95: Likewise.
* gfortran.dg/goacc/if.f95: Likewise.
* gfortran.dg/goacc/kernels-tree.f95: Likewise.
* gfortran.dg/goacc/list.f95: Likewise.
* gfortran.dg/goacc/literal.f95: Likewise.
* gfortran.dg/goacc/loop-1.f95: Likewise.
* gfortran.dg/goacc/loop-2.f95: Likewise.
* gfortran.dg/goacc/loop-3.f95: Likewise.
* gfortran.dg/goacc/loop-tree-1.f90: Likewise.
* gfortran.dg/goacc/omp.f95: Likewise.
* gfortran.dg/goacc/parallel-kernels-clauses.f95: Likewise.
* gfortran.dg/goacc/parallel-kernels-regions.f95: Likewise.
* gfortran.dg/goacc/parallel-tree.f95: Likewise.
* gfortran.dg/goacc/parameter.f95: Likewise.
* gfortran.dg/goacc/private-1.f95: Likewise.
* gfortran.dg/goacc/private-2.f95: Likewise.
* gfortran.dg/goacc/private-3.f95: Likewise.
* gfortran.dg/goacc/pure-elemental-procedures.f95: Likewise.
* gfortran.dg/goacc/reduction-2.f95: Likewise.
* gfortran.dg/goacc/reduction.f95: Likewise.
* gfortran.dg/goacc/routine-1.f90: Likewise.
* gfortran.dg/goacc/routine-2.f90: Likewise.
* gfortran.dg/goacc/sentinel-free-form.f95: Likewise.
* gfortran.dg/goacc/several-directives.f95: Likewise.
* gfortran.dg/goacc/sie.f95: Likewise.
* gfortran.dg/goacc/subarrays.f95: Likewise.
* gfortran.dg/gomp/map-1.f90: Likewise.
* gfortran.dg/openacc-define-1.f90: Likewise.
* gfortran.dg/openacc-define-2.f90: Likewise.
* gfortran.dg/openacc-define-3.f90: Likewise.
* g++.dg/gomp/block-1.C: Update for changed compiler output.
* g++.dg/gomp/block-2.C: Likewise.
* g++.dg/gomp/block-3.C: Likewise.
* g++.dg/gomp/block-5.C: Likewise.
* g++.dg/gomp/target-1.C: Likewise.
* g++.dg/gomp/target-2.C: Likewise.
* g++.dg/gomp/taskgroup-1.C: Likewise.
* g++.dg/gomp/teams-1.C: Likewise.
* gcc.dg/cilk-plus/jump-openmp.c: Likewise.
* gcc.dg/cilk-plus/jump.c: Likewise.
* gcc.dg/gomp/block-1.c: Likewise.
* gcc.dg/gomp/block-10.c: Likewise.
* gcc.dg/gomp/block-2.c: Likewise.
* gcc.dg/gomp/block-3.c: Likewise.
* gcc.dg/gomp/block-4.c: Likewise.
* gcc.dg/gomp/block-5.c: Likewise.
* gcc.dg/gomp/block-6.c: Likewise.
* gcc.dg/gomp/block-7.c: Likewise.
* gcc.dg/gomp/block-8.c: Likewise.
* gcc.dg/gomp/block-9.c: Likewise.
* gcc.dg/gomp/target-1.c: Likewise.
* gcc.dg/gomp/target-2.c: Likewise.
* gcc.dg/gomp/taskgroup-1.c: Likewise.
* gcc.dg/gomp/teams-1.c: Likewise.
include/
* gomp-constants.h: New file.
libgomp/
* Makefile.am (search_path): Add $(top_srcdir)/../include.
(libgomp_la_SOURCES): Add splay-tree.c, libgomp-plugin.c,
oacc-parallel.c, oacc-host.c, oacc-init.c, oacc-mem.c,
oacc-async.c, oacc-plugin.c, oacc-cuda.c.
[USE_FORTRAN] (libgomp_la_SOURCES): Add openacc.f90.
Include $(top_srcdir)/plugin/Makefrag.am.
(nodist_libsubinclude_HEADERS): Add openacc.h.
[USE_FORTRAN] (nodist_finclude_HEADERS): Add openacc_lib.h,
openacc.f90, openacc.mod, openacc_kinds.mod.
(omp_lib.mod): Generalize into...
(%.mod): ... this new rule.
(openacc_kinds.mod, openacc.mod): New rules.
* plugin/configfrag.ac: New file.
* configure.ac: Move plugin/offloading support into it. Include
it. Instantiate testsuite/libgomp-test-support.pt.exp.
* plugin/Makefrag.am: New file.
* testsuite/Makefile.am (OFFLOAD_TARGETS)
(OFFLOAD_ADDITIONAL_OPTIONS, OFFLOAD_ADDITIONAL_LIB_PATHS): Don't
export.
(libgomp-test-support.exp): New rule.
(all-local): Depend on it.
* Makefile.in: Regenerate.
* testsuite/Makefile.in: Regenerate.
* config.h.in: Likewise.
* configure: Likewise.
* configure.tgt: Harden shell syntax.
* env.c: Include "oacc-int.h".
(parse_acc_device_type): New function.
(gomp_debug_var, goacc_device_type, goacc_device_num): New
variables.
(initialize_env): Initialize those. Call
goacc_runtime_initialize.
* error.c (gomp_vdebug, gomp_debug, gomp_vfatal): New functions.
(gomp_fatal): Call gomp_vfatal.
* libgomp.h: Include "libgomp-plugin.h" and <stdarg.h>.
(gomp_debug_var, goacc_device_type, goacc_device_num, gomp_vdebug)
(gomp_debug, gomp_verror, gomp_vfatal, gomp_init_targets_once)
(splay_tree_node, splay_tree, splay_tree_key)
(struct target_mem_desc, struct splay_tree_key_s)
(struct gomp_memory_mapping, struct acc_dispatch_t)
(struct gomp_device_descr, gomp_acc_insert_pointer)
(gomp_acc_remove_pointer, target_mem_desc, gomp_copy_from_async)
(gomp_unmap_vars, gomp_init_device, gomp_init_tables)
(gomp_free_memmap, gomp_fini_device): New declarations.
(gomp_vdebug, gomp_debug): New macros.
Include "splay-tree.h".
* libgomp.map (OACC_2.0): New symbol version. Use for
acc_get_num_devices, acc_get_num_devices_h_, acc_set_device_type,
acc_set_device_type_h_, acc_get_device_type,
acc_get_device_type_h_, acc_set_device_num, acc_set_device_num_h_,
acc_get_device_num, acc_get_device_num_h_, acc_async_test,
acc_async_test_h_, acc_async_test_all, acc_async_test_all_h_,
acc_wait, acc_wait_h_, acc_wait_async, acc_wait_async_h_,
acc_wait_all, acc_wait_all_h_, acc_wait_all_async,
acc_wait_all_async_h_, acc_init, acc_init_h_, acc_shutdown,
acc_shutdown_h_, acc_on_device, acc_on_device_h_, acc_malloc,
acc_free, acc_copyin, acc_copyin_32_h_, acc_copyin_64_h_,
acc_copyin_array_h_, acc_present_or_copyin,
acc_present_or_copyin_32_h_, acc_present_or_copyin_64_h_,
acc_present_or_copyin_array_h_, acc_create, acc_create_32_h_,
acc_create_64_h_, acc_create_array_h_, acc_present_or_create,
acc_present_or_create_32_h_, acc_present_or_create_64_h_,
acc_present_or_create_array_h_, acc_copyout, acc_copyout_32_h_,
acc_copyout_64_h_, acc_copyout_array_h_, acc_delete,
acc_delete_32_h_, acc_delete_64_h_, acc_delete_array_h_,
acc_update_device, acc_update_device_32_h_,
acc_update_device_64_h_, acc_update_device_array_h_,
acc_update_self, acc_update_self_32_h_, acc_update_self_64_h_,
acc_update_self_array_h_, acc_map_data, acc_unmap_data,
acc_deviceptr, acc_hostptr, acc_is_present, acc_is_present_32_h_,
acc_is_present_64_h_, acc_is_present_array_h_,
acc_memcpy_to_device, acc_memcpy_from_device,
acc_get_current_cuda_device, acc_get_current_cuda_context,
acc_get_cuda_stream, acc_set_cuda_stream.
(GOACC_2.0): New symbol version. Use for GOACC_data_end,
GOACC_data_start, GOACC_enter_exit_data, GOACC_parallel,
GOACC_update, GOACC_wait, GOACC_get_thread_num,
GOACC_get_num_threads.
(GOMP_PLUGIN_1.0): New symbol version. Use for
GOMP_PLUGIN_malloc, GOMP_PLUGIN_malloc_cleared,
GOMP_PLUGIN_realloc, GOMP_PLUGIN_debug, GOMP_PLUGIN_error,
GOMP_PLUGIN_fatal, GOMP_PLUGIN_async_unmap_vars,
GOMP_PLUGIN_acc_thread.
* libgomp.texi: Update for OpenACC changes, and GOMP_DEBUG
environment variable.
* libgomp_g.h (GOACC_data_start, GOACC_data_end)
(GOACC_enter_exit_data, GOACC_parallel, GOACC_update, GOACC_wait)
(GOACC_get_num_threads, GOACC_get_thread_num): New declarations.
* splay-tree.h (splay_tree_lookup, splay_tree_insert)
(splay_tree_remove): New declarations.
(rotate_left, rotate_right, splay_tree_splay, splay_tree_insert)
(splay_tree_remove, splay_tree_lookup): Move into...
* splay-tree.c: ... this new file.
* target.c: Include "oacc-plugin.h", "oacc-int.h", <assert.h>.
(splay_tree_node, splay_tree, splay_tree_key)
(struct target_mem_desc, struct splay_tree_key_s)
(struct gomp_device_descr): Don't declare.
(num_devices_openmp): New variable.
(gomp_get_num_devices ): Use it.
(gomp_init_targets_once): New function.
(gomp_get_num_devices ): Use it.
(get_kind, gomp_copy_from_async, gomp_free_memmap)
(gomp_fini_device, gomp_register_image_for_device): New functions.
(gomp_map_vars): Add devaddrs parameter.
(gomp_update): Add mm parameter.
(gomp_init_device): Move most of it into...
(gomp_init_tables): ... this new function.
(gomp_register_images_for_device): Remove function.
(splay_compare, gomp_map_vars, gomp_unmap_vars, gomp_init_device):
Make them hidden instead of static.
(gomp_map_vars_existing, gomp_map_vars, gomp_unmap_vars)
(gomp_update, gomp_init_device, GOMP_target, GOMP_target_data)
(GOMP_target_end_data, GOMP_target_update)
(gomp_load_plugin_for_device, gomp_target_init): Update for
OpenACC changes.
* oacc-async.c: New file.
* oacc-cuda.c: Likewise.
* oacc-host.c: Likewise.
* oacc-init.c: Likewise.
* oacc-int.h: Likewise.
* oacc-mem.c: Likewise.
* oacc-parallel.c: Likewise.
* oacc-plugin.c: Likewise.
* oacc-plugin.h: Likewise.
* oacc-ptx.h: Likewise.
* openacc.f90: Likewise.
* openacc.h: Likewise.
* openacc_lib.h: Likewise.
* plugin/plugin-host.c: Likewise.
* plugin/plugin-nvptx.c: Likewise.
* libgomp-plugin.c: Likewise.
* libgomp-plugin.h: Likewise.
* libgomp_target.h: Remove file after merging content into the
former file. Update all users.
* testsuite/lib/libgomp.exp: Load libgomp-test-support.exp.
(offload_targets_s, offload_targets_s_openacc): New variables.
(check_effective_target_openacc_nvidia_accel_present)
(check_effective_target_openacc_nvidia_accel_selected): New
procedures.
(libgomp_init): Update for OpenACC changes.
* testsuite/libgomp-test-support.exp.in: New file.
* testsuite/libgomp.oacc-c++/c++.exp: Likewise.
* testsuite/libgomp.oacc-c/c.exp: Likewise.
* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
* testsuite/libgomp.oacc-c-c++-common/abort-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/abort-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/abort-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/abort-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/asyncwait-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/cache-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/clauses-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/clauses-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/collapse-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/collapse-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/collapse-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/collapse-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/context-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/context-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/context-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/context-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-5.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-6.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-7.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-8.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/deviceptr-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/if-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-empty.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-10.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-11.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-12.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-13.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-14.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-15.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-16.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-17.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-18.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-19.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-20.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-21.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-22.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-23.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-24.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-25.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-26.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-27.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-28.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-29.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-30.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-31.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-32.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-33.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-34.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-35.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-36.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-37.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-38.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-39.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-40.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-41.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-42.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-43.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-44.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-45.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-46.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-47.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-48.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-49.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-5.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-50.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-51.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-52.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-53.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-54.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-55.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-56.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-57.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-58.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-59.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-6.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-60.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-61.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-62.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-63.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-64.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-65.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-66.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-67.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-68.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-69.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-7.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-70.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-71.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-72.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-73.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-74.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-75.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-76.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-77.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-78.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-79.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-80.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-81.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-82.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-83.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-84.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-85.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-86.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-87.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-88.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-89.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-9.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-90.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-91.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-92.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/nested-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/nested-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/offset-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/parallel-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/parallel-empty.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/pointer-align-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/present-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/present-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-initial-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/subr.h: Likewise.
* testsuite/libgomp.oacc-c-c++-common/subr.ptx: Likewise.
* testsuite/libgomp.oacc-c-c++-common/timer.h: Likewise.
* testsuite/libgomp.oacc-c-c++-common/update-1-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/update-1.c: Likewise.
* testsuite/libgomp.oacc-fortran/abort-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/abort-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f: Likewise.
* testsuite/libgomp.oacc-fortran/asyncwait-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/asyncwait-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/asyncwait-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-4.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-5.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-6.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-7.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-8.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-4-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-4.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-1.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-3.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-4.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-5.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-6.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-7.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-8.f: Likewise.
* testsuite/libgomp.oacc-fortran/lib-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-10.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/lib-3.f: Likewise.
* testsuite/libgomp.oacc-fortran/lib-4.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-5.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-6.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-7.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-8.f90: Likewise.
* testsuite/libgomp.oacc-fortran/map-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/openacc_version-1.f: Likewise.
* testsuite/libgomp.oacc-fortran/openacc_version-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/pointer-align-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/pset-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-4.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-5.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-6.f90: Likewise.
* testsuite/libgomp.oacc-fortran/routine-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/routine-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/routine-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/routine-4.f90: Likewise.
* testsuite/libgomp.oacc-fortran/subarrays-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/subarrays-2.f90: Likewise.
liboffloadmic/
* plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_get_name)
(GOMP_OFFLOAD_get_caps, GOMP_OFFLOAD_fini_device): New functions.
Co-Authored-By: Bernd Schmidt <bernds@codesourcery.com>
Co-Authored-By: Cesar Philippidis <cesar@codesourcery.com>
Co-Authored-By: Dmitry Bocharnikov <dmitry.b@samsung.com>
Co-Authored-By: Evgeny Gavrin <e.gavrin@samsung.com>
Co-Authored-By: Ilmir Usmanov <i.usmanov@samsung.com>
Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
Co-Authored-By: James Norris <jnorris@codesourcery.com>
Co-Authored-By: Julian Brown <julian@codesourcery.com>
Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
Co-Authored-By: Tobias Burnus <burnus@net-b.de>
Co-Authored-By: Tom de Vries <tom@codesourcery.com>
From-SVN: r219682
2015-01-15 21:11:12 +01:00
|
|
|
There also is initial support for the OpenACC specification (targeting
|
|
|
|
version 2.0, @uref{http://www.openacc.org/}).
|
|
|
|
Note that this is an experimental feature, incomplete, and subject to
|
|
|
|
change in future versions of GCC. See
|
|
|
|
@uref{https://gcc.gnu.org/wiki/OpenACC} for more information.
|
2009-06-03 22:32:23 +02:00
|
|
|
|
|
|
|
@node Varying Length Character Strings
|
|
|
|
@subsection Varying Length Character Strings
|
|
|
|
@cindex Varying length character strings
|
|
|
|
@cindex Varying length strings
|
|
|
|
@cindex strings, varying length
|
|
|
|
|
|
|
|
The Fortran 95 standard specifies in Part 2 (ISO/IEC 1539-2:2000)
|
2010-09-24 08:39:20 +02:00
|
|
|
varying length character strings. While GNU Fortran currently does not
|
2009-06-03 22:32:23 +02:00
|
|
|
support such strings directly, there exist two Fortran implementations
|
2010-09-24 08:39:20 +02:00
|
|
|
for them, which work with GNU Fortran. They can be found at
|
2009-06-03 22:32:23 +02:00
|
|
|
@uref{http://www.fortran.com/@/iso_varying_string.f95} and at
|
|
|
|
@uref{ftp://ftp.nag.co.uk/@/sc22wg5/@/ISO_VARYING_STRING/}.
|
|
|
|
|
2013-02-07 12:08:20 +01:00
|
|
|
Deferred-length character strings of Fortran 2003 supports part of
|
|
|
|
the features of @code{ISO_VARYING_STRING} and should be considered as
|
|
|
|
replacement. (Namely, allocatable or pointers of the type
|
|
|
|
@code{character(len=:)}.)
|
2009-06-03 22:32:23 +02:00
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2006-12-17 03:41:48 +01:00
|
|
|
@c =====================================================================
|
2007-01-04 03:11:05 +01:00
|
|
|
@c PART I: INVOCATION REFERENCE
|
2006-12-17 03:41:48 +01:00
|
|
|
@c =====================================================================
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2006-12-17 03:41:48 +01:00
|
|
|
@tex
|
2007-01-04 03:11:05 +01:00
|
|
|
\part{I}{Invoking GNU Fortran}
|
2006-12-17 03:41:48 +01:00
|
|
|
@end tex
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2006-12-17 03:41:48 +01:00
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
@c Compiler Options
|
|
|
|
@c ---------------------------------------------------------------------
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2006-12-17 03:41:48 +01:00
|
|
|
@include invoke.texi
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2006-10-05 06:58:18 +02:00
|
|
|
|
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
@c Runtime
|
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
|
2006-02-06 21:12:44 +01:00
|
|
|
@node Runtime
|
|
|
|
@chapter Runtime: Influencing runtime behavior with environment variables
|
2007-04-29 12:49:08 +02:00
|
|
|
@cindex environment variable
|
2006-02-06 21:12:44 +01:00
|
|
|
|
2006-04-08 16:31:12 +02:00
|
|
|
The behavior of the @command{gfortran} can be influenced by
|
2006-02-06 21:12:44 +01:00
|
|
|
environment variables.
|
2006-02-19 21:28:02 +01:00
|
|
|
|
|
|
|
Malformed environment variables are silently ignored.
|
|
|
|
|
2006-02-06 21:12:44 +01:00
|
|
|
@menu
|
2012-05-05 08:30:51 +02:00
|
|
|
* TMPDIR:: Directory for scratch files
|
2006-02-19 21:28:02 +01:00
|
|
|
* GFORTRAN_STDIN_UNIT:: Unit number for standard input
|
|
|
|
* GFORTRAN_STDOUT_UNIT:: Unit number for standard output
|
|
|
|
* GFORTRAN_STDERR_UNIT:: Unit number for standard error
|
2011-11-07 23:21:54 +01:00
|
|
|
* GFORTRAN_UNBUFFERED_ALL:: Do not buffer I/O for all units.
|
|
|
|
* GFORTRAN_UNBUFFERED_PRECONNECTED:: Do not buffer I/O for preconnected units.
|
2006-02-19 21:28:02 +01:00
|
|
|
* GFORTRAN_SHOW_LOCUS:: Show location for runtime errors
|
|
|
|
* GFORTRAN_OPTIONAL_PLUS:: Print leading + where permitted
|
|
|
|
* GFORTRAN_DEFAULT_RECL:: Default record length for new files
|
|
|
|
* GFORTRAN_LIST_SEPARATOR:: Separator for list output
|
2006-02-06 21:12:44 +01:00
|
|
|
* GFORTRAN_CONVERT_UNIT:: Set endianness for unformatted I/O
|
2007-05-26 15:29:29 +02:00
|
|
|
* GFORTRAN_ERROR_BACKTRACE:: Show backtrace on run-time errors
|
2006-02-06 21:12:44 +01:00
|
|
|
@end menu
|
|
|
|
|
2012-05-05 08:30:51 +02:00
|
|
|
@node TMPDIR
|
|
|
|
@section @env{TMPDIR}---Directory for scratch files
|
|
|
|
|
|
|
|
When opening a file with @code{STATUS='SCRATCH'}, GNU Fortran tries to
|
|
|
|
create the file in one of the potential directories by testing each
|
|
|
|
directory in the order below.
|
|
|
|
|
|
|
|
@enumerate
|
|
|
|
@item
|
|
|
|
The environment variable @env{TMPDIR}, if it exists.
|
|
|
|
|
|
|
|
@item
|
|
|
|
On the MinGW target, the directory returned by the @code{GetTempPath}
|
|
|
|
function. Alternatively, on the Cygwin target, the @env{TMP} and
|
|
|
|
@env{TEMP} environment variables, if they exist, in that order.
|
|
|
|
|
|
|
|
@item
|
|
|
|
The @code{P_tmpdir} macro if it is defined, otherwise the directory
|
|
|
|
@file{/tmp}.
|
|
|
|
@end enumerate
|
|
|
|
|
2006-02-19 21:28:02 +01:00
|
|
|
@node GFORTRAN_STDIN_UNIT
|
|
|
|
@section @env{GFORTRAN_STDIN_UNIT}---Unit number for standard input
|
|
|
|
|
|
|
|
This environment variable can be used to select the unit number
|
|
|
|
preconnected to standard input. This must be a positive integer.
|
|
|
|
The default value is 5.
|
|
|
|
|
|
|
|
@node GFORTRAN_STDOUT_UNIT
|
|
|
|
@section @env{GFORTRAN_STDOUT_UNIT}---Unit number for standard output
|
|
|
|
|
|
|
|
This environment variable can be used to select the unit number
|
|
|
|
preconnected to standard output. This must be a positive integer.
|
|
|
|
The default value is 6.
|
|
|
|
|
|
|
|
@node GFORTRAN_STDERR_UNIT
|
|
|
|
@section @env{GFORTRAN_STDERR_UNIT}---Unit number for standard error
|
|
|
|
|
|
|
|
This environment variable can be used to select the unit number
|
|
|
|
preconnected to standard error. This must be a positive integer.
|
|
|
|
The default value is 0.
|
|
|
|
|
|
|
|
@node GFORTRAN_UNBUFFERED_ALL
|
2011-11-07 23:21:54 +01:00
|
|
|
@section @env{GFORTRAN_UNBUFFERED_ALL}---Do not buffer I/O on all units
|
2006-02-19 21:28:02 +01:00
|
|
|
|
2007-06-17 08:18:38 +02:00
|
|
|
This environment variable controls whether all I/O is unbuffered. If
|
|
|
|
the first letter is @samp{y}, @samp{Y} or @samp{1}, all I/O is
|
2010-09-24 08:39:20 +02:00
|
|
|
unbuffered. This will slow down small sequential reads and writes. If
|
2007-06-17 08:18:38 +02:00
|
|
|
the first letter is @samp{n}, @samp{N} or @samp{0}, I/O is buffered.
|
|
|
|
This is the default.
|
2006-02-19 21:28:02 +01:00
|
|
|
|
2007-10-19 06:16:14 +02:00
|
|
|
@node GFORTRAN_UNBUFFERED_PRECONNECTED
|
2011-11-07 23:21:54 +01:00
|
|
|
@section @env{GFORTRAN_UNBUFFERED_PRECONNECTED}---Do not buffer I/O on preconnected units
|
2007-10-19 06:16:14 +02:00
|
|
|
|
|
|
|
The environment variable named @env{GFORTRAN_UNBUFFERED_PRECONNECTED} controls
|
2008-02-22 07:01:51 +01:00
|
|
|
whether I/O on a preconnected unit (i.e.@: STDOUT or STDERR) is unbuffered. If
|
2010-09-24 08:39:20 +02:00
|
|
|
the first letter is @samp{y}, @samp{Y} or @samp{1}, I/O is unbuffered. This
|
2007-10-19 06:16:14 +02:00
|
|
|
will slow down small sequential reads and writes. If the first letter
|
|
|
|
is @samp{n}, @samp{N} or @samp{0}, I/O is buffered. This is the default.
|
|
|
|
|
2006-02-19 21:28:02 +01:00
|
|
|
@node GFORTRAN_SHOW_LOCUS
|
|
|
|
@section @env{GFORTRAN_SHOW_LOCUS}---Show location for runtime errors
|
|
|
|
|
|
|
|
If the first letter is @samp{y}, @samp{Y} or @samp{1}, filename and
|
|
|
|
line numbers for runtime errors are printed. If the first letter is
|
2011-11-07 23:21:54 +01:00
|
|
|
@samp{n}, @samp{N} or @samp{0}, do not print filename and line numbers
|
2010-09-24 08:39:20 +02:00
|
|
|
for runtime errors. The default is to print the location.
|
2006-02-19 21:28:02 +01:00
|
|
|
|
|
|
|
@node GFORTRAN_OPTIONAL_PLUS
|
|
|
|
@section @env{GFORTRAN_OPTIONAL_PLUS}---Print leading + where permitted
|
|
|
|
|
|
|
|
If the first letter is @samp{y}, @samp{Y} or @samp{1},
|
|
|
|
a plus sign is printed
|
2006-04-08 16:31:12 +02:00
|
|
|
where permitted by the Fortran standard. If the first letter
|
2006-02-19 21:28:02 +01:00
|
|
|
is @samp{n}, @samp{N} or @samp{0}, a plus sign is not printed
|
2010-09-24 08:39:20 +02:00
|
|
|
in most cases. Default is not to print plus signs.
|
2006-02-19 21:28:02 +01:00
|
|
|
|
|
|
|
@node GFORTRAN_DEFAULT_RECL
|
|
|
|
@section @env{GFORTRAN_DEFAULT_RECL}---Default record length for new files
|
|
|
|
|
2007-01-04 02:02:40 +01:00
|
|
|
This environment variable specifies the default record length, in
|
|
|
|
bytes, for files which are opened without a @code{RECL} tag in the
|
|
|
|
@code{OPEN} statement. This must be a positive integer. The
|
|
|
|
default value is 1073741824 bytes (1 GB).
|
2006-02-19 21:28:02 +01:00
|
|
|
|
|
|
|
@node GFORTRAN_LIST_SEPARATOR
|
|
|
|
@section @env{GFORTRAN_LIST_SEPARATOR}---Separator for list output
|
|
|
|
|
|
|
|
This environment variable specifies the separator when writing
|
|
|
|
list-directed output. It may contain any number of spaces and
|
|
|
|
at most one comma. If you specify this on the command line,
|
|
|
|
be sure to quote spaces, as in
|
|
|
|
@smallexample
|
|
|
|
$ GFORTRAN_LIST_SEPARATOR=' , ' ./a.out
|
|
|
|
@end smallexample
|
2007-01-04 01:19:36 +01:00
|
|
|
when @command{a.out} is the compiled Fortran program that you want to run.
|
2006-02-19 21:28:02 +01:00
|
|
|
Default is a single space.
|
|
|
|
|
2006-02-06 21:12:44 +01:00
|
|
|
@node GFORTRAN_CONVERT_UNIT
|
2006-02-19 21:28:02 +01:00
|
|
|
@section @env{GFORTRAN_CONVERT_UNIT}---Set endianness for unformatted I/O
|
2006-02-06 21:12:44 +01:00
|
|
|
|
2006-02-19 21:28:02 +01:00
|
|
|
By setting the @env{GFORTRAN_CONVERT_UNIT} variable, it is possible
|
2006-02-06 21:12:44 +01:00
|
|
|
to change the representation of data for unformatted files.
|
2006-02-19 21:28:02 +01:00
|
|
|
The syntax for the @env{GFORTRAN_CONVERT_UNIT} variable is:
|
2006-02-06 21:12:44 +01:00
|
|
|
@smallexample
|
2007-05-17 10:40:46 +02:00
|
|
|
GFORTRAN_CONVERT_UNIT: mode | mode ';' exception | exception ;
|
2006-02-06 21:12:44 +01:00
|
|
|
mode: 'native' | 'swap' | 'big_endian' | 'little_endian' ;
|
|
|
|
exception: mode ':' unit_list | unit_list ;
|
|
|
|
unit_list: unit_spec | unit_list unit_spec ;
|
|
|
|
unit_spec: INTEGER | INTEGER '-' INTEGER ;
|
|
|
|
@end smallexample
|
|
|
|
The variable consists of an optional default mode, followed by
|
|
|
|
a list of optional exceptions, which are separated by semicolons
|
|
|
|
from the preceding default and each other. Each exception consists
|
|
|
|
of a format and a comma-separated list of units. Valid values for
|
|
|
|
the modes are the same as for the @code{CONVERT} specifier:
|
|
|
|
|
|
|
|
@itemize @w{}
|
|
|
|
@item @code{NATIVE} Use the native format. This is the default.
|
|
|
|
@item @code{SWAP} Swap between little- and big-endian.
|
|
|
|
@item @code{LITTLE_ENDIAN} Use the little-endian format
|
2008-06-15 11:42:13 +02:00
|
|
|
for unformatted files.
|
2006-02-06 21:12:44 +01:00
|
|
|
@item @code{BIG_ENDIAN} Use the big-endian format for unformatted files.
|
|
|
|
@end itemize
|
|
|
|
A missing mode for an exception is taken to mean @code{BIG_ENDIAN}.
|
2007-01-04 01:19:36 +01:00
|
|
|
Examples of values for @env{GFORTRAN_CONVERT_UNIT} are:
|
2006-02-06 21:12:44 +01:00
|
|
|
@itemize @w{}
|
|
|
|
@item @code{'big_endian'} Do all unformatted I/O in big_endian mode.
|
|
|
|
@item @code{'little_endian;native:10-20,25'} Do all unformatted I/O
|
|
|
|
in little_endian mode, except for units 10 to 20 and 25, which are in
|
|
|
|
native format.
|
|
|
|
@item @code{'10-20'} Units 10 to 20 are big-endian, the rest is native.
|
2004-05-13 08:41:07 +02:00
|
|
|
@end itemize
|
|
|
|
|
2006-02-06 21:12:44 +01:00
|
|
|
Setting the environment variables should be done on the command
|
2007-01-04 01:19:36 +01:00
|
|
|
line or via the @command{export}
|
|
|
|
command for @command{sh}-compatible shells and via @command{setenv}
|
|
|
|
for @command{csh}-compatible shells.
|
2006-02-06 21:12:44 +01:00
|
|
|
|
2007-01-04 01:19:36 +01:00
|
|
|
Example for @command{sh}:
|
2006-02-06 21:12:44 +01:00
|
|
|
@smallexample
|
|
|
|
$ gfortran foo.f90
|
|
|
|
$ GFORTRAN_CONVERT_UNIT='big_endian;native:10-20' ./a.out
|
|
|
|
@end smallexample
|
|
|
|
|
2007-01-04 01:19:36 +01:00
|
|
|
Example code for @command{csh}:
|
2006-02-06 21:12:44 +01:00
|
|
|
@smallexample
|
|
|
|
% gfortran foo.f90
|
|
|
|
% setenv GFORTRAN_CONVERT_UNIT 'big_endian;native:10-20'
|
|
|
|
% ./a.out
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
Using anything but the native representation for unformatted data
|
|
|
|
carries a significant speed overhead. If speed in this area matters
|
|
|
|
to you, it is best if you use this only for data that needs to be
|
|
|
|
portable.
|
|
|
|
|
|
|
|
@xref{CONVERT specifier}, for an alternative way to specify the
|
|
|
|
data representation for unformatted files. @xref{Runtime Options}, for
|
|
|
|
setting a default data representation for the whole program. The
|
2007-01-04 01:19:36 +01:00
|
|
|
@code{CONVERT} specifier overrides the @option{-fconvert} compile options.
|
2006-02-06 21:12:44 +01:00
|
|
|
|
2007-05-17 10:40:46 +02:00
|
|
|
@emph{Note that the values specified via the GFORTRAN_CONVERT_UNIT
|
|
|
|
environment variable will override the CONVERT specifier in the
|
|
|
|
open statement}. This is to give control over data formats to
|
|
|
|
users who do not have the source code of their program available.
|
|
|
|
|
2007-05-26 15:29:29 +02:00
|
|
|
@node GFORTRAN_ERROR_BACKTRACE
|
|
|
|
@section @env{GFORTRAN_ERROR_BACKTRACE}---Show backtrace on run-time errors
|
|
|
|
|
2011-05-14 10:44:09 +02:00
|
|
|
If the @env{GFORTRAN_ERROR_BACKTRACE} variable is set to @samp{y},
|
|
|
|
@samp{Y} or @samp{1} (only the first letter is relevant) then a
|
|
|
|
backtrace is printed when a serious run-time error occurs. To disable
|
|
|
|
the backtracing, set the variable to @samp{n}, @samp{N}, @samp{0}.
|
|
|
|
Default is to print a backtrace unless the @option{-fno-backtrace}
|
|
|
|
compile option was used.
|
2006-12-17 03:41:48 +01:00
|
|
|
|
|
|
|
@c =====================================================================
|
2007-01-04 03:11:05 +01:00
|
|
|
@c PART II: LANGUAGE REFERENCE
|
2006-12-17 03:41:48 +01:00
|
|
|
@c =====================================================================
|
|
|
|
|
|
|
|
@tex
|
2007-01-04 03:11:05 +01:00
|
|
|
\part{II}{Language Reference}
|
2006-12-17 03:41:48 +01:00
|
|
|
@end tex
|
|
|
|
|
|
|
|
@c ---------------------------------------------------------------------
|
re PR fortran/33197 (Fortran 2008: math functions)
PR fortran/33197
gcc/fortran/
* intrinsic.c (add_functions): Modify intrinsics ACOSH, ASINH,
ATANH, ERF, ERFC and GAMMA. Add intrinsics BESSEL_{J,Y}{0,1,N},
ERFC_SCALED, LOG_GAMMA and HYPOT.
* intrinsic.h (gfc_check_hypot, gfc_simplify_hypot,
gfc_resolve_hypot): New prototypes.
* mathbuiltins.def: Add HYPOT builtin. Make complex versions of
ACOSH, ASINH and ATANH available.
* gfortran.h (GFC_ISYM_ERFC_SCALED, GFC_ISYM_HYPOT): New values.
* lang.opt: Add -std=f2008 option.
* libgfortran.h: Define GFC_STD_F2008.
* lang-specs.h: Add .f08 and .F08 file suffixes.
* iresolve.c (gfc_resolve_hypot): New function.
* parse.c (parse_contained): Allow empty CONTAINS for Fortran 2008.
* check.c (gfc_check_hypot): New function.
* trans-intrinsic.c (gfc_intrinsic_map): Define ERFC_SCALE builtin.
* options.c (set_default_std_flags): Allow Fortran 2008 by default.
(form_from_filename): Add .f08 suffix.
(gfc_handle_option): Handle -std=f2008 option.
* simplify.c (gfc_simplify_hypot): New function.
* gfortran.texi: Document Fortran 2008 status and file extensions.
* intrinsic.texi: Document new BESSEL_{J,Y}{0,1,N} intrinsics,
as well as HYPOT and ERFC_SCALED. Update documentation of ERF,
ERFC, GAMMA, LGAMMA, ASINH, ACOSH and ATANH.
* invoke.texi: Document the new -std=f2008 option.
libgomp/
* testsuite/libgomp.fortran/fortran.exp: Add .f08 and
.F08 file suffixes.
gcc/testsuite/
* gfortran.dg/gomp/gomp.exp: Add .f08 and .F08 file suffixes.
* gfortran.dg/dg.exp: Likewise.
* gfortran.dg/vect/vect.exp: Likewise.
* gfortran.fortran-torture/execute/execute.exp: Likewise.
* gfortran.fortran-torture/compile/compile.exp: Likewise.
* gfortran.dg/gamma_1.f90: Also check log_gamma.
* gfortran.dg/invalid_contains_1.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_2.f90: Add a few error messages.
* gfortran.dg/invalid_contains_2.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_3.f90: Adjust error message.
* gfortran.dg/gamma_4.f90: Test for log_gamma instead of lgamma.
* gfortran.dg/bind_c_usage_9.f03: Adjust error messages.
* gfortran.dg/bessel_1.f90: New test.
* gfortran.dg/recursive_check_3.f90: Remove warnings.
* gfortran.dg/besxy.f90: Also check for new F2008 intrinsics.
* gfortran.dg/derived_function_interface_1.f90: Remove warning.
* gfortran.dg/contains_empty_1.f03: New test.
* gfortran.dg/erfc_scaled_1.f90: New test.
* gfortran.dg/hypot_1.f90: New test.
* gfortran.dg/contains_empty_2.f03: New test.
libgfortran/
* intrinsics/erfc_scaled_inc.c: New file.
* intrinsics/erfc_scaled.c: New file.
* gfortran.map (GFORTRAN_1.0): Add _gfortran_erfc_scaled_r*.
* Makefile.am: Add intrinsics/erfc_scaled.c.
* config.h.in: Regenerate.
* configure: Regenerate.
* Makefile.in: Regenerate.
From-SVN: r132846
2008-03-04 00:46:20 +01:00
|
|
|
@c Fortran 2003 and 2008 Status
|
2006-12-17 03:41:48 +01:00
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
|
re PR fortran/33197 (Fortran 2008: math functions)
PR fortran/33197
gcc/fortran/
* intrinsic.c (add_functions): Modify intrinsics ACOSH, ASINH,
ATANH, ERF, ERFC and GAMMA. Add intrinsics BESSEL_{J,Y}{0,1,N},
ERFC_SCALED, LOG_GAMMA and HYPOT.
* intrinsic.h (gfc_check_hypot, gfc_simplify_hypot,
gfc_resolve_hypot): New prototypes.
* mathbuiltins.def: Add HYPOT builtin. Make complex versions of
ACOSH, ASINH and ATANH available.
* gfortran.h (GFC_ISYM_ERFC_SCALED, GFC_ISYM_HYPOT): New values.
* lang.opt: Add -std=f2008 option.
* libgfortran.h: Define GFC_STD_F2008.
* lang-specs.h: Add .f08 and .F08 file suffixes.
* iresolve.c (gfc_resolve_hypot): New function.
* parse.c (parse_contained): Allow empty CONTAINS for Fortran 2008.
* check.c (gfc_check_hypot): New function.
* trans-intrinsic.c (gfc_intrinsic_map): Define ERFC_SCALE builtin.
* options.c (set_default_std_flags): Allow Fortran 2008 by default.
(form_from_filename): Add .f08 suffix.
(gfc_handle_option): Handle -std=f2008 option.
* simplify.c (gfc_simplify_hypot): New function.
* gfortran.texi: Document Fortran 2008 status and file extensions.
* intrinsic.texi: Document new BESSEL_{J,Y}{0,1,N} intrinsics,
as well as HYPOT and ERFC_SCALED. Update documentation of ERF,
ERFC, GAMMA, LGAMMA, ASINH, ACOSH and ATANH.
* invoke.texi: Document the new -std=f2008 option.
libgomp/
* testsuite/libgomp.fortran/fortran.exp: Add .f08 and
.F08 file suffixes.
gcc/testsuite/
* gfortran.dg/gomp/gomp.exp: Add .f08 and .F08 file suffixes.
* gfortran.dg/dg.exp: Likewise.
* gfortran.dg/vect/vect.exp: Likewise.
* gfortran.fortran-torture/execute/execute.exp: Likewise.
* gfortran.fortran-torture/compile/compile.exp: Likewise.
* gfortran.dg/gamma_1.f90: Also check log_gamma.
* gfortran.dg/invalid_contains_1.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_2.f90: Add a few error messages.
* gfortran.dg/invalid_contains_2.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_3.f90: Adjust error message.
* gfortran.dg/gamma_4.f90: Test for log_gamma instead of lgamma.
* gfortran.dg/bind_c_usage_9.f03: Adjust error messages.
* gfortran.dg/bessel_1.f90: New test.
* gfortran.dg/recursive_check_3.f90: Remove warnings.
* gfortran.dg/besxy.f90: Also check for new F2008 intrinsics.
* gfortran.dg/derived_function_interface_1.f90: Remove warning.
* gfortran.dg/contains_empty_1.f03: New test.
* gfortran.dg/erfc_scaled_1.f90: New test.
* gfortran.dg/hypot_1.f90: New test.
* gfortran.dg/contains_empty_2.f03: New test.
libgfortran/
* intrinsics/erfc_scaled_inc.c: New file.
* intrinsics/erfc_scaled.c: New file.
* gfortran.map (GFORTRAN_1.0): Add _gfortran_erfc_scaled_r*.
* Makefile.am: Add intrinsics/erfc_scaled.c.
* config.h.in: Regenerate.
* configure: Regenerate.
* Makefile.in: Regenerate.
From-SVN: r132846
2008-03-04 00:46:20 +01:00
|
|
|
@node Fortran 2003 and 2008 status
|
|
|
|
@chapter Fortran 2003 and 2008 Status
|
|
|
|
|
|
|
|
@menu
|
|
|
|
* Fortran 2003 status::
|
|
|
|
* Fortran 2008 status::
|
2011-10-15 10:34:36 +02:00
|
|
|
* TS 29113 status::
|
2015-12-14 20:31:51 +01:00
|
|
|
* TS 18508 status::
|
re PR fortran/33197 (Fortran 2008: math functions)
PR fortran/33197
gcc/fortran/
* intrinsic.c (add_functions): Modify intrinsics ACOSH, ASINH,
ATANH, ERF, ERFC and GAMMA. Add intrinsics BESSEL_{J,Y}{0,1,N},
ERFC_SCALED, LOG_GAMMA and HYPOT.
* intrinsic.h (gfc_check_hypot, gfc_simplify_hypot,
gfc_resolve_hypot): New prototypes.
* mathbuiltins.def: Add HYPOT builtin. Make complex versions of
ACOSH, ASINH and ATANH available.
* gfortran.h (GFC_ISYM_ERFC_SCALED, GFC_ISYM_HYPOT): New values.
* lang.opt: Add -std=f2008 option.
* libgfortran.h: Define GFC_STD_F2008.
* lang-specs.h: Add .f08 and .F08 file suffixes.
* iresolve.c (gfc_resolve_hypot): New function.
* parse.c (parse_contained): Allow empty CONTAINS for Fortran 2008.
* check.c (gfc_check_hypot): New function.
* trans-intrinsic.c (gfc_intrinsic_map): Define ERFC_SCALE builtin.
* options.c (set_default_std_flags): Allow Fortran 2008 by default.
(form_from_filename): Add .f08 suffix.
(gfc_handle_option): Handle -std=f2008 option.
* simplify.c (gfc_simplify_hypot): New function.
* gfortran.texi: Document Fortran 2008 status and file extensions.
* intrinsic.texi: Document new BESSEL_{J,Y}{0,1,N} intrinsics,
as well as HYPOT and ERFC_SCALED. Update documentation of ERF,
ERFC, GAMMA, LGAMMA, ASINH, ACOSH and ATANH.
* invoke.texi: Document the new -std=f2008 option.
libgomp/
* testsuite/libgomp.fortran/fortran.exp: Add .f08 and
.F08 file suffixes.
gcc/testsuite/
* gfortran.dg/gomp/gomp.exp: Add .f08 and .F08 file suffixes.
* gfortran.dg/dg.exp: Likewise.
* gfortran.dg/vect/vect.exp: Likewise.
* gfortran.fortran-torture/execute/execute.exp: Likewise.
* gfortran.fortran-torture/compile/compile.exp: Likewise.
* gfortran.dg/gamma_1.f90: Also check log_gamma.
* gfortran.dg/invalid_contains_1.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_2.f90: Add a few error messages.
* gfortran.dg/invalid_contains_2.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_3.f90: Adjust error message.
* gfortran.dg/gamma_4.f90: Test for log_gamma instead of lgamma.
* gfortran.dg/bind_c_usage_9.f03: Adjust error messages.
* gfortran.dg/bessel_1.f90: New test.
* gfortran.dg/recursive_check_3.f90: Remove warnings.
* gfortran.dg/besxy.f90: Also check for new F2008 intrinsics.
* gfortran.dg/derived_function_interface_1.f90: Remove warning.
* gfortran.dg/contains_empty_1.f03: New test.
* gfortran.dg/erfc_scaled_1.f90: New test.
* gfortran.dg/hypot_1.f90: New test.
* gfortran.dg/contains_empty_2.f03: New test.
libgfortran/
* intrinsics/erfc_scaled_inc.c: New file.
* intrinsics/erfc_scaled.c: New file.
* gfortran.map (GFORTRAN_1.0): Add _gfortran_erfc_scaled_r*.
* Makefile.am: Add intrinsics/erfc_scaled.c.
* config.h.in: Regenerate.
* configure: Regenerate.
* Makefile.in: Regenerate.
From-SVN: r132846
2008-03-04 00:46:20 +01:00
|
|
|
@end menu
|
|
|
|
|
2006-12-17 03:41:48 +01:00
|
|
|
@node Fortran 2003 status
|
re PR fortran/33197 (Fortran 2008: math functions)
PR fortran/33197
gcc/fortran/
* intrinsic.c (add_functions): Modify intrinsics ACOSH, ASINH,
ATANH, ERF, ERFC and GAMMA. Add intrinsics BESSEL_{J,Y}{0,1,N},
ERFC_SCALED, LOG_GAMMA and HYPOT.
* intrinsic.h (gfc_check_hypot, gfc_simplify_hypot,
gfc_resolve_hypot): New prototypes.
* mathbuiltins.def: Add HYPOT builtin. Make complex versions of
ACOSH, ASINH and ATANH available.
* gfortran.h (GFC_ISYM_ERFC_SCALED, GFC_ISYM_HYPOT): New values.
* lang.opt: Add -std=f2008 option.
* libgfortran.h: Define GFC_STD_F2008.
* lang-specs.h: Add .f08 and .F08 file suffixes.
* iresolve.c (gfc_resolve_hypot): New function.
* parse.c (parse_contained): Allow empty CONTAINS for Fortran 2008.
* check.c (gfc_check_hypot): New function.
* trans-intrinsic.c (gfc_intrinsic_map): Define ERFC_SCALE builtin.
* options.c (set_default_std_flags): Allow Fortran 2008 by default.
(form_from_filename): Add .f08 suffix.
(gfc_handle_option): Handle -std=f2008 option.
* simplify.c (gfc_simplify_hypot): New function.
* gfortran.texi: Document Fortran 2008 status and file extensions.
* intrinsic.texi: Document new BESSEL_{J,Y}{0,1,N} intrinsics,
as well as HYPOT and ERFC_SCALED. Update documentation of ERF,
ERFC, GAMMA, LGAMMA, ASINH, ACOSH and ATANH.
* invoke.texi: Document the new -std=f2008 option.
libgomp/
* testsuite/libgomp.fortran/fortran.exp: Add .f08 and
.F08 file suffixes.
gcc/testsuite/
* gfortran.dg/gomp/gomp.exp: Add .f08 and .F08 file suffixes.
* gfortran.dg/dg.exp: Likewise.
* gfortran.dg/vect/vect.exp: Likewise.
* gfortran.fortran-torture/execute/execute.exp: Likewise.
* gfortran.fortran-torture/compile/compile.exp: Likewise.
* gfortran.dg/gamma_1.f90: Also check log_gamma.
* gfortran.dg/invalid_contains_1.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_2.f90: Add a few error messages.
* gfortran.dg/invalid_contains_2.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_3.f90: Adjust error message.
* gfortran.dg/gamma_4.f90: Test for log_gamma instead of lgamma.
* gfortran.dg/bind_c_usage_9.f03: Adjust error messages.
* gfortran.dg/bessel_1.f90: New test.
* gfortran.dg/recursive_check_3.f90: Remove warnings.
* gfortran.dg/besxy.f90: Also check for new F2008 intrinsics.
* gfortran.dg/derived_function_interface_1.f90: Remove warning.
* gfortran.dg/contains_empty_1.f03: New test.
* gfortran.dg/erfc_scaled_1.f90: New test.
* gfortran.dg/hypot_1.f90: New test.
* gfortran.dg/contains_empty_2.f03: New test.
libgfortran/
* intrinsics/erfc_scaled_inc.c: New file.
* intrinsics/erfc_scaled.c: New file.
* gfortran.map (GFORTRAN_1.0): Add _gfortran_erfc_scaled_r*.
* Makefile.am: Add intrinsics/erfc_scaled.c.
* config.h.in: Regenerate.
* configure: Regenerate.
* Makefile.in: Regenerate.
From-SVN: r132846
2008-03-04 00:46:20 +01:00
|
|
|
@section Fortran 2003 status
|
2006-12-17 03:41:48 +01:00
|
|
|
|
2009-06-03 22:32:23 +02:00
|
|
|
GNU Fortran supports several Fortran 2003 features; an incomplete
|
2009-08-30 10:26:38 +02:00
|
|
|
list can be found below. See also the
|
2014-05-23 22:32:04 +02:00
|
|
|
@uref{https://gcc.gnu.org/wiki/Fortran2003, wiki page} about Fortran 2003.
|
2006-12-17 03:41:48 +01:00
|
|
|
|
|
|
|
@itemize
|
2011-01-16 18:14:48 +01:00
|
|
|
@item Procedure pointers including procedure-pointer components with
|
|
|
|
@code{PASS} attribute.
|
2006-12-17 03:41:48 +01:00
|
|
|
|
2011-01-16 18:14:48 +01:00
|
|
|
@item Procedures which are bound to a derived type (type-bound procedures)
|
|
|
|
including @code{PASS}, @code{PROCEDURE} and @code{GENERIC}, and
|
|
|
|
operators bound to a type.
|
|
|
|
|
2011-04-10 20:46:45 +02:00
|
|
|
@item Abstract interfaces and type extension with the possibility to
|
2011-01-16 18:14:48 +01:00
|
|
|
override type-bound procedures or to have deferred binding.
|
|
|
|
|
2014-03-08 12:06:48 +01:00
|
|
|
@item Polymorphic entities (``@code{CLASS}'') for derived types and unlimited
|
|
|
|
polymorphism (``@code{CLASS(*)}'') -- including @code{SAME_TYPE_AS},
|
|
|
|
@code{EXTENDS_TYPE_OF} and @code{SELECT TYPE} for scalars and arrays and
|
|
|
|
finalization.
|
2012-01-09 17:22:51 +01:00
|
|
|
|
2012-01-10 12:38:46 +01:00
|
|
|
@item Generic interface names, which have the same name as derived types,
|
2012-01-09 17:22:51 +01:00
|
|
|
are now supported. This allows one to write constructor functions. Note
|
|
|
|
that Fortran does not support static constructor functions. For static
|
|
|
|
variables, only default initialization or structure-constructor
|
|
|
|
initialization are available.
|
2011-01-16 18:14:48 +01:00
|
|
|
|
|
|
|
@item The @code{ASSOCIATE} construct.
|
|
|
|
|
|
|
|
@item Interoperability with C including enumerations,
|
|
|
|
|
|
|
|
@item In structure constructors the components with default values may be
|
|
|
|
omitted.
|
|
|
|
|
|
|
|
@item Extensions to the @code{ALLOCATE} statement, allowing for a
|
|
|
|
type-specification with type parameter and for allocation and initialization
|
|
|
|
from a @code{SOURCE=} expression; @code{ALLOCATE} and @code{DEALLOCATE}
|
|
|
|
optionally return an error message string via @code{ERRMSG=}.
|
|
|
|
|
2011-01-28 14:53:19 +01:00
|
|
|
@item Reallocation on assignment: If an intrinsic assignment is
|
2011-01-16 18:14:48 +01:00
|
|
|
used, an allocatable variable on the left-hand side is automatically allocated
|
2011-01-28 14:53:19 +01:00
|
|
|
(if unallocated) or reallocated (if the shape is different). Currently, scalar
|
|
|
|
deferred character length left-hand sides are correctly handled but arrays
|
|
|
|
are not yet fully implemented.
|
2011-01-16 18:14:48 +01:00
|
|
|
|
2014-03-08 12:06:48 +01:00
|
|
|
@item Deferred-length character variables and scalar deferred-length character
|
|
|
|
components of derived types are supported. (Note that array-valued compoents
|
|
|
|
are not yet implemented.)
|
|
|
|
|
2011-01-16 18:14:48 +01:00
|
|
|
@item Transferring of allocations via @code{MOVE_ALLOC}.
|
|
|
|
|
|
|
|
@item The @code{PRIVATE} and @code{PUBLIC} attributes may be given individually
|
|
|
|
to derived-type components.
|
|
|
|
|
|
|
|
@item In pointer assignments, the lower bound may be specified and
|
|
|
|
the remapping of elements is supported.
|
|
|
|
|
|
|
|
@item For pointers an @code{INTENT} may be specified which affect the
|
|
|
|
association status not the value of the pointer target.
|
|
|
|
|
|
|
|
@item Intrinsics @code{command_argument_count}, @code{get_command},
|
|
|
|
@code{get_command_argument}, and @code{get_environment_variable}.
|
|
|
|
|
2012-02-17 12:15:08 +01:00
|
|
|
@item Support for Unicode characters (ISO 10646) and UTF-8, including
|
2011-01-16 18:14:48 +01:00
|
|
|
the @code{SELECTED_CHAR_KIND} and @code{NEW_LINE} intrinsic functions.
|
|
|
|
|
|
|
|
@item Support for binary, octal and hexadecimal (BOZ) constants in the
|
|
|
|
intrinsic functions @code{INT}, @code{REAL}, @code{CMPLX} and @code{DBLE}.
|
|
|
|
|
2011-01-28 20:47:16 +01:00
|
|
|
@item Support for namelist variables with allocatable and pointer
|
|
|
|
attribute and nonconstant length type parameter.
|
|
|
|
|
2011-01-16 18:14:48 +01:00
|
|
|
@item
|
2007-04-29 12:49:08 +02:00
|
|
|
@cindex array, constructors
|
2006-12-17 03:41:48 +01:00
|
|
|
@cindex @code{[...]}
|
2010-09-24 08:39:20 +02:00
|
|
|
Array constructors using square brackets. That is, @code{[...]} rather
|
2009-08-30 10:26:38 +02:00
|
|
|
than @code{(/.../)}. Type-specification for array constructors like
|
|
|
|
@code{(/ some-type :: ... /)}.
|
2006-12-17 03:41:48 +01:00
|
|
|
|
2011-01-16 18:14:48 +01:00
|
|
|
@item Extensions to the specification and initialization expressions,
|
|
|
|
including the support for intrinsics with real and complex arguments.
|
|
|
|
|
|
|
|
@item Support for the asynchronous input/output syntax; however, the
|
|
|
|
data transfer is currently always synchronously performed.
|
|
|
|
|
2006-12-17 03:41:48 +01:00
|
|
|
@item
|
|
|
|
@cindex @code{FLUSH} statement
|
2007-04-29 12:49:08 +02:00
|
|
|
@cindex statement, @code{FLUSH}
|
2006-12-17 03:41:48 +01:00
|
|
|
@code{FLUSH} statement.
|
|
|
|
|
|
|
|
@item
|
|
|
|
@cindex @code{IOMSG=} specifier
|
|
|
|
@code{IOMSG=} specifier for I/O statements.
|
|
|
|
|
|
|
|
@item
|
|
|
|
@cindex @code{ENUM} statement
|
|
|
|
@cindex @code{ENUMERATOR} statement
|
2007-04-29 12:49:08 +02:00
|
|
|
@cindex statement, @code{ENUM}
|
|
|
|
@cindex statement, @code{ENUMERATOR}
|
2007-04-27 18:52:10 +02:00
|
|
|
@opindex @code{fshort-enums}
|
2006-12-17 03:41:48 +01:00
|
|
|
Support for the declaration of enumeration constants via the
|
|
|
|
@code{ENUM} and @code{ENUMERATOR} statements. Interoperability with
|
|
|
|
@command{gcc} is guaranteed also for the case where the
|
|
|
|
@command{-fshort-enums} command line option is given.
|
|
|
|
|
|
|
|
@item
|
|
|
|
@cindex TR 15581
|
|
|
|
TR 15581:
|
|
|
|
@itemize
|
|
|
|
@item
|
|
|
|
@cindex @code{ALLOCATABLE} dummy arguments
|
|
|
|
@code{ALLOCATABLE} dummy arguments.
|
|
|
|
@item
|
|
|
|
@cindex @code{ALLOCATABLE} function results
|
|
|
|
@code{ALLOCATABLE} function results
|
|
|
|
@item
|
|
|
|
@cindex @code{ALLOCATABLE} components of derived types
|
|
|
|
@code{ALLOCATABLE} components of derived types
|
|
|
|
@end itemize
|
|
|
|
|
|
|
|
@item
|
|
|
|
@cindex @code{STREAM} I/O
|
|
|
|
@cindex @code{ACCESS='STREAM'} I/O
|
|
|
|
The @code{OPEN} statement supports the @code{ACCESS='STREAM'} specifier,
|
|
|
|
allowing I/O without any record structure.
|
|
|
|
|
|
|
|
@item
|
|
|
|
Namelist input/output for internal files.
|
|
|
|
|
2014-03-08 12:06:48 +01:00
|
|
|
@item Minor I/O features: Rounding during formatted output, using of
|
2011-01-16 18:14:48 +01:00
|
|
|
a decimal comma instead of a decimal point, setting whether a plus sign
|
2014-07-07 00:17:21 +02:00
|
|
|
should appear for positive numbers. On systems where @code{strtod} honours
|
2014-03-08 12:06:48 +01:00
|
|
|
the rounding mode, the rounding mode is also supported for input.
|
2011-01-16 18:14:48 +01:00
|
|
|
|
2006-12-17 03:41:48 +01:00
|
|
|
@item
|
2007-04-29 12:49:08 +02:00
|
|
|
@cindex @code{PROTECTED} statement
|
|
|
|
@cindex statement, @code{PROTECTED}
|
2006-12-17 03:41:48 +01:00
|
|
|
The @code{PROTECTED} statement and attribute.
|
|
|
|
|
|
|
|
@item
|
2007-04-29 12:49:08 +02:00
|
|
|
@cindex @code{VALUE} statement
|
|
|
|
@cindex statement, @code{VALUE}
|
2006-12-17 03:41:48 +01:00
|
|
|
The @code{VALUE} statement and attribute.
|
|
|
|
|
|
|
|
@item
|
2007-04-29 12:49:08 +02:00
|
|
|
@cindex @code{VOLATILE} statement
|
|
|
|
@cindex statement, @code{VOLATILE}
|
2006-12-17 03:41:48 +01:00
|
|
|
The @code{VOLATILE} statement and attribute.
|
|
|
|
|
|
|
|
@item
|
2007-04-29 12:49:08 +02:00
|
|
|
@cindex @code{IMPORT} statement
|
|
|
|
@cindex statement, @code{IMPORT}
|
2006-12-17 03:41:48 +01:00
|
|
|
The @code{IMPORT} statement, allowing to import
|
|
|
|
host-associated derived types.
|
|
|
|
|
2011-01-16 18:14:48 +01:00
|
|
|
@item The intrinsic modules @code{ISO_FORTRAN_ENVIRONMENT} is supported,
|
|
|
|
which contains parameters of the I/O units, storage sizes. Additionally,
|
|
|
|
procedures for C interoperability are available in the @code{ISO_C_BINDING}
|
|
|
|
module.
|
|
|
|
|
2006-12-17 03:41:48 +01:00
|
|
|
@item
|
2007-04-29 12:49:08 +02:00
|
|
|
@cindex @code{USE, INTRINSIC} statement
|
|
|
|
@cindex statement, @code{USE, INTRINSIC}
|
|
|
|
@cindex @code{ISO_FORTRAN_ENV} statement
|
|
|
|
@cindex statement, @code{ISO_FORTRAN_ENV}
|
2006-12-17 03:41:48 +01:00
|
|
|
@code{USE} statement with @code{INTRINSIC} and @code{NON_INTRINSIC}
|
|
|
|
attribute; supported intrinsic modules: @code{ISO_FORTRAN_ENV},
|
Merge current set of OpenACC changes from gomp-4_0-branch.
contrib/
* gcc_update (files_and_dependencies): Update rules for new
libgomp/plugin/Makefrag.am and libgomp/plugin/configfrag.ac files.
gcc/
* builtin-types.def (BT_FN_VOID_INT_INT_VAR)
(BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR)
(BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR):
New function types.
* builtins.c: Include "gomp-constants.h".
(expand_builtin_acc_on_device): New function.
(expand_builtin, is_inexpensive_builtin): Handle
BUILT_IN_ACC_ON_DEVICE.
* builtins.def (DEF_GOACC_BUILTIN, DEF_GOACC_BUILTIN_COMPILER):
New macros.
* cgraph.c (cgraph_node::create): Consider flag_openacc next to
flag_openmp.
* config.gcc <nvptx-*> (tm_file): Add nvptx/offload.h.
<*-intelmic-* | *-intelmicemul-*> (tm_file): Add
i386/intelmic-offload.h.
* gcc.c (LINK_COMMAND_SPEC, GOMP_SELF_SPECS): For -fopenacc, link
to libgomp and its dependencies.
* config/arc/arc.h (LINK_COMMAND_SPEC): Likewise.
* config/darwin.h (LINK_COMMAND_SPEC_A): Likewise.
* config/i386/mingw32.h (GOMP_SELF_SPECS): Likewise.
* config/ia64/hpux.h (LIB_SPEC): Likewise.
* config/pa/pa-hpux11.h (LIB_SPEC): Likewise.
* config/pa/pa64-hpux.h (LIB_SPEC): Likewise.
* doc/generic.texi: Update for OpenACC changes.
* doc/gimple.texi: Likewise.
* doc/invoke.texi: Likewise.
* doc/sourcebuild.texi: Likewise.
* gimple-pretty-print.c (dump_gimple_omp_for): Handle
GF_OMP_FOR_KIND_OACC_LOOP.
(dump_gimple_omp_target): Handle GF_OMP_TARGET_KIND_OACC_KERNELS,
GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_DATA,
GF_OMP_TARGET_KIND_OACC_UPDATE,
GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA.
Dump more data.
* gimple.c: Update comments for OpenACC changes.
* gimple.def: Likewise.
* gimple.h: Likewise.
(enum gf_mask): Add GF_OMP_FOR_KIND_OACC_LOOP,
GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS,
GF_OMP_TARGET_KIND_OACC_DATA, GF_OMP_TARGET_KIND_OACC_UPDATE,
GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA.
(gimple_omp_for_cond, gimple_omp_for_set_cond): Sort in the
appropriate place.
(is_gimple_omp_oacc, is_gimple_omp_offloaded): New functions.
* gimplify.c: Include "gomp-constants.h".
Update comments for OpenACC changes.
(is_gimple_stmt): Handle OACC_PARALLEL, OACC_KERNELS, OACC_DATA,
OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE, OACC_ENTER_DATA,
OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP.
(gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle
OMP_CLAUSE__CACHE_, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT,
OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS,
OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER,
OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT,
OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_AUTO,
OMP_CLAUSE_SEQ.
(gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Use
GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use
OMP_CLAUSE_SET_MAP_KIND.
(gimplify_oacc_cache): New function.
(gimplify_omp_for): Handle OACC_LOOP.
(gimplify_omp_workshare): Handle OACC_KERNELS, OACC_PARALLEL,
OACC_DATA.
(gimplify_omp_target_update): Handle OACC_ENTER_DATA,
OACC_EXIT_DATA, OACC_UPDATE.
(gimplify_expr): Handle OACC_LOOP, OACC_CACHE, OACC_HOST_DATA,
OACC_DECLARE, OACC_KERNELS, OACC_PARALLEL, OACC_DATA,
OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE.
(gimplify_body): Consider flag_openacc next to flag_openmp.
* lto-streamer-out.c: Include "gomp-constants.h".
* omp-builtins.def (BUILT_IN_ACC_GET_DEVICE_TYPE)
(BUILT_IN_GOACC_DATA_START, BUILT_IN_GOACC_DATA_END)
(BUILT_IN_GOACC_ENTER_EXIT_DATA, BUILT_IN_GOACC_PARALLEL)
(BUILT_IN_GOACC_UPDATE, BUILT_IN_GOACC_WAIT)
(BUILT_IN_GOACC_GET_THREAD_NUM, BUILT_IN_GOACC_GET_NUM_THREADS)
(BUILT_IN_ACC_ON_DEVICE): New builtins.
* omp-low.c: Include "gomp-constants.h".
Update comments for OpenACC changes.
(struct omp_context): Add reduction_map, gwv_below, gwv_this
members.
(extract_omp_for_data, use_pointer_for_field, install_var_field)
(new_omp_context, delete_omp_context, scan_sharing_clauses)
(create_omp_child_function, scan_omp_for, scan_omp_target)
(check_omp_nesting_restrictions, lower_reduction_clauses)
(build_omp_regions_1, diagnose_sb_0, make_gimple_omp_edges):
Update for OpenACC changes.
(scan_sharing_clauses): Handle OMP_CLAUSE_NUM_GANGS:
OMP_CLAUSE_NUM_WORKERS: OMP_CLAUSE_VECTOR_LENGTH,
OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_GANG,
OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT,
OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_INDEPENDENT,
OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ. Use GOMP_MAP_* instead of
OMP_CLAUSE_MAP_*.
(expand_omp_for_static_nochunk, expand_omp_for_static_chunk):
Handle GF_OMP_FOR_KIND_OACC_LOOP.
(expand_omp_target, lower_omp_target): Handle
GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS,
GF_OMP_TARGET_KIND_OACC_UPDATE,
GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA,
GF_OMP_TARGET_KIND_OACC_DATA.
(pass_expand_omp::execute, execute_lower_omp)
(pass_diagnose_omp_blocks::gate): Consider flag_openacc next to
flag_openmp.
(offload_symbol_decl): New variable.
(oacc_get_reduction_array_id, oacc_max_threads)
(get_offload_symbol_decl, get_base_type, lookup_oacc_reduction)
(maybe_lookup_oacc_reduction, enclosing_target_ctx)
(oacc_loop_or_target_p, oacc_lower_reduction_var_helper)
(oacc_gimple_assign, oacc_initialize_reduction_data)
(oacc_finalize_reduction_data, oacc_process_reduction_data): New
functions.
(is_targetreg_ctx): Remove function.
* tree-core.h (enum omp_clause_code): Add OMP_CLAUSE__CACHE_,
OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE,
OMP_CLAUSE_GANG, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT,
OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT,
OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_NUM_GANGS,
OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH.
* tree.c (omp_clause_code_name, walk_tree_1): Update accordingly.
* tree.h (OMP_CLAUSE_GANG_EXPR, OMP_CLAUSE_GANG_STATIC_EXPR)
(OMP_CLAUSE_ASYNC_EXPR, OMP_CLAUSE_WAIT_EXPR)
(OMP_CLAUSE_VECTOR_EXPR, OMP_CLAUSE_WORKER_EXPR)
(OMP_CLAUSE_NUM_GANGS_EXPR, OMP_CLAUSE_NUM_WORKERS_EXPR)
(OMP_CLAUSE_VECTOR_LENGTH_EXPR): New macros.
* tree-core.h: Update comments for OpenACC changes.
(enum omp_clause_map_kind): Remove.
(struct tree_omp_clause): Change type of map_kind member from enum
omp_clause_map_kind to unsigned char.
* tree-inline.c: Update comments for OpenACC changes.
* tree-nested.c: Likewise. Include "gomp-constants.h".
(convert_nonlocal_reference_stmt, convert_local_reference_stmt)
(convert_tramp_reference_stmt, convert_gimple_call): Update for
OpenACC changes. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use
OMP_CLAUSE_SET_MAP_KIND.
* tree-pretty-print.c: Include "gomp-constants.h".
(dump_omp_clause): Handle OMP_CLAUSE_DEVICE_RESIDENT,
OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_GANG,
OMP_CLAUSE_ASYNC, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ,
OMP_CLAUSE_WAIT, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR,
OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS,
OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_INDEPENDENT. Use GOMP_MAP_*
instead of OMP_CLAUSE_MAP_*.
(dump_generic_node): Handle OACC_PARALLEL, OACC_KERNELS,
OACC_DATA, OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE,
OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP.
* tree-streamer-in.c: Include "gomp-constants.h".
(unpack_ts_omp_clause_value_fields) Use GOMP_MAP_* instead of
OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND.
* tree-streamer-out.c: Include "gomp-constants.h".
(pack_ts_omp_clause_value_fields): Use GOMP_MAP_* instead of
OMP_CLAUSE_MAP_*.
* tree.def (OACC_PARALLEL, OACC_KERNELS, OACC_DATA)
(OACC_HOST_DATA, OACC_LOOP, OACC_CACHE, OACC_DECLARE)
(OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE): New tree codes.
* tree.c (omp_clause_num_ops): Update accordingly.
* tree.h (OMP_BODY, OMP_CLAUSES, OMP_LOOP_CHECK, OMP_CLAUSE_SIZE):
Likewise.
(OACC_PARALLEL_BODY, OACC_PARALLEL_CLAUSES, OACC_KERNELS_BODY)
(OACC_KERNELS_CLAUSES, OACC_DATA_BODY, OACC_DATA_CLAUSES)
(OACC_HOST_DATA_BODY, OACC_HOST_DATA_CLAUSES, OACC_CACHE_CLAUSES)
(OACC_DECLARE_CLAUSES, OACC_ENTER_DATA_CLAUSES)
(OACC_EXIT_DATA_CLAUSES, OACC_UPDATE_CLAUSES)
(OACC_KERNELS_COMBINED, OACC_PARALLEL_COMBINED): New macros.
* tree.h (OMP_CLAUSE_MAP_KIND): Cast it to enum gomp_map_kind.
(OMP_CLAUSE_SET_MAP_KIND): New macro.
* varpool.c (varpool_node::get_create): Consider flag_openacc next
to flag_openmp.
* config/i386/intelmic-offload.h: New file.
* config/nvptx/offload.h: Likewise.
gcc/ada/
* gcc-interface/utils.c (DEF_FUNCTION_TYPE_VAR_8)
(DEF_FUNCTION_TYPE_VAR_12): New macros.
gcc/c-family/
* c.opt (fopenacc): New option.
* c-cppbuiltin.c (c_cpp_builtins): Conditionally define _OPENACC.
* c-common.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12):
New macros.
* c-common.h (c_finish_oacc_wait): New prototype.
* c-omp.c: Include "omp-low.h" and "gomp-constants.h".
(c_finish_oacc_wait): New function.
* c-pragma.c (oacc_pragmas): New variable.
(c_pp_lookup_pragma, init_pragma): Handle it.
* c-pragma.h (enum pragma_kind): Add PRAGMA_OACC_CACHE,
PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA,
PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP, PRAGMA_OACC_PARALLEL,
PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT.
(enum pragma_omp_clause): Add PRAGMA_OACC_CLAUSE_ASYNC,
PRAGMA_OACC_CLAUSE_AUTO, PRAGMA_OACC_CLAUSE_COLLAPSE,
PRAGMA_OACC_CLAUSE_COPY, PRAGMA_OACC_CLAUSE_COPYIN,
PRAGMA_OACC_CLAUSE_COPYOUT, PRAGMA_OACC_CLAUSE_CREATE,
PRAGMA_OACC_CLAUSE_DELETE, PRAGMA_OACC_CLAUSE_DEVICE,
PRAGMA_OACC_CLAUSE_DEVICEPTR, PRAGMA_OACC_CLAUSE_FIRSTPRIVATE,
PRAGMA_OACC_CLAUSE_GANG, PRAGMA_OACC_CLAUSE_HOST,
PRAGMA_OACC_CLAUSE_IF, PRAGMA_OACC_CLAUSE_NUM_GANGS,
PRAGMA_OACC_CLAUSE_NUM_WORKERS, PRAGMA_OACC_CLAUSE_PRESENT,
PRAGMA_OACC_CLAUSE_PRESENT_OR_COPY,
PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYIN,
PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYOUT,
PRAGMA_OACC_CLAUSE_PRESENT_OR_CREATE, PRAGMA_OACC_CLAUSE_PRIVATE,
PRAGMA_OACC_CLAUSE_REDUCTION, PRAGMA_OACC_CLAUSE_SELF,
PRAGMA_OACC_CLAUSE_SEQ, PRAGMA_OACC_CLAUSE_VECTOR,
PRAGMA_OACC_CLAUSE_VECTOR_LENGTH, PRAGMA_OACC_CLAUSE_WAIT,
PRAGMA_OACC_CLAUSE_WORKER.
gcc/c/
* c-parser.c: Include "gomp-constants.h".
(c_parser_omp_clause_map): Use enum gomp_map_kind instead of enum
omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*.
Use OMP_CLAUSE_SET_MAP_KIND.
(c_parser_pragma): Handle PRAGMA_OACC_ENTER_DATA,
PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_UPDATE.
(c_parser_omp_construct): Handle PRAGMA_OACC_CACHE,
PRAGMA_OACC_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP,
PRAGMA_OACC_PARALLEL, PRAGMA_OACC_WAIT.
(c_parser_omp_clause_name): Handle "auto", "async", "copy",
"copyout", "create", "delete", "deviceptr", "gang", "host",
"num_gangs", "num_workers", "present", "present_or_copy", "pcopy",
"present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout",
"present_or_create", "pcreate", "seq", "self", "vector",
"vector_length", "wait", "worker".
(OACC_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK)
(OACC_ENTER_DATA_CLAUSE_MASK, OACC_EXIT_DATA_CLAUSE_MASK)
(OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK)
(OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros.
(c_parser_omp_variable_list): Handle OMP_CLAUSE__CACHE_.
(c_parser_oacc_wait_list, c_parser_oacc_data_clause)
(c_parser_oacc_data_clause_deviceptr)
(c_parser_omp_clause_num_gangs, c_parser_omp_clause_num_workers)
(c_parser_oacc_clause_async, c_parser_oacc_clause_wait)
(c_parser_omp_clause_vector_length, c_parser_oacc_all_clauses)
(c_parser_oacc_cache, c_parser_oacc_data, c_parser_oacc_kernels)
(c_parser_oacc_enter_exit_data, c_parser_oacc_loop)
(c_parser_oacc_parallel, c_parser_oacc_update)
(c_parser_oacc_wait): New functions.
* c-tree.h (c_finish_oacc_parallel, c_finish_oacc_kernels)
(c_finish_oacc_data): New prototypes.
* c-typeck.c: Include "gomp-constants.h".
(handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use
GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use
OMP_CLAUSE_SET_MAP_KIND.
(c_finish_oacc_parallel, c_finish_oacc_kernels)
(c_finish_oacc_data): New functions.
(c_finish_omp_clauses): Handle OMP_CLAUSE__CACHE_,
OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS,
OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT,
OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_GANG,
OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, and OMP_CLAUSE_MAP's
GOMP_MAP_FORCE_DEVICEPTR.
gcc/cp/
* parser.c: Include "gomp-constants.h".
(cp_parser_omp_clause_map): Use enum gomp_map_kind instead of enum
omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*.
Use OMP_CLAUSE_SET_MAP_KIND.
(cp_parser_omp_construct, cp_parser_pragma): Handle
PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA,
PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_PARALLEL,
PRAGMA_OACC_LOOP, PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT.
(cp_parser_omp_clause_name): Handle "async", "copy", "copyout",
"create", "delete", "deviceptr", "host", "num_gangs",
"num_workers", "present", "present_or_copy", "pcopy",
"present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout",
"present_or_create", "pcreate", "vector_length", "wait".
(OACC_DATA_CLAUSE_MASK, OACC_ENTER_DATA_CLAUSE_MASK)
(OACC_EXIT_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK)
(OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK)
(OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros.
(cp_parser_omp_var_list_no_open): Handle OMP_CLAUSE__CACHE_.
(cp_parser_oacc_data_clause, cp_parser_oacc_data_clause_deviceptr)
(cp_parser_oacc_clause_vector_length, cp_parser_oacc_wait_list)
(cp_parser_oacc_clause_wait, cp_parser_omp_clause_num_gangs)
(cp_parser_omp_clause_num_workers, cp_parser_oacc_clause_async)
(cp_parser_oacc_all_clauses, cp_parser_oacc_cache)
(cp_parser_oacc_data, cp_parser_oacc_enter_exit_data)
(cp_parser_oacc_kernels, cp_parser_oacc_loop)
(cp_parser_oacc_parallel, cp_parser_oacc_update)
(cp_parser_oacc_wait): New functions.
* cp-tree.h (finish_oacc_data, finish_oacc_kernels)
(finish_oacc_parallel): New prototypes.
* semantics.c: Include "gomp-constants.h".
(handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use
GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use
OMP_CLAUSE_SET_MAP_KIND.
(finish_omp_clauses): Handle OMP_CLAUSE_ASYNC,
OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_WAIT, OMP_CLAUSE__CACHE_.
Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*.
(finish_oacc_data, finish_oacc_kernels, finish_oacc_parallel): New
functions.
gcc/fortran/
* lang.opt (fopenacc): New option.
* cpp.c (cpp_define_builtins): Conditionally define _OPENACC.
* dump-parse-tree.c (show_omp_node): Split part of it into...
(show_omp_clauses): ... this new function.
(show_omp_node, show_code_node): Handle EXEC_OACC_PARALLEL_LOOP,
EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS,
EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP,
EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE,
EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA.
(show_namespace): Update for OpenACC.
* f95-lang.c (DEF_FUNCTION_TYPE_VAR_2, DEF_FUNCTION_TYPE_VAR_8)
(DEF_FUNCTION_TYPE_VAR_12, DEF_GOACC_BUILTIN)
(DEF_GOACC_BUILTIN_COMPILER): New macros.
* types.def (BT_FN_VOID_INT_INT_VAR)
(BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR)
(BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR):
New function types.
* gfortran.h (gfc_statement): Add ST_OACC_PARALLEL_LOOP,
ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL,
ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_DATA,
ST_OACC_END_DATA, ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA,
ST_OACC_LOOP, ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE,
ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_KERNELS_LOOP,
ST_OACC_END_KERNELS_LOOP, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA,
ST_OACC_ROUTINE.
(struct gfc_expr_list): New data type.
(gfc_get_expr_list): New macro.
(gfc_omp_map_op): Add OMP_MAP_FORCE_ALLOC, OMP_MAP_FORCE_DEALLOC,
OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM, OMP_MAP_FORCE_TOFROM,
OMP_MAP_FORCE_PRESENT, OMP_MAP_FORCE_DEVICEPTR.
(OMP_LIST_FIRST, OMP_LIST_DEVICE_RESIDENT, OMP_LIST_USE_DEVICE)
(OMP_LIST_CACHE): New enumerators.
(struct gfc_omp_clauses): Add async_expr, gang_expr, worker_expr,
vector_expr, num_gangs_expr, num_workers_expr, vector_length_expr,
wait_list, tile_list, async, gang, worker, vector, seq,
independent, wait, par_auto, gang_static, and loc members.
(struct gfc_namespace): Add oacc_declare_clauses member.
(gfc_exec_op): Add EXEC_OACC_KERNELS_LOOP,
EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS,
EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP,
EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE,
EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA.
(gfc_free_expr_list, gfc_resolve_oacc_directive)
(gfc_resolve_oacc_declare, gfc_resolve_oacc_parallel_loop_blocks)
(gfc_resolve_oacc_blocks): New prototypes.
* match.c (match_exit_cycle): Handle EXEC_OACC_LOOP and
EXEC_OACC_PARALLEL_LOOP.
* match.h (gfc_match_oacc_cache, gfc_match_oacc_wait)
(gfc_match_oacc_update, gfc_match_oacc_declare)
(gfc_match_oacc_loop, gfc_match_oacc_host_data)
(gfc_match_oacc_data, gfc_match_oacc_kernels)
(gfc_match_oacc_kernels_loop, gfc_match_oacc_parallel)
(gfc_match_oacc_parallel_loop, gfc_match_oacc_enter_data)
(gfc_match_oacc_exit_data, gfc_match_oacc_routine): New
prototypes.
* openmp.c: Include "diagnostic.h" and "gomp-constants.h".
(gfc_free_omp_clauses): Update for members added to struct
gfc_omp_clauses.
(gfc_match_omp_clauses): Change mask paramter to uint64_t. Add
openacc parameter.
(resolve_omp_clauses): Add openacc parameter. Update for OpenACC.
(struct fortran_omp_context): Add is_openmp member.
(gfc_resolve_omp_parallel_blocks): Initialize it.
(gfc_resolve_do_iterator): Update for OpenACC.
(gfc_resolve_omp_directive): Call
resolve_omp_directive_inside_oacc_region.
(OMP_CLAUSE_PRIVATE, OMP_CLAUSE_FIRSTPRIVATE)
(OMP_CLAUSE_LASTPRIVATE, OMP_CLAUSE_COPYPRIVATE)
(OMP_CLAUSE_SHARED, OMP_CLAUSE_COPYIN, OMP_CLAUSE_REDUCTION)
(OMP_CLAUSE_IF, OMP_CLAUSE_NUM_THREADS, OMP_CLAUSE_SCHEDULE)
(OMP_CLAUSE_DEFAULT, OMP_CLAUSE_ORDERED, OMP_CLAUSE_COLLAPSE)
(OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE)
(OMP_CLAUSE_ALIGNED, OMP_CLAUSE_DEPEND, OMP_CLAUSE_INBRANCH)
(OMP_CLAUSE_LINEAR, OMP_CLAUSE_NOTINBRANCH, OMP_CLAUSE_PROC_BIND)
(OMP_CLAUSE_SAFELEN, OMP_CLAUSE_SIMDLEN, OMP_CLAUSE_UNIFORM)
(OMP_CLAUSE_DEVICE, OMP_CLAUSE_MAP, OMP_CLAUSE_TO)
(OMP_CLAUSE_FROM, OMP_CLAUSE_NUM_TEAMS, OMP_CLAUSE_THREAD_LIMIT)
(OMP_CLAUSE_DIST_SCHEDULE): Use uint64_t.
(OMP_CLAUSE_ASYNC, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS)
(OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_COPY, OMP_CLAUSE_COPYOUT)
(OMP_CLAUSE_CREATE, OMP_CLAUSE_PRESENT)
(OMP_CLAUSE_PRESENT_OR_COPY, OMP_CLAUSE_PRESENT_OR_COPYIN)
(OMP_CLAUSE_PRESENT_OR_COPYOUT, OMP_CLAUSE_PRESENT_OR_CREATE)
(OMP_CLAUSE_DEVICEPTR, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER)
(OMP_CLAUSE_VECTOR, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT)
(OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_DEVICE_RESIDENT)
(OMP_CLAUSE_HOST_SELF, OMP_CLAUSE_OACC_DEVICE, OMP_CLAUSE_WAIT)
(OMP_CLAUSE_DELETE, OMP_CLAUSE_AUTO, OMP_CLAUSE_TILE): New macros.
(gfc_match_omp_clauses): Handle those.
(OACC_PARALLEL_CLAUSES, OACC_KERNELS_CLAUSES, OACC_DATA_CLAUSES)
(OACC_LOOP_CLAUSES, OACC_PARALLEL_LOOP_CLAUSES)
(OACC_KERNELS_LOOP_CLAUSES, OACC_HOST_DATA_CLAUSES)
(OACC_DECLARE_CLAUSES, OACC_UPDATE_CLAUSES)
(OACC_ENTER_DATA_CLAUSES, OACC_EXIT_DATA_CLAUSES)
(OACC_WAIT_CLAUSES): New macros.
(gfc_free_expr_list, match_oacc_expr_list, match_oacc_clause_gang)
(gfc_match_omp_map_clause, gfc_match_oacc_parallel_loop)
(gfc_match_oacc_parallel, gfc_match_oacc_kernels_loop)
(gfc_match_oacc_kernels, gfc_match_oacc_data)
(gfc_match_oacc_host_data, gfc_match_oacc_loop)
(gfc_match_oacc_declare, gfc_match_oacc_update)
(gfc_match_oacc_enter_data, gfc_match_oacc_exit_data)
(gfc_match_oacc_wait, gfc_match_oacc_cache)
(gfc_match_oacc_routine, oacc_is_loop)
(resolve_oacc_scalar_int_expr, resolve_oacc_positive_int_expr)
(check_symbol_not_pointer, check_array_not_assumed)
(resolve_oacc_data_clauses, resolve_oacc_deviceptr_clause)
(oacc_compatible_clauses, oacc_is_parallel, oacc_is_kernels)
(omp_code_to_statement, oacc_code_to_statement)
(resolve_oacc_directive_inside_omp_region)
(resolve_omp_directive_inside_oacc_region)
(resolve_oacc_nested_loops, resolve_oacc_params_in_parallel)
(resolve_oacc_loop_blocks, gfc_resolve_oacc_blocks)
(resolve_oacc_loop, resolve_oacc_cache, gfc_resolve_oacc_declare)
(gfc_resolve_oacc_directive): New functions.
* parse.c (next_free): Update for OpenACC. Move some code into...
(verify_token_free): ... this new function.
(next_fixed): Update for OpenACC. Move some code into...
(verify_token_fixed): ... this new function.
(case_executable): Add ST_OACC_UPDATE, ST_OACC_WAIT,
ST_OACC_CACHE, ST_OACC_ENTER_DATA, and ST_OACC_EXIT_DATA.
(case_exec_markers): Add ST_OACC_PARALLEL_LOOP, ST_OACC_PARALLEL,
ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA, ST_OACC_LOOP,
ST_OACC_KERNELS_LOOP.
(case_decl): Add ST_OACC_ROUTINE.
(push_state, parse_critical_block, parse_progunit): Update for
OpenACC.
(gfc_ascii_statement): Handle ST_OACC_PARALLEL_LOOP,
ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL,
ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_KERNELS_LOOP,
ST_OACC_END_KERNELS_LOOP, ST_OACC_DATA, ST_OACC_END_DATA,
ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA, ST_OACC_LOOP,
ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE, ST_OACC_WAIT,
ST_OACC_CACHE, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA,
ST_OACC_ROUTINE.
(verify_st_order, parse_spec): Handle ST_OACC_DECLARE.
(parse_executable): Handle ST_OACC_PARALLEL_LOOP,
ST_OACC_KERNELS_LOOP, ST_OACC_LOOP, ST_OACC_PARALLEL,
ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA.
(decode_oacc_directive, parse_oacc_structured_block)
(parse_oacc_loop, is_oacc): New functions.
* parse.h (struct gfc_state_data): Add oacc_declare_clauses
member.
(is_oacc): New prototype.
* resolve.c (gfc_resolve_blocks, gfc_resolve_code): Handle
EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL,
EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA,
EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE,
EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA,
EXEC_OACC_EXIT_DATA.
(resolve_codes): Call gfc_resolve_oacc_declare.
* scanner.c (openacc_flag, openacc_locus): New variables.
(skip_free_comments): Update for OpenACC. Move some code into...
(skip_omp_attribute): ... this new function.
(skip_oacc_attribute): New function.
(skip_fixed_comments, gfc_next_char_literal): Update for OpenACC.
* st.c (gfc_free_statement): Handle EXEC_OACC_PARALLEL_LOOP,
EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS,
EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP,
EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE,
EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA.
* trans-decl.c (gfc_generate_function_code): Update for OpenACC.
* trans-openmp.c: Include "gomp-constants.h".
(gfc_omp_finish_clause, gfc_trans_omp_clauses): Use GOMP_MAP_*
instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND.
(gfc_trans_omp_clauses): Handle OMP_LIST_USE_DEVICE,
OMP_LIST_DEVICE_RESIDENT, OMP_LIST_CACHE, and OMP_MAP_FORCE_ALLOC,
OMP_MAP_FORCE_DEALLOC, OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM,
OMP_MAP_FORCE_TOFROM, OMP_MAP_FORCE_PRESENT,
OMP_MAP_FORCE_DEVICEPTR, and gfc_omp_clauses' async, seq,
independent, wait_list, num_gangs_expr, num_workers_expr,
vector_length_expr, vector, vector_expr, worker, worker_expr,
gang, gang_expr members.
(gfc_trans_omp_do): Handle EXEC_OACC_LOOP.
(gfc_convert_expr_to_tree, gfc_trans_oacc_construct)
(gfc_trans_oacc_executable_directive)
(gfc_trans_oacc_wait_directive, gfc_trans_oacc_combined_directive)
(gfc_trans_oacc_declare, gfc_trans_oacc_directive): New functions.
* trans-stmt.c (gfc_trans_block_construct): Update for OpenACC.
* trans-stmt.h (gfc_trans_oacc_directive, gfc_trans_oacc_declare):
New prototypes.
* trans.c (tranc_code): Handle EXEC_OACC_CACHE, EXEC_OACC_WAIT,
EXEC_OACC_UPDATE, EXEC_OACC_LOOP, EXEC_OACC_HOST_DATA,
EXEC_OACC_DATA, EXEC_OACC_KERNELS, EXEC_OACC_KERNELS_LOOP,
EXEC_OACC_PARALLEL, EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_ENTER_DATA,
EXEC_OACC_EXIT_DATA.
* gfortran.texi: Update for OpenACC.
* intrinsic.texi: Likewise.
* invoke.texi: Likewise.
gcc/lto/
* lto-lang.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12):
New macros.
* lto.c: Include "gomp-constants.h".
gcc/testsuite/
* lib/target-supports.exp (check_effective_target_fopenacc): New
procedure.
* g++.dg/goacc-gomp/goacc-gomp.exp: New file.
* g++.dg/goacc/goacc.exp: Likewise.
* gcc.dg/goacc-gomp/goacc-gomp.exp: Likewise.
* gcc.dg/goacc/goacc.exp: Likewise.
* gfortran.dg/goacc/goacc.exp: Likewise.
* c-c++-common/cpp/openacc-define-1.c: New file.
* c-c++-common/cpp/openacc-define-2.c: Likewise.
* c-c++-common/cpp/openacc-define-3.c: Likewise.
* c-c++-common/goacc-gomp/nesting-1.c: Likewise.
* c-c++-common/goacc-gomp/nesting-fail-1.c: Likewise.
* c-c++-common/goacc/acc_on_device-2-off.c: Likewise.
* c-c++-common/goacc/acc_on_device-2.c: Likewise.
* c-c++-common/goacc/asyncwait-1.c: Likewise.
* c-c++-common/goacc/cache-1.c: Likewise.
* c-c++-common/goacc/clauses-fail.c: Likewise.
* c-c++-common/goacc/collapse-1.c: Likewise.
* c-c++-common/goacc/data-1.c: Likewise.
* c-c++-common/goacc/data-2.c: Likewise.
* c-c++-common/goacc/data-clause-duplicate-1.c: Likewise.
* c-c++-common/goacc/deviceptr-1.c: Likewise.
* c-c++-common/goacc/deviceptr-2.c: Likewise.
* c-c++-common/goacc/deviceptr-3.c: Likewise.
* c-c++-common/goacc/if-clause-1.c: Likewise.
* c-c++-common/goacc/if-clause-2.c: Likewise.
* c-c++-common/goacc/kernels-1.c: Likewise.
* c-c++-common/goacc/loop-1.c: Likewise.
* c-c++-common/goacc/loop-private-1.c: Likewise.
* c-c++-common/goacc/nesting-1.c: Likewise.
* c-c++-common/goacc/nesting-data-1.c: Likewise.
* c-c++-common/goacc/nesting-fail-1.c: Likewise.
* c-c++-common/goacc/parallel-1.c: Likewise.
* c-c++-common/goacc/pcopy.c: Likewise.
* c-c++-common/goacc/pcopyin.c: Likewise.
* c-c++-common/goacc/pcopyout.c: Likewise.
* c-c++-common/goacc/pcreate.c: Likewise.
* c-c++-common/goacc/pragma_context.c: Likewise.
* c-c++-common/goacc/present-1.c: Likewise.
* c-c++-common/goacc/reduction-1.c: Likewise.
* c-c++-common/goacc/reduction-2.c: Likewise.
* c-c++-common/goacc/reduction-3.c: Likewise.
* c-c++-common/goacc/reduction-4.c: Likewise.
* c-c++-common/goacc/sb-1.c: Likewise.
* c-c++-common/goacc/sb-2.c: Likewise.
* c-c++-common/goacc/sb-3.c: Likewise.
* c-c++-common/goacc/update-1.c: Likewise.
* gcc.dg/goacc/acc_on_device-1.c: Likewise.
* gfortran.dg/goacc/acc_on_device-1.f95: Likewise.
* gfortran.dg/goacc/acc_on_device-2-off.f95: Likewise.
* gfortran.dg/goacc/acc_on_device-2.f95: Likewise.
* gfortran.dg/goacc/assumed.f95: Likewise.
* gfortran.dg/goacc/asyncwait-1.f95: Likewise.
* gfortran.dg/goacc/asyncwait-2.f95: Likewise.
* gfortran.dg/goacc/asyncwait-3.f95: Likewise.
* gfortran.dg/goacc/asyncwait-4.f95: Likewise.
* gfortran.dg/goacc/branch.f95: Likewise.
* gfortran.dg/goacc/cache-1.f95: Likewise.
* gfortran.dg/goacc/coarray.f95: Likewise.
* gfortran.dg/goacc/continuation-free-form.f95: Likewise.
* gfortran.dg/goacc/cray.f95: Likewise.
* gfortran.dg/goacc/critical.f95: Likewise.
* gfortran.dg/goacc/data-clauses.f95: Likewise.
* gfortran.dg/goacc/data-tree.f95: Likewise.
* gfortran.dg/goacc/declare-1.f95: Likewise.
* gfortran.dg/goacc/enter-exit-data.f95: Likewise.
* gfortran.dg/goacc/fixed-1.f: Likewise.
* gfortran.dg/goacc/fixed-2.f: Likewise.
* gfortran.dg/goacc/fixed-3.f: Likewise.
* gfortran.dg/goacc/fixed-4.f: Likewise.
* gfortran.dg/goacc/host_data-tree.f95: Likewise.
* gfortran.dg/goacc/if.f95: Likewise.
* gfortran.dg/goacc/kernels-tree.f95: Likewise.
* gfortran.dg/goacc/list.f95: Likewise.
* gfortran.dg/goacc/literal.f95: Likewise.
* gfortran.dg/goacc/loop-1.f95: Likewise.
* gfortran.dg/goacc/loop-2.f95: Likewise.
* gfortran.dg/goacc/loop-3.f95: Likewise.
* gfortran.dg/goacc/loop-tree-1.f90: Likewise.
* gfortran.dg/goacc/omp.f95: Likewise.
* gfortran.dg/goacc/parallel-kernels-clauses.f95: Likewise.
* gfortran.dg/goacc/parallel-kernels-regions.f95: Likewise.
* gfortran.dg/goacc/parallel-tree.f95: Likewise.
* gfortran.dg/goacc/parameter.f95: Likewise.
* gfortran.dg/goacc/private-1.f95: Likewise.
* gfortran.dg/goacc/private-2.f95: Likewise.
* gfortran.dg/goacc/private-3.f95: Likewise.
* gfortran.dg/goacc/pure-elemental-procedures.f95: Likewise.
* gfortran.dg/goacc/reduction-2.f95: Likewise.
* gfortran.dg/goacc/reduction.f95: Likewise.
* gfortran.dg/goacc/routine-1.f90: Likewise.
* gfortran.dg/goacc/routine-2.f90: Likewise.
* gfortran.dg/goacc/sentinel-free-form.f95: Likewise.
* gfortran.dg/goacc/several-directives.f95: Likewise.
* gfortran.dg/goacc/sie.f95: Likewise.
* gfortran.dg/goacc/subarrays.f95: Likewise.
* gfortran.dg/gomp/map-1.f90: Likewise.
* gfortran.dg/openacc-define-1.f90: Likewise.
* gfortran.dg/openacc-define-2.f90: Likewise.
* gfortran.dg/openacc-define-3.f90: Likewise.
* g++.dg/gomp/block-1.C: Update for changed compiler output.
* g++.dg/gomp/block-2.C: Likewise.
* g++.dg/gomp/block-3.C: Likewise.
* g++.dg/gomp/block-5.C: Likewise.
* g++.dg/gomp/target-1.C: Likewise.
* g++.dg/gomp/target-2.C: Likewise.
* g++.dg/gomp/taskgroup-1.C: Likewise.
* g++.dg/gomp/teams-1.C: Likewise.
* gcc.dg/cilk-plus/jump-openmp.c: Likewise.
* gcc.dg/cilk-plus/jump.c: Likewise.
* gcc.dg/gomp/block-1.c: Likewise.
* gcc.dg/gomp/block-10.c: Likewise.
* gcc.dg/gomp/block-2.c: Likewise.
* gcc.dg/gomp/block-3.c: Likewise.
* gcc.dg/gomp/block-4.c: Likewise.
* gcc.dg/gomp/block-5.c: Likewise.
* gcc.dg/gomp/block-6.c: Likewise.
* gcc.dg/gomp/block-7.c: Likewise.
* gcc.dg/gomp/block-8.c: Likewise.
* gcc.dg/gomp/block-9.c: Likewise.
* gcc.dg/gomp/target-1.c: Likewise.
* gcc.dg/gomp/target-2.c: Likewise.
* gcc.dg/gomp/taskgroup-1.c: Likewise.
* gcc.dg/gomp/teams-1.c: Likewise.
include/
* gomp-constants.h: New file.
libgomp/
* Makefile.am (search_path): Add $(top_srcdir)/../include.
(libgomp_la_SOURCES): Add splay-tree.c, libgomp-plugin.c,
oacc-parallel.c, oacc-host.c, oacc-init.c, oacc-mem.c,
oacc-async.c, oacc-plugin.c, oacc-cuda.c.
[USE_FORTRAN] (libgomp_la_SOURCES): Add openacc.f90.
Include $(top_srcdir)/plugin/Makefrag.am.
(nodist_libsubinclude_HEADERS): Add openacc.h.
[USE_FORTRAN] (nodist_finclude_HEADERS): Add openacc_lib.h,
openacc.f90, openacc.mod, openacc_kinds.mod.
(omp_lib.mod): Generalize into...
(%.mod): ... this new rule.
(openacc_kinds.mod, openacc.mod): New rules.
* plugin/configfrag.ac: New file.
* configure.ac: Move plugin/offloading support into it. Include
it. Instantiate testsuite/libgomp-test-support.pt.exp.
* plugin/Makefrag.am: New file.
* testsuite/Makefile.am (OFFLOAD_TARGETS)
(OFFLOAD_ADDITIONAL_OPTIONS, OFFLOAD_ADDITIONAL_LIB_PATHS): Don't
export.
(libgomp-test-support.exp): New rule.
(all-local): Depend on it.
* Makefile.in: Regenerate.
* testsuite/Makefile.in: Regenerate.
* config.h.in: Likewise.
* configure: Likewise.
* configure.tgt: Harden shell syntax.
* env.c: Include "oacc-int.h".
(parse_acc_device_type): New function.
(gomp_debug_var, goacc_device_type, goacc_device_num): New
variables.
(initialize_env): Initialize those. Call
goacc_runtime_initialize.
* error.c (gomp_vdebug, gomp_debug, gomp_vfatal): New functions.
(gomp_fatal): Call gomp_vfatal.
* libgomp.h: Include "libgomp-plugin.h" and <stdarg.h>.
(gomp_debug_var, goacc_device_type, goacc_device_num, gomp_vdebug)
(gomp_debug, gomp_verror, gomp_vfatal, gomp_init_targets_once)
(splay_tree_node, splay_tree, splay_tree_key)
(struct target_mem_desc, struct splay_tree_key_s)
(struct gomp_memory_mapping, struct acc_dispatch_t)
(struct gomp_device_descr, gomp_acc_insert_pointer)
(gomp_acc_remove_pointer, target_mem_desc, gomp_copy_from_async)
(gomp_unmap_vars, gomp_init_device, gomp_init_tables)
(gomp_free_memmap, gomp_fini_device): New declarations.
(gomp_vdebug, gomp_debug): New macros.
Include "splay-tree.h".
* libgomp.map (OACC_2.0): New symbol version. Use for
acc_get_num_devices, acc_get_num_devices_h_, acc_set_device_type,
acc_set_device_type_h_, acc_get_device_type,
acc_get_device_type_h_, acc_set_device_num, acc_set_device_num_h_,
acc_get_device_num, acc_get_device_num_h_, acc_async_test,
acc_async_test_h_, acc_async_test_all, acc_async_test_all_h_,
acc_wait, acc_wait_h_, acc_wait_async, acc_wait_async_h_,
acc_wait_all, acc_wait_all_h_, acc_wait_all_async,
acc_wait_all_async_h_, acc_init, acc_init_h_, acc_shutdown,
acc_shutdown_h_, acc_on_device, acc_on_device_h_, acc_malloc,
acc_free, acc_copyin, acc_copyin_32_h_, acc_copyin_64_h_,
acc_copyin_array_h_, acc_present_or_copyin,
acc_present_or_copyin_32_h_, acc_present_or_copyin_64_h_,
acc_present_or_copyin_array_h_, acc_create, acc_create_32_h_,
acc_create_64_h_, acc_create_array_h_, acc_present_or_create,
acc_present_or_create_32_h_, acc_present_or_create_64_h_,
acc_present_or_create_array_h_, acc_copyout, acc_copyout_32_h_,
acc_copyout_64_h_, acc_copyout_array_h_, acc_delete,
acc_delete_32_h_, acc_delete_64_h_, acc_delete_array_h_,
acc_update_device, acc_update_device_32_h_,
acc_update_device_64_h_, acc_update_device_array_h_,
acc_update_self, acc_update_self_32_h_, acc_update_self_64_h_,
acc_update_self_array_h_, acc_map_data, acc_unmap_data,
acc_deviceptr, acc_hostptr, acc_is_present, acc_is_present_32_h_,
acc_is_present_64_h_, acc_is_present_array_h_,
acc_memcpy_to_device, acc_memcpy_from_device,
acc_get_current_cuda_device, acc_get_current_cuda_context,
acc_get_cuda_stream, acc_set_cuda_stream.
(GOACC_2.0): New symbol version. Use for GOACC_data_end,
GOACC_data_start, GOACC_enter_exit_data, GOACC_parallel,
GOACC_update, GOACC_wait, GOACC_get_thread_num,
GOACC_get_num_threads.
(GOMP_PLUGIN_1.0): New symbol version. Use for
GOMP_PLUGIN_malloc, GOMP_PLUGIN_malloc_cleared,
GOMP_PLUGIN_realloc, GOMP_PLUGIN_debug, GOMP_PLUGIN_error,
GOMP_PLUGIN_fatal, GOMP_PLUGIN_async_unmap_vars,
GOMP_PLUGIN_acc_thread.
* libgomp.texi: Update for OpenACC changes, and GOMP_DEBUG
environment variable.
* libgomp_g.h (GOACC_data_start, GOACC_data_end)
(GOACC_enter_exit_data, GOACC_parallel, GOACC_update, GOACC_wait)
(GOACC_get_num_threads, GOACC_get_thread_num): New declarations.
* splay-tree.h (splay_tree_lookup, splay_tree_insert)
(splay_tree_remove): New declarations.
(rotate_left, rotate_right, splay_tree_splay, splay_tree_insert)
(splay_tree_remove, splay_tree_lookup): Move into...
* splay-tree.c: ... this new file.
* target.c: Include "oacc-plugin.h", "oacc-int.h", <assert.h>.
(splay_tree_node, splay_tree, splay_tree_key)
(struct target_mem_desc, struct splay_tree_key_s)
(struct gomp_device_descr): Don't declare.
(num_devices_openmp): New variable.
(gomp_get_num_devices ): Use it.
(gomp_init_targets_once): New function.
(gomp_get_num_devices ): Use it.
(get_kind, gomp_copy_from_async, gomp_free_memmap)
(gomp_fini_device, gomp_register_image_for_device): New functions.
(gomp_map_vars): Add devaddrs parameter.
(gomp_update): Add mm parameter.
(gomp_init_device): Move most of it into...
(gomp_init_tables): ... this new function.
(gomp_register_images_for_device): Remove function.
(splay_compare, gomp_map_vars, gomp_unmap_vars, gomp_init_device):
Make them hidden instead of static.
(gomp_map_vars_existing, gomp_map_vars, gomp_unmap_vars)
(gomp_update, gomp_init_device, GOMP_target, GOMP_target_data)
(GOMP_target_end_data, GOMP_target_update)
(gomp_load_plugin_for_device, gomp_target_init): Update for
OpenACC changes.
* oacc-async.c: New file.
* oacc-cuda.c: Likewise.
* oacc-host.c: Likewise.
* oacc-init.c: Likewise.
* oacc-int.h: Likewise.
* oacc-mem.c: Likewise.
* oacc-parallel.c: Likewise.
* oacc-plugin.c: Likewise.
* oacc-plugin.h: Likewise.
* oacc-ptx.h: Likewise.
* openacc.f90: Likewise.
* openacc.h: Likewise.
* openacc_lib.h: Likewise.
* plugin/plugin-host.c: Likewise.
* plugin/plugin-nvptx.c: Likewise.
* libgomp-plugin.c: Likewise.
* libgomp-plugin.h: Likewise.
* libgomp_target.h: Remove file after merging content into the
former file. Update all users.
* testsuite/lib/libgomp.exp: Load libgomp-test-support.exp.
(offload_targets_s, offload_targets_s_openacc): New variables.
(check_effective_target_openacc_nvidia_accel_present)
(check_effective_target_openacc_nvidia_accel_selected): New
procedures.
(libgomp_init): Update for OpenACC changes.
* testsuite/libgomp-test-support.exp.in: New file.
* testsuite/libgomp.oacc-c++/c++.exp: Likewise.
* testsuite/libgomp.oacc-c/c.exp: Likewise.
* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
* testsuite/libgomp.oacc-c-c++-common/abort-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/abort-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/abort-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/abort-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/asyncwait-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/cache-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/clauses-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/clauses-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/collapse-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/collapse-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/collapse-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/collapse-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/context-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/context-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/context-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/context-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-5.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-6.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-7.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-8.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/deviceptr-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/if-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-empty.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-10.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-11.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-12.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-13.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-14.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-15.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-16.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-17.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-18.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-19.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-20.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-21.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-22.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-23.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-24.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-25.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-26.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-27.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-28.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-29.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-30.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-31.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-32.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-33.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-34.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-35.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-36.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-37.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-38.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-39.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-40.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-41.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-42.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-43.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-44.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-45.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-46.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-47.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-48.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-49.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-5.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-50.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-51.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-52.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-53.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-54.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-55.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-56.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-57.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-58.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-59.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-6.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-60.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-61.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-62.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-63.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-64.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-65.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-66.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-67.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-68.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-69.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-7.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-70.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-71.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-72.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-73.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-74.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-75.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-76.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-77.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-78.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-79.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-80.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-81.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-82.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-83.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-84.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-85.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-86.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-87.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-88.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-89.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-9.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-90.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-91.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-92.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/nested-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/nested-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/offset-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/parallel-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/parallel-empty.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/pointer-align-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/present-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/present-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-initial-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/subr.h: Likewise.
* testsuite/libgomp.oacc-c-c++-common/subr.ptx: Likewise.
* testsuite/libgomp.oacc-c-c++-common/timer.h: Likewise.
* testsuite/libgomp.oacc-c-c++-common/update-1-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/update-1.c: Likewise.
* testsuite/libgomp.oacc-fortran/abort-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/abort-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f: Likewise.
* testsuite/libgomp.oacc-fortran/asyncwait-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/asyncwait-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/asyncwait-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-4.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-5.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-6.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-7.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-8.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-4-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-4.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-1.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-3.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-4.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-5.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-6.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-7.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-8.f: Likewise.
* testsuite/libgomp.oacc-fortran/lib-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-10.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/lib-3.f: Likewise.
* testsuite/libgomp.oacc-fortran/lib-4.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-5.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-6.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-7.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-8.f90: Likewise.
* testsuite/libgomp.oacc-fortran/map-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/openacc_version-1.f: Likewise.
* testsuite/libgomp.oacc-fortran/openacc_version-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/pointer-align-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/pset-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-4.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-5.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-6.f90: Likewise.
* testsuite/libgomp.oacc-fortran/routine-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/routine-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/routine-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/routine-4.f90: Likewise.
* testsuite/libgomp.oacc-fortran/subarrays-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/subarrays-2.f90: Likewise.
liboffloadmic/
* plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_get_name)
(GOMP_OFFLOAD_get_caps, GOMP_OFFLOAD_fini_device): New functions.
Co-Authored-By: Bernd Schmidt <bernds@codesourcery.com>
Co-Authored-By: Cesar Philippidis <cesar@codesourcery.com>
Co-Authored-By: Dmitry Bocharnikov <dmitry.b@samsung.com>
Co-Authored-By: Evgeny Gavrin <e.gavrin@samsung.com>
Co-Authored-By: Ilmir Usmanov <i.usmanov@samsung.com>
Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
Co-Authored-By: James Norris <jnorris@codesourcery.com>
Co-Authored-By: Julian Brown <julian@codesourcery.com>
Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
Co-Authored-By: Tobias Burnus <burnus@net-b.de>
Co-Authored-By: Tom de Vries <tom@codesourcery.com>
From-SVN: r219682
2015-01-15 21:11:12 +01:00
|
|
|
@code{ISO_C_BINDING}, @code{OMP_LIB} and @code{OMP_LIB_KINDS},
|
|
|
|
and @code{OPENACC}.
|
2006-12-17 03:41:48 +01:00
|
|
|
|
2007-03-08 14:11:54 +01:00
|
|
|
@item
|
|
|
|
Renaming of operators in the @code{USE} statement.
|
|
|
|
|
2006-12-17 03:41:48 +01:00
|
|
|
@end itemize
|
|
|
|
|
|
|
|
|
re PR fortran/33197 (Fortran 2008: math functions)
PR fortran/33197
gcc/fortran/
* intrinsic.c (add_functions): Modify intrinsics ACOSH, ASINH,
ATANH, ERF, ERFC and GAMMA. Add intrinsics BESSEL_{J,Y}{0,1,N},
ERFC_SCALED, LOG_GAMMA and HYPOT.
* intrinsic.h (gfc_check_hypot, gfc_simplify_hypot,
gfc_resolve_hypot): New prototypes.
* mathbuiltins.def: Add HYPOT builtin. Make complex versions of
ACOSH, ASINH and ATANH available.
* gfortran.h (GFC_ISYM_ERFC_SCALED, GFC_ISYM_HYPOT): New values.
* lang.opt: Add -std=f2008 option.
* libgfortran.h: Define GFC_STD_F2008.
* lang-specs.h: Add .f08 and .F08 file suffixes.
* iresolve.c (gfc_resolve_hypot): New function.
* parse.c (parse_contained): Allow empty CONTAINS for Fortran 2008.
* check.c (gfc_check_hypot): New function.
* trans-intrinsic.c (gfc_intrinsic_map): Define ERFC_SCALE builtin.
* options.c (set_default_std_flags): Allow Fortran 2008 by default.
(form_from_filename): Add .f08 suffix.
(gfc_handle_option): Handle -std=f2008 option.
* simplify.c (gfc_simplify_hypot): New function.
* gfortran.texi: Document Fortran 2008 status and file extensions.
* intrinsic.texi: Document new BESSEL_{J,Y}{0,1,N} intrinsics,
as well as HYPOT and ERFC_SCALED. Update documentation of ERF,
ERFC, GAMMA, LGAMMA, ASINH, ACOSH and ATANH.
* invoke.texi: Document the new -std=f2008 option.
libgomp/
* testsuite/libgomp.fortran/fortran.exp: Add .f08 and
.F08 file suffixes.
gcc/testsuite/
* gfortran.dg/gomp/gomp.exp: Add .f08 and .F08 file suffixes.
* gfortran.dg/dg.exp: Likewise.
* gfortran.dg/vect/vect.exp: Likewise.
* gfortran.fortran-torture/execute/execute.exp: Likewise.
* gfortran.fortran-torture/compile/compile.exp: Likewise.
* gfortran.dg/gamma_1.f90: Also check log_gamma.
* gfortran.dg/invalid_contains_1.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_2.f90: Add a few error messages.
* gfortran.dg/invalid_contains_2.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_3.f90: Adjust error message.
* gfortran.dg/gamma_4.f90: Test for log_gamma instead of lgamma.
* gfortran.dg/bind_c_usage_9.f03: Adjust error messages.
* gfortran.dg/bessel_1.f90: New test.
* gfortran.dg/recursive_check_3.f90: Remove warnings.
* gfortran.dg/besxy.f90: Also check for new F2008 intrinsics.
* gfortran.dg/derived_function_interface_1.f90: Remove warning.
* gfortran.dg/contains_empty_1.f03: New test.
* gfortran.dg/erfc_scaled_1.f90: New test.
* gfortran.dg/hypot_1.f90: New test.
* gfortran.dg/contains_empty_2.f03: New test.
libgfortran/
* intrinsics/erfc_scaled_inc.c: New file.
* intrinsics/erfc_scaled.c: New file.
* gfortran.map (GFORTRAN_1.0): Add _gfortran_erfc_scaled_r*.
* Makefile.am: Add intrinsics/erfc_scaled.c.
* config.h.in: Regenerate.
* configure: Regenerate.
* Makefile.in: Regenerate.
From-SVN: r132846
2008-03-04 00:46:20 +01:00
|
|
|
@node Fortran 2008 status
|
|
|
|
@section Fortran 2008 status
|
|
|
|
|
2010-09-24 08:39:20 +02:00
|
|
|
The latest version of the Fortran standard is ISO/IEC 1539-1:2010, informally
|
|
|
|
known as Fortran 2008. The official version is available from International
|
|
|
|
Organization for Standardization (ISO) or its national member organizations.
|
|
|
|
The the final draft (FDIS) can be downloaded free of charge from
|
|
|
|
@url{http://www.nag.co.uk/@/sc22wg5/@/links.html}. Fortran is developed by the
|
|
|
|
Working Group 5 of Sub-Committee 22 of the Joint Technical Committee 1 of the
|
|
|
|
International Organization for Standardization and the International
|
|
|
|
Electrotechnical Commission (IEC). This group is known as
|
|
|
|
@uref{http://www.nag.co.uk/sc22wg5/, WG5}.
|
|
|
|
|
2011-05-16 22:37:30 +02:00
|
|
|
The GNU Fortran compiler supports several of the new features of Fortran 2008;
|
2014-05-23 22:32:04 +02:00
|
|
|
the @uref{https://gcc.gnu.org/wiki/Fortran2008Status, wiki} has some information
|
2010-09-24 08:39:20 +02:00
|
|
|
about the current Fortran 2008 implementation status. In particular, the
|
|
|
|
following is implemented.
|
|
|
|
|
|
|
|
@itemize
|
|
|
|
@item The @option{-std=f2008} option and support for the file extensions
|
|
|
|
@file{.f08} and @file{.F08}.
|
|
|
|
|
|
|
|
@item The @code{OPEN} statement now supports the @code{NEWUNIT=} option,
|
|
|
|
which returns a unique file unit, thus preventing inadvertent use of the
|
|
|
|
same unit in different parts of the program.
|
|
|
|
|
|
|
|
@item The @code{g0} format descriptor and unlimited format items.
|
|
|
|
|
|
|
|
@item The mathematical intrinsics @code{ASINH}, @code{ACOSH}, @code{ATANH},
|
|
|
|
@code{ERF}, @code{ERFC}, @code{GAMMA}, @code{LOG_GAMMA}, @code{BESSEL_J0},
|
|
|
|
@code{BESSEL_J1}, @code{BESSEL_JN}, @code{BESSEL_Y0}, @code{BESSEL_Y1},
|
|
|
|
@code{BESSEL_YN}, @code{HYPOT}, @code{NORM2}, and @code{ERFC_SCALED}.
|
|
|
|
|
|
|
|
@item Using complex arguments with @code{TAN}, @code{SINH}, @code{COSH},
|
|
|
|
@code{TANH}, @code{ASIN}, @code{ACOS}, and @code{ATAN} is now possible;
|
|
|
|
@code{ATAN}(@var{Y},@var{X}) is now an alias for @code{ATAN2}(@var{Y},@var{X}).
|
|
|
|
|
|
|
|
@item Support of the @code{PARITY} intrinsic functions.
|
|
|
|
|
|
|
|
@item The following bit intrinsics: @code{LEADZ} and @code{TRAILZ} for
|
|
|
|
counting the number of leading and trailing zero bits, @code{POPCNT} and
|
|
|
|
@code{POPPAR} for counting the number of one bits and returning the parity;
|
|
|
|
@code{BGE}, @code{BGT}, @code{BLE}, and @code{BLT} for bitwise comparisons;
|
|
|
|
@code{DSHIFTL} and @code{DSHIFTR} for combined left and right shifts,
|
|
|
|
@code{MASKL} and @code{MASKR} for simple left and right justified masks,
|
|
|
|
@code{MERGE_BITS} for a bitwise merge using a mask, @code{SHIFTA},
|
|
|
|
@code{SHIFTL} and @code{SHIFTR} for shift operations, and the
|
|
|
|
transformational bit intrinsics @code{IALL}, @code{IANY} and @code{IPARITY}.
|
|
|
|
|
|
|
|
@item Support of the @code{EXECUTE_COMMAND_LINE} intrinsic subroutine.
|
|
|
|
|
|
|
|
@item Support for the @code{STORAGE_SIZE} intrinsic inquiry function.
|
|
|
|
|
|
|
|
@item The @code{INT@{8,16,32@}} and @code{REAL@{32,64,128@}} kind type
|
2010-09-30 21:49:26 +02:00
|
|
|
parameters and the array-valued named constants @code{INTEGER_KINDS},
|
|
|
|
@code{LOGICAL_KINDS}, @code{REAL_KINDS} and @code{CHARACTER_KINDS} of
|
|
|
|
the intrinsic module @code{ISO_FORTRAN_ENV}.
|
|
|
|
|
|
|
|
@item The module procedures @code{C_SIZEOF} of the intrinsic module
|
|
|
|
@code{ISO_C_BINDINGS} and @code{COMPILER_VERSION} and @code{COMPILER_OPTIONS}
|
|
|
|
of @code{ISO_FORTRAN_ENV}.
|
2010-09-24 08:39:20 +02:00
|
|
|
|
2011-10-15 10:34:36 +02:00
|
|
|
@item Coarray support for serial programs with @option{-fcoarray=single} flag
|
|
|
|
and experimental support for multiple images with the @option{-fcoarray=lib}
|
|
|
|
flag.
|
|
|
|
|
2015-09-17 11:09:34 +02:00
|
|
|
@item Submodules are supported. It should noted that @code{MODULEs} do not
|
|
|
|
produce the smod file needed by the descendent @code{SUBMODULEs} unless they
|
|
|
|
contain at least one @code{MODULE PROCEDURE} interface. The reason for this is
|
|
|
|
that @code{SUBMODULEs} are useless without @code{MODULE PROCEDUREs}. See
|
|
|
|
http://j3-fortran.org/doc/meeting/207/15-209.txt for a discussion and a draft
|
|
|
|
interpretation. Adopting this interpretation has the advantage that code that
|
|
|
|
does not use submodules does not generate smod files.
|
|
|
|
|
2011-10-15 10:34:36 +02:00
|
|
|
@item The @code{DO CONCURRENT} construct is supported.
|
2010-09-24 08:39:20 +02:00
|
|
|
|
|
|
|
@item The @code{BLOCK} construct is supported.
|
|
|
|
|
|
|
|
@item The @code{STOP} and the new @code{ERROR STOP} statements now
|
2014-03-08 12:06:48 +01:00
|
|
|
support all constant expressions. Both show the signals which were signaling
|
|
|
|
at termination.
|
2010-09-24 08:39:20 +02:00
|
|
|
|
|
|
|
@item Support for the @code{CONTIGUOUS} attribute.
|
|
|
|
|
|
|
|
@item Support for @code{ALLOCATE} with @code{MOLD}.
|
|
|
|
|
|
|
|
@item Support for the @code{IMPURE} attribute for procedures, which
|
|
|
|
allows for @code{ELEMENTAL} procedures without the restrictions of
|
|
|
|
@code{PURE}.
|
|
|
|
|
|
|
|
@item Null pointers (including @code{NULL()}) and not-allocated variables
|
|
|
|
can be used as actual argument to optional non-pointer, non-allocatable
|
|
|
|
dummy arguments, denoting an absent argument.
|
|
|
|
|
|
|
|
@item Non-pointer variables with @code{TARGET} attribute can be used as
|
|
|
|
actual argument to @code{POINTER} dummies with @code{INTENT(IN)}.
|
|
|
|
|
|
|
|
@item Pointers including procedure pointers and those in a derived
|
|
|
|
type (pointer components) can now be initialized by a target instead
|
|
|
|
of only by @code{NULL}.
|
|
|
|
|
|
|
|
@item The @code{EXIT} statement (with construct-name) can be now be
|
|
|
|
used to leave not only the @code{DO} but also the @code{ASSOCIATE},
|
|
|
|
@code{BLOCK}, @code{IF}, @code{SELECT CASE} and @code{SELECT TYPE}
|
|
|
|
constructs.
|
|
|
|
|
|
|
|
@item Internal procedures can now be used as actual argument.
|
|
|
|
|
|
|
|
@item Minor features: obsolesce diagnostics for @code{ENTRY} with
|
|
|
|
@option{-std=f2008}; a line may start with a semicolon; for internal
|
|
|
|
and module procedures @code{END} can be used instead of
|
|
|
|
@code{END SUBROUTINE} and @code{END FUNCTION}; @code{SELECTED_REAL_KIND}
|
|
|
|
now also takes a @code{RADIX} argument; intrinsic types are supported
|
|
|
|
for @code{TYPE}(@var{intrinsic-type-spec}); multiple type-bound procedures
|
|
|
|
can be declared in a single @code{PROCEDURE} statement; implied-shape
|
|
|
|
arrays are supported for named constants (@code{PARAMETER}).
|
|
|
|
@end itemize
|
re PR fortran/33197 (Fortran 2008: math functions)
PR fortran/33197
gcc/fortran/
* intrinsic.c (add_functions): Modify intrinsics ACOSH, ASINH,
ATANH, ERF, ERFC and GAMMA. Add intrinsics BESSEL_{J,Y}{0,1,N},
ERFC_SCALED, LOG_GAMMA and HYPOT.
* intrinsic.h (gfc_check_hypot, gfc_simplify_hypot,
gfc_resolve_hypot): New prototypes.
* mathbuiltins.def: Add HYPOT builtin. Make complex versions of
ACOSH, ASINH and ATANH available.
* gfortran.h (GFC_ISYM_ERFC_SCALED, GFC_ISYM_HYPOT): New values.
* lang.opt: Add -std=f2008 option.
* libgfortran.h: Define GFC_STD_F2008.
* lang-specs.h: Add .f08 and .F08 file suffixes.
* iresolve.c (gfc_resolve_hypot): New function.
* parse.c (parse_contained): Allow empty CONTAINS for Fortran 2008.
* check.c (gfc_check_hypot): New function.
* trans-intrinsic.c (gfc_intrinsic_map): Define ERFC_SCALE builtin.
* options.c (set_default_std_flags): Allow Fortran 2008 by default.
(form_from_filename): Add .f08 suffix.
(gfc_handle_option): Handle -std=f2008 option.
* simplify.c (gfc_simplify_hypot): New function.
* gfortran.texi: Document Fortran 2008 status and file extensions.
* intrinsic.texi: Document new BESSEL_{J,Y}{0,1,N} intrinsics,
as well as HYPOT and ERFC_SCALED. Update documentation of ERF,
ERFC, GAMMA, LGAMMA, ASINH, ACOSH and ATANH.
* invoke.texi: Document the new -std=f2008 option.
libgomp/
* testsuite/libgomp.fortran/fortran.exp: Add .f08 and
.F08 file suffixes.
gcc/testsuite/
* gfortran.dg/gomp/gomp.exp: Add .f08 and .F08 file suffixes.
* gfortran.dg/dg.exp: Likewise.
* gfortran.dg/vect/vect.exp: Likewise.
* gfortran.fortran-torture/execute/execute.exp: Likewise.
* gfortran.fortran-torture/compile/compile.exp: Likewise.
* gfortran.dg/gamma_1.f90: Also check log_gamma.
* gfortran.dg/invalid_contains_1.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_2.f90: Add a few error messages.
* gfortran.dg/invalid_contains_2.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_3.f90: Adjust error message.
* gfortran.dg/gamma_4.f90: Test for log_gamma instead of lgamma.
* gfortran.dg/bind_c_usage_9.f03: Adjust error messages.
* gfortran.dg/bessel_1.f90: New test.
* gfortran.dg/recursive_check_3.f90: Remove warnings.
* gfortran.dg/besxy.f90: Also check for new F2008 intrinsics.
* gfortran.dg/derived_function_interface_1.f90: Remove warning.
* gfortran.dg/contains_empty_1.f03: New test.
* gfortran.dg/erfc_scaled_1.f90: New test.
* gfortran.dg/hypot_1.f90: New test.
* gfortran.dg/contains_empty_2.f03: New test.
libgfortran/
* intrinsics/erfc_scaled_inc.c: New file.
* intrinsics/erfc_scaled.c: New file.
* gfortran.map (GFORTRAN_1.0): Add _gfortran_erfc_scaled_r*.
* Makefile.am: Add intrinsics/erfc_scaled.c.
* config.h.in: Regenerate.
* configure: Regenerate.
* Makefile.in: Regenerate.
From-SVN: r132846
2008-03-04 00:46:20 +01:00
|
|
|
|
2009-08-30 10:26:38 +02:00
|
|
|
|
2009-02-18 19:54:41 +01:00
|
|
|
|
2011-10-15 10:34:36 +02:00
|
|
|
@node TS 29113 status
|
|
|
|
@section Technical Specification 29113 Status
|
2011-05-16 22:37:30 +02:00
|
|
|
|
2011-10-15 10:34:36 +02:00
|
|
|
GNU Fortran supports some of the new features of the Technical
|
|
|
|
Specification (TS) 29113 on Further Interoperability of Fortran with C.
|
2014-05-23 22:32:04 +02:00
|
|
|
The @uref{https://gcc.gnu.org/wiki/TS29113Status, wiki} has some information
|
2011-10-15 10:34:36 +02:00
|
|
|
about the current TS 29113 implementation status. In particular, the
|
2011-05-16 22:37:30 +02:00
|
|
|
following is implemented.
|
|
|
|
|
2013-02-07 12:08:20 +01:00
|
|
|
See also @ref{Further Interoperability of Fortran with C}.
|
|
|
|
|
2011-05-16 22:37:30 +02:00
|
|
|
@itemize
|
2011-10-15 10:34:36 +02:00
|
|
|
@item The @option{-std=f2008ts} option.
|
|
|
|
|
|
|
|
@item The @code{OPTIONAL} attribute is allowed for dummy arguments
|
|
|
|
of @code{BIND(C) procedures.}
|
|
|
|
|
2013-02-07 12:08:20 +01:00
|
|
|
@item The @code{RANK} intrinsic is supported.
|
2011-10-15 10:34:36 +02:00
|
|
|
|
|
|
|
@item GNU Fortran's implementation for variables with @code{ASYNCHRONOUS}
|
|
|
|
attribute is compatible with TS 29113.
|
2013-02-07 12:08:20 +01:00
|
|
|
|
|
|
|
@item Assumed types (@code{TYPE(*)}.
|
|
|
|
|
|
|
|
@item Assumed-rank (@code{DIMENSION(..)}). However, the array descriptor
|
|
|
|
of the TS is not yet supported.
|
2011-05-16 22:37:30 +02:00
|
|
|
@end itemize
|
|
|
|
|
|
|
|
|
2015-12-14 20:31:51 +01:00
|
|
|
@node TS 18508 status
|
|
|
|
@section Technical Specification 18508 Status
|
|
|
|
|
|
|
|
GNU Fortran supports the following new features of the Technical
|
|
|
|
Specification 18508 on Additional Parallel Features in Fortran:
|
|
|
|
|
|
|
|
@itemize
|
|
|
|
@item The new atomic ADD, CAS, FETCH and ADD/OR/XOR, OR and XOR intrinsics.
|
|
|
|
|
|
|
|
@item The @code{CO_MIN} and @code{CO_MAX} and @code{SUM} reduction intrinsics.
|
|
|
|
And the @code{CO_BROADCAST} and @code{CO_REDUCE} intrinsic, except that those
|
|
|
|
do not support polymorphic types or types with allocatable, pointer or
|
|
|
|
polymorphic components.
|
|
|
|
|
|
|
|
@item Events (@code{EVENT POST}, @code{EVENT WAIT}, @code{EVENT_QUERY})
|
|
|
|
@end itemize
|
|
|
|
|
2011-05-16 22:37:30 +02:00
|
|
|
|
2009-02-18 19:54:41 +01:00
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
@c Compiler Characteristics
|
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
|
|
|
|
@node Compiler Characteristics
|
|
|
|
@chapter Compiler Characteristics
|
|
|
|
|
2010-04-07 20:01:24 +02:00
|
|
|
This chapter describes certain characteristics of the GNU Fortran
|
|
|
|
compiler, that are not specified by the Fortran standard, but which
|
|
|
|
might in some way or another become visible to the programmer.
|
2009-02-18 19:54:41 +01:00
|
|
|
|
|
|
|
@menu
|
|
|
|
* KIND Type Parameters::
|
2010-04-07 20:01:24 +02:00
|
|
|
* Internal representation of LOGICAL variables::
|
2011-02-06 17:38:31 +01:00
|
|
|
* Thread-safety of the runtime library::
|
2011-11-09 16:46:15 +01:00
|
|
|
* Data consistency and durability::
|
2015-03-11 22:34:22 +01:00
|
|
|
* Files opened without an explicit ACTION= specifier::
|
2015-08-16 14:47:15 +02:00
|
|
|
* File operations on symbolic links::
|
2009-02-18 19:54:41 +01:00
|
|
|
@end menu
|
|
|
|
|
|
|
|
|
|
|
|
@node KIND Type Parameters
|
|
|
|
@section KIND Type Parameters
|
|
|
|
@cindex kind
|
|
|
|
|
|
|
|
The @code{KIND} type parameters supported by GNU Fortran for the primitive
|
|
|
|
data types are:
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
|
|
|
|
@item INTEGER
|
2013-12-10 17:44:04 +01:00
|
|
|
1, 2, 4, 8*, 16*, default: 4**
|
2009-02-18 19:54:41 +01:00
|
|
|
|
|
|
|
@item LOGICAL
|
2013-12-10 17:44:04 +01:00
|
|
|
1, 2, 4, 8*, 16*, default: 4**
|
2009-02-18 19:54:41 +01:00
|
|
|
|
|
|
|
@item REAL
|
2013-12-10 17:44:04 +01:00
|
|
|
4, 8, 10*, 16*, default: 4***
|
2009-02-18 19:54:41 +01:00
|
|
|
|
|
|
|
@item COMPLEX
|
2013-12-10 17:44:04 +01:00
|
|
|
4, 8, 10*, 16*, default: 4***
|
2009-02-18 19:54:41 +01:00
|
|
|
|
2013-12-10 21:33:12 +01:00
|
|
|
@item DOUBLE PRECISION
|
|
|
|
4, 8, 10*, 16*, default: 8***
|
|
|
|
|
2009-02-18 19:54:41 +01:00
|
|
|
@item CHARACTER
|
|
|
|
1, 4, default: 1
|
|
|
|
|
|
|
|
@end table
|
|
|
|
|
|
|
|
@noindent
|
2013-12-10 17:44:04 +01:00
|
|
|
* not available on all systems @*
|
|
|
|
** unless @option{-fdefault-integer-8} is used @*
|
|
|
|
*** unless @option{-fdefault-real-8} is used (see @ref{Fortran Dialect Options})
|
2009-02-18 19:54:41 +01:00
|
|
|
|
|
|
|
@noindent
|
|
|
|
The @code{KIND} value matches the storage size in bytes, except for
|
|
|
|
@code{COMPLEX} where the storage size is twice as much (or both real and
|
|
|
|
imaginary part are a real value of the given size). It is recommended to use
|
2013-12-10 17:44:04 +01:00
|
|
|
the @ref{SELECTED_CHAR_KIND}, @ref{SELECTED_INT_KIND} and
|
|
|
|
@ref{SELECTED_REAL_KIND} intrinsics or the @code{INT8}, @code{INT16},
|
2010-11-23 21:54:49 +01:00
|
|
|
@code{INT32}, @code{INT64}, @code{REAL32}, @code{REAL64}, and @code{REAL128}
|
|
|
|
parameters of the @code{ISO_FORTRAN_ENV} module instead of the concrete values.
|
|
|
|
The available kind parameters can be found in the constant arrays
|
|
|
|
@code{CHARACTER_KINDS}, @code{INTEGER_KINDS}, @code{LOGICAL_KINDS} and
|
2013-12-10 17:44:04 +01:00
|
|
|
@code{REAL_KINDS} in the @ref{ISO_FORTRAN_ENV} module. For C interoperability,
|
|
|
|
the kind parameters of the @ref{ISO_C_BINDING} module should be used.
|
2009-02-18 19:54:41 +01:00
|
|
|
|
|
|
|
|
2010-04-07 20:01:24 +02:00
|
|
|
@node Internal representation of LOGICAL variables
|
|
|
|
@section Internal representation of LOGICAL variables
|
|
|
|
@cindex logical, variable representation
|
|
|
|
|
|
|
|
The Fortran standard does not specify how variables of @code{LOGICAL}
|
|
|
|
type are represented, beyond requiring that @code{LOGICAL} variables
|
|
|
|
of default kind have the same storage size as default @code{INTEGER}
|
|
|
|
and @code{REAL} variables. The GNU Fortran internal representation is
|
|
|
|
as follows.
|
|
|
|
|
|
|
|
A @code{LOGICAL(KIND=N)} variable is represented as an
|
|
|
|
@code{INTEGER(KIND=N)} variable, however, with only two permissible
|
|
|
|
values: @code{1} for @code{.TRUE.} and @code{0} for
|
2010-09-24 08:39:20 +02:00
|
|
|
@code{.FALSE.}. Any other integer value results in undefined behavior.
|
2010-04-07 20:01:24 +02:00
|
|
|
|
2013-04-09 12:02:35 +02:00
|
|
|
See also @ref{Argument passing conventions} and @ref{Interoperability with C}.
|
2010-04-07 20:01:24 +02:00
|
|
|
|
2011-02-06 17:08:03 +01:00
|
|
|
|
|
|
|
@node Thread-safety of the runtime library
|
|
|
|
@section Thread-safety of the runtime library
|
|
|
|
@cindex thread-safety, threads
|
|
|
|
|
2011-02-07 20:19:51 +01:00
|
|
|
GNU Fortran can be used in programs with multiple threads, e.g.@: by
|
2011-02-06 17:08:03 +01:00
|
|
|
using OpenMP, by calling OS thread handling functions via the
|
|
|
|
@code{ISO_C_BINDING} facility, or by GNU Fortran compiled library code
|
|
|
|
being called from a multi-threaded program.
|
|
|
|
|
2011-02-07 20:02:01 +01:00
|
|
|
The GNU Fortran runtime library, (@code{libgfortran}), supports being
|
2011-02-06 17:08:03 +01:00
|
|
|
called concurrently from multiple threads with the following
|
|
|
|
exceptions.
|
|
|
|
|
2011-02-07 20:02:01 +01:00
|
|
|
During library initialization, the C @code{getenv} function is used,
|
|
|
|
which need not be thread-safe. Similarly, the @code{getenv}
|
2011-02-06 17:08:03 +01:00
|
|
|
function is used to implement the @code{GET_ENVIRONMENT_VARIABLE} and
|
|
|
|
@code{GETENV} intrinsics. It is the responsibility of the user to
|
|
|
|
ensure that the environment is not being updated concurrently when any
|
|
|
|
of these actions are taking place.
|
|
|
|
|
|
|
|
The @code{EXECUTE_COMMAND_LINE} and @code{SYSTEM} intrinsics are
|
2011-02-07 20:02:01 +01:00
|
|
|
implemented with the @code{system} function, which need not be
|
2011-02-06 17:08:03 +01:00
|
|
|
thread-safe. It is the responsibility of the user to ensure that
|
2011-02-07 20:02:01 +01:00
|
|
|
@code{system} is not called concurrently.
|
2011-02-06 17:08:03 +01:00
|
|
|
|
2014-11-10 01:17:16 +01:00
|
|
|
For platforms not supporting thread-safe POSIX functions, further
|
|
|
|
functionality might not be thread-safe. For details, please consult
|
|
|
|
the documentation for your operating system.
|
|
|
|
|
|
|
|
The GNU Fortran runtime library uses various C library functions that
|
|
|
|
depend on the locale, such as @code{strtod} and @code{snprintf}. In
|
|
|
|
order to work correctly in locale-aware programs that set the locale
|
|
|
|
using @code{setlocale}, the locale is reset to the default ``C''
|
|
|
|
locale while executing a formatted @code{READ} or @code{WRITE}
|
|
|
|
statement. On targets supporting the POSIX 2008 per-thread locale
|
|
|
|
functions (e.g. @code{newlocale}, @code{uselocale},
|
|
|
|
@code{freelocale}), these are used and thus the global locale set
|
|
|
|
using @code{setlocale} or the per-thread locales in other threads are
|
|
|
|
not affected. However, on targets lacking this functionality, the
|
|
|
|
global LC_NUMERIC locale is set to ``C'' during the formatted I/O.
|
|
|
|
Thus, on such targets it's not safe to call @code{setlocale}
|
|
|
|
concurrently from another thread while a Fortran formatted I/O
|
|
|
|
operation is in progress. Also, other threads doing something
|
|
|
|
dependent on the LC_NUMERIC locale might not work correctly if a
|
|
|
|
formatted I/O operation is in progress in another thread.
|
2011-11-09 16:46:15 +01:00
|
|
|
|
|
|
|
@node Data consistency and durability
|
|
|
|
@section Data consistency and durability
|
|
|
|
@cindex consistency, durability
|
|
|
|
|
|
|
|
This section contains a brief overview of data and metadata
|
|
|
|
consistency and durability issues when doing I/O.
|
|
|
|
|
|
|
|
With respect to durability, GNU Fortran makes no effort to ensure that
|
|
|
|
data is committed to stable storage. If this is required, the GNU
|
|
|
|
Fortran programmer can use the intrinsic @code{FNUM} to retrieve the
|
|
|
|
low level file descriptor corresponding to an open Fortran unit. Then,
|
|
|
|
using e.g. the @code{ISO_C_BINDING} feature, one can call the
|
|
|
|
underlying system call to flush dirty data to stable storage, such as
|
|
|
|
@code{fsync} on POSIX, @code{_commit} on MingW, or @code{fcntl(fd,
|
|
|
|
F_FULLSYNC, 0)} on Mac OS X. The following example shows how to call
|
|
|
|
fsync:
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
! Declare the interface for POSIX fsync function
|
|
|
|
interface
|
|
|
|
function fsync (fd) bind(c,name="fsync")
|
|
|
|
use iso_c_binding, only: c_int
|
|
|
|
integer(c_int), value :: fd
|
|
|
|
integer(c_int) :: fsync
|
|
|
|
end function fsync
|
|
|
|
end interface
|
|
|
|
|
|
|
|
! Variable declaration
|
|
|
|
integer :: ret
|
|
|
|
|
|
|
|
! Opening unit 10
|
|
|
|
open (10,file="foo")
|
|
|
|
|
|
|
|
! ...
|
|
|
|
! Perform I/O on unit 10
|
|
|
|
! ...
|
|
|
|
|
|
|
|
! Flush and sync
|
|
|
|
flush(10)
|
|
|
|
ret = fsync(fnum(10))
|
|
|
|
|
|
|
|
! Handle possible error
|
|
|
|
if (ret /= 0) stop "Error calling FSYNC"
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
With respect to consistency, for regular files GNU Fortran uses
|
|
|
|
buffered I/O in order to improve performance. This buffer is flushed
|
|
|
|
automatically when full and in some other situations, e.g. when
|
|
|
|
closing a unit. It can also be explicitly flushed with the
|
|
|
|
@code{FLUSH} statement. Also, the buffering can be turned off with the
|
|
|
|
@code{GFORTRAN_UNBUFFERED_ALL} and
|
|
|
|
@code{GFORTRAN_UNBUFFERED_PRECONNECTED} environment variables. Special
|
|
|
|
files, such as terminals and pipes, are always unbuffered. Sometimes,
|
|
|
|
however, further things may need to be done in order to allow other
|
|
|
|
processes to see data that GNU Fortran has written, as follows.
|
|
|
|
|
|
|
|
The Windows platform supports a relaxed metadata consistency model,
|
|
|
|
where file metadata is written to the directory lazily. This means
|
|
|
|
that, for instance, the @code{dir} command can show a stale size for a
|
|
|
|
file. One can force a directory metadata update by closing the unit,
|
|
|
|
or by calling @code{_commit} on the file descriptor. Note, though,
|
|
|
|
that @code{_commit} will force all dirty data to stable storage, which
|
|
|
|
is often a very slow operation.
|
|
|
|
|
|
|
|
The Network File System (NFS) implements a relaxed consistency model
|
|
|
|
called open-to-close consistency. Closing a file forces dirty data and
|
|
|
|
metadata to be flushed to the server, and opening a file forces the
|
|
|
|
client to contact the server in order to revalidate cached
|
|
|
|
data. @code{fsync} will also force a flush of dirty data and metadata
|
|
|
|
to the server. Similar to @code{open} and @code{close}, acquiring and
|
|
|
|
releasing @code{fcntl} file locks, if the server supports them, will
|
|
|
|
also force cache validation and flushing dirty data and metadata.
|
|
|
|
|
|
|
|
|
2015-03-11 22:34:22 +01:00
|
|
|
@node Files opened without an explicit ACTION= specifier
|
|
|
|
@section Files opened without an explicit ACTION= specifier
|
|
|
|
@cindex open, action
|
|
|
|
|
|
|
|
The Fortran standard says that if an @code{OPEN} statement is executed
|
|
|
|
without an explicit @code{ACTION=} specifier, the default value is
|
|
|
|
processor dependent. GNU Fortran behaves as follows:
|
|
|
|
|
|
|
|
@enumerate
|
|
|
|
@item Attempt to open the file with @code{ACTION='READWRITE'}
|
|
|
|
@item If that fails, try to open with @code{ACTION='READ'}
|
|
|
|
@item If that fails, try to open with @code{ACTION='WRITE'}
|
|
|
|
@item If that fails, generate an error
|
|
|
|
@end enumerate
|
|
|
|
|
|
|
|
|
2015-08-16 14:47:15 +02:00
|
|
|
@node File operations on symbolic links
|
|
|
|
@section File operations on symbolic links
|
|
|
|
@cindex file, symbolic link
|
|
|
|
|
|
|
|
This section documents the behavior of GNU Fortran for file operations on
|
|
|
|
symbolic links, on systems that support them.
|
|
|
|
|
|
|
|
@itemize
|
|
|
|
|
|
|
|
@item Results of INQUIRE statements of the ``inquire by file'' form will
|
|
|
|
relate to the target of the symbolic link. For example,
|
|
|
|
@code{INQUIRE(FILE="foo",EXIST=ex)} will set @var{ex} to @var{.true.} if
|
|
|
|
@var{foo} is a symbolic link pointing to an existing file, and @var{.false.}
|
|
|
|
if @var{foo} points to an non-existing file (``dangling'' symbolic link).
|
|
|
|
|
|
|
|
@item Using the @code{OPEN} statement with a @code{STATUS="NEW"} specifier
|
|
|
|
on a symbolic link will result in an error condition, whether the symbolic
|
|
|
|
link points to an existing target or is dangling.
|
|
|
|
|
|
|
|
@item If a symbolic link was connected, using the @code{CLOSE} statement
|
|
|
|
with a @code{STATUS="DELETE"} specifier will cause the symbolic link itself
|
|
|
|
to be deleted, not its target.
|
|
|
|
|
|
|
|
@end itemize
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-08-29 18:58:39 +02:00
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
@c Extensions
|
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
|
|
|
|
@c Maybe this chapter should be merged with the 'Standards' section,
|
|
|
|
@c whenever that is written :-)
|
|
|
|
|
|
|
|
@node Extensions
|
|
|
|
@chapter Extensions
|
2008-02-16 15:10:12 +01:00
|
|
|
@cindex extensions
|
|
|
|
|
|
|
|
The two sections below detail the extensions to standard Fortran that are
|
|
|
|
implemented in GNU Fortran, as well as some of the popular or
|
|
|
|
historically important extensions that are not (or not yet) implemented.
|
|
|
|
For the latter case, we explain the alternatives available to GNU Fortran
|
|
|
|
users, including replacement by standard-conforming code or GNU
|
|
|
|
extensions.
|
|
|
|
|
|
|
|
@menu
|
|
|
|
* Extensions implemented in GNU Fortran::
|
|
|
|
* Extensions not implemented in GNU Fortran::
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
|
|
|
|
@node Extensions implemented in GNU Fortran
|
|
|
|
@section Extensions implemented in GNU Fortran
|
|
|
|
@cindex extensions, implemented
|
2004-08-29 18:58:39 +02:00
|
|
|
|
2006-10-05 01:07:39 +02:00
|
|
|
GNU Fortran implements a number of extensions over standard
|
2010-09-24 08:39:20 +02:00
|
|
|
Fortran. This chapter contains information on their syntax and
|
2006-10-05 01:07:39 +02:00
|
|
|
meaning. There are currently two categories of GNU Fortran
|
2005-05-31 00:16:08 +02:00
|
|
|
extensions, those that provide functionality beyond that provided
|
2006-10-05 01:07:39 +02:00
|
|
|
by any standard, and those that are supported by GNU Fortran
|
2005-05-31 00:16:08 +02:00
|
|
|
purely for backward compatibility with legacy compilers. By default,
|
|
|
|
@option{-std=gnu} allows the compiler to accept both types of
|
|
|
|
extensions, but to warn about the use of the latter. Specifying
|
re PR fortran/33197 (Fortran 2008: math functions)
PR fortran/33197
gcc/fortran/
* intrinsic.c (add_functions): Modify intrinsics ACOSH, ASINH,
ATANH, ERF, ERFC and GAMMA. Add intrinsics BESSEL_{J,Y}{0,1,N},
ERFC_SCALED, LOG_GAMMA and HYPOT.
* intrinsic.h (gfc_check_hypot, gfc_simplify_hypot,
gfc_resolve_hypot): New prototypes.
* mathbuiltins.def: Add HYPOT builtin. Make complex versions of
ACOSH, ASINH and ATANH available.
* gfortran.h (GFC_ISYM_ERFC_SCALED, GFC_ISYM_HYPOT): New values.
* lang.opt: Add -std=f2008 option.
* libgfortran.h: Define GFC_STD_F2008.
* lang-specs.h: Add .f08 and .F08 file suffixes.
* iresolve.c (gfc_resolve_hypot): New function.
* parse.c (parse_contained): Allow empty CONTAINS for Fortran 2008.
* check.c (gfc_check_hypot): New function.
* trans-intrinsic.c (gfc_intrinsic_map): Define ERFC_SCALE builtin.
* options.c (set_default_std_flags): Allow Fortran 2008 by default.
(form_from_filename): Add .f08 suffix.
(gfc_handle_option): Handle -std=f2008 option.
* simplify.c (gfc_simplify_hypot): New function.
* gfortran.texi: Document Fortran 2008 status and file extensions.
* intrinsic.texi: Document new BESSEL_{J,Y}{0,1,N} intrinsics,
as well as HYPOT and ERFC_SCALED. Update documentation of ERF,
ERFC, GAMMA, LGAMMA, ASINH, ACOSH and ATANH.
* invoke.texi: Document the new -std=f2008 option.
libgomp/
* testsuite/libgomp.fortran/fortran.exp: Add .f08 and
.F08 file suffixes.
gcc/testsuite/
* gfortran.dg/gomp/gomp.exp: Add .f08 and .F08 file suffixes.
* gfortran.dg/dg.exp: Likewise.
* gfortran.dg/vect/vect.exp: Likewise.
* gfortran.fortran-torture/execute/execute.exp: Likewise.
* gfortran.fortran-torture/compile/compile.exp: Likewise.
* gfortran.dg/gamma_1.f90: Also check log_gamma.
* gfortran.dg/invalid_contains_1.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_2.f90: Add a few error messages.
* gfortran.dg/invalid_contains_2.f90: Remove warning about
empty CONTAINS.
* gfortran.dg/gamma_3.f90: Adjust error message.
* gfortran.dg/gamma_4.f90: Test for log_gamma instead of lgamma.
* gfortran.dg/bind_c_usage_9.f03: Adjust error messages.
* gfortran.dg/bessel_1.f90: New test.
* gfortran.dg/recursive_check_3.f90: Remove warnings.
* gfortran.dg/besxy.f90: Also check for new F2008 intrinsics.
* gfortran.dg/derived_function_interface_1.f90: Remove warning.
* gfortran.dg/contains_empty_1.f03: New test.
* gfortran.dg/erfc_scaled_1.f90: New test.
* gfortran.dg/hypot_1.f90: New test.
* gfortran.dg/contains_empty_2.f03: New test.
libgfortran/
* intrinsics/erfc_scaled_inc.c: New file.
* intrinsics/erfc_scaled.c: New file.
* gfortran.map (GFORTRAN_1.0): Add _gfortran_erfc_scaled_r*.
* Makefile.am: Add intrinsics/erfc_scaled.c.
* config.h.in: Regenerate.
* configure: Regenerate.
* Makefile.in: Regenerate.
From-SVN: r132846
2008-03-04 00:46:20 +01:00
|
|
|
either @option{-std=f95}, @option{-std=f2003} or @option{-std=f2008}
|
|
|
|
disables both types of extensions, and @option{-std=legacy} allows both
|
2016-10-25 17:13:43 +02:00
|
|
|
without warning. The special compile flag @option{-fdec} enables additional
|
|
|
|
compatibility extensions along with those enabled by @option{-std=legacy}.
|
2004-08-29 18:58:39 +02:00
|
|
|
|
|
|
|
@menu
|
|
|
|
* Old-style kind specifications::
|
|
|
|
* Old-style variable initialization::
|
2005-04-23 19:03:07 +02:00
|
|
|
* Extensions to namelist::
|
2007-01-04 02:02:40 +01:00
|
|
|
* X format descriptor without count field::
|
2005-05-23 05:20:19 +02:00
|
|
|
* Commas in FORMAT specifications::
|
2006-05-29 21:33:43 +02:00
|
|
|
* Missing period in FORMAT specifications::
|
2005-05-23 05:20:19 +02:00
|
|
|
* I/O item lists::
|
2011-05-03 03:23:46 +02:00
|
|
|
* @code{Q} exponent-letter::
|
2013-02-21 10:23:31 +01:00
|
|
|
* BOZ literal constants::
|
2005-05-23 05:20:19 +02:00
|
|
|
* Real array indices::
|
|
|
|
* Unary operators::
|
2007-01-04 02:02:40 +01:00
|
|
|
* Implicitly convert LOGICAL and INTEGER values::
|
2005-07-07 09:56:46 +02:00
|
|
|
* Hollerith constants support::
|
2005-10-24 21:28:18 +02:00
|
|
|
* Cray pointers::
|
2005-12-10 21:01:56 +01:00
|
|
|
* CONVERT specifier::
|
re PR fortran/25162 (Issue with OpenMP COPYIN and gfortran)
gcc/fortran/
2006-02-14 Jakub Jelinek <jakub@redhat.com>
Richard Henderson <rth@redhat.com>
Diego Novillo <dnovillo@redhat.com>
* invoke.texi: Document -fopenmp.
* gfortran.texi (Extensions): Document OpenMP.
Backport from gomp-20050608-branch
* trans-openmp.c: Call build_omp_clause instead of
make_node when creating OMP_CLAUSE_* trees.
(gfc_trans_omp_reduction_list): Remove argument 'code'.
Adjust all callers.
* trans.h (build4_v): Define.
* trans-openmp.c: Call build4_v to create OMP_PARALLEL nodes.
Call build3_v to create OMP_SECTIONS nodes.
PR fortran/25162
* openmp.c (gfc_match_omp_variable_list): Call gfc_set_sym_referenced
on all symbols added to the variable list.
* openmp.c (gfc_match_omp_clauses): Fix check for non-INTRINSIC
procedure symbol in REDUCTION.
* trans-openmp.c (gfc_trans_omp_array_reduction): Use gfc_add
for MINUS_EXPR OMP_CLAUSE_REDUCTION_CODE.
* trans-openmp.c (gfc_trans_omp_do): Add PBLOCK argument. If PBLOCK
is non-NULL, evaluate INIT/COND/INCR and chunk size expressions in
that statement block.
(gfc_trans_omp_parallel_do): Pass non-NULL PBLOCK to gfc_trans_omp_do
for non-ordered non-static combined loops.
(gfc_trans_omp_directive): Pass NULL PBLOCK to gfc_trans_omp_do.
* openmp.c: Include target.h and toplev.h.
(gfc_match_omp_threadprivate): Emit diagnostic if target does
not support TLS.
* Make-lang.in (fortran/openmp.o): Add dependencies on
target.h and toplev.h.
* trans-decl.c (gfc_get_fake_result_decl): Set GFC_DECL_RESULT.
* trans-openmp.c (gfc_omp_privatize_by_reference): Make
DECL_ARTIFICIAL vars predetermined shared except GFC_DECL_RESULT.
(gfc_omp_disregard_value_expr): Handle GFC_DECL_RESULT.
(gfc_trans_omp_variable): New function.
(gfc_trans_omp_variable_list, gfc_trans_omp_reduction_list): Use it.
* trans.h (GFC_DECL_RESULT): Define.
* trans-openmp.c (gfc_omp_firstprivatize_type_sizes): New function.
* f95-lang.c (LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES): Define.
* trans.h (gfc_omp_firstprivatize_type_sizes): New prototype.
* trans-openmp.c (gfc_omp_privatize_by_reference): Return
true if a pointer has GFC_DECL_SAVED_DESCRIPTOR set.
(gfc_trans_omp_array_reduction, gfc_trans_omp_reduction_list): New
functions.
(gfc_trans_omp_clauses): Add WHERE argument. Call
gfc_trans_omp_reduction_list rather than gfc_trans_omp_variable_list
for reductions.
(gfc_trans_omp_do, gfc_trans_omp_parallel, gfc_trans_omp_parallel_do,
gfc_trans_omp_parallel_sections, gfc_trans_omp_parallel_workshare,
gfc_trans_omp_sections, gfc_trans_omp_single): Adjust
gfc_trans_omp_clauses callers.
* openmp.c (omp_current_do_code): New var.
(gfc_resolve_omp_do_blocks): New function.
(gfc_resolve_omp_parallel_blocks): Call it.
(gfc_resolve_do_iterator): Add CODE argument. Don't propagate
predetermination if argument is !$omp do or !$omp parallel do
iteration variable.
* resolve.c (resolve_code): Call gfc_resolve_omp_do_blocks
for EXEC_OMP_DO. Adjust gfc_resolve_do_iterator caller.
* fortran.h (gfc_resolve_omp_do_blocks): New prototype.
(gfc_resolve_do_iterator): Add CODE argument.
* trans.h (gfc_omp_predetermined_sharing,
gfc_omp_disregard_value_expr, gfc_omp_private_debug_clause): New
prototypes.
(GFC_DECL_COMMON_OR_EQUIV, GFC_DECL_CRAY_POINTEE): Define.
* trans-openmp.c (gfc_omp_predetermined_sharing,
gfc_omp_disregard_value_expr, gfc_omp_private_debug_clause): New
functions.
* trans-common.c (build_equiv_decl, build_common_decl,
create_common): Set GFC_DECL_COMMON_OR_EQUIV flag on the decls.
* trans-decl.c (gfc_finish_cray_pointee): Set GFC_DECL_CRAY_POINTEE
on the decl.
* f95-lang.c (LANG_HOOKS_OMP_PREDETERMINED_SHARING,
LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR,
LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE): Define.
* openmp.c (resolve_omp_clauses): Remove extraneous comma.
* symbol.c (check_conflict): Add conflict between cray_pointee and
threadprivate.
* openmp.c (gfc_match_omp_threadprivate): Fail if
gfc_add_threadprivate returned FAILURE.
(resolve_omp_clauses): Diagnose Cray pointees in SHARED,
{,FIRST,LAST}PRIVATE and REDUCTION clauses and Cray pointers in
{FIRST,LAST}PRIVATE and REDUCTION clauses.
* resolve.c (omp_workshare_flag): New variable.
(resolve_function): Diagnose use of non-ELEMENTAL user defined
function in WORKSHARE construct.
(resolve_code): Cleanup forall_save use. Make sure omp_workshare_flag
is set to correct value in different contexts.
* openmp.c (resolve_omp_clauses): Replace %s with '%s' when printing
variable name.
(resolve_omp_atomic): Likewise.
PR fortran/24493
* scanner.c (skip_free_comments): Set at_bol at the beginning of the
loop, not before it.
(skip_fixed_comments): Handle ! comments in the middle of line here
as well.
(gfc_skip_comments): Use skip_fixed_comments for FIXED_FORM even if
not at BOL.
(gfc_next_char_literal): Fix expected canonicalized *$omp string.
* trans-openmp.c (gfc_trans_omp_do): Use make_node and explicit
initialization to build OMP_FOR instead of build.
* trans-decl.c (gfc_gimplify_function): Invoke
diagnose_omp_structured_block_errors.
* trans-openmp.c (gfc_trans_omp_master): Use OMP_MASTER.
(gfc_trans_omp_ordered): Use OMP_ORDERED.
* gfortran.h (gfc_resolve_do_iterator, gfc_resolve_blocks,
gfc_resolve_omp_parallel_blocks): New prototypes.
* resolve.c (resolve_blocks): Renamed to...
(gfc_resolve_blocks): ... this. Remove static.
(gfc_resolve_forall): Adjust caller.
(resolve_code): Only call gfc_resolve_blocks if code->block != 0
and not for EXEC_OMP_PARALLEL* directives. Call
gfc_resolve_omp_parallel_blocks for EXEC_OMP_PARALLEL* directives.
Call gfc_resolve_do_iterator if resolved successfully EXEC_DO
iterator.
* openmp.c: Include pointer-set.h.
(omp_current_ctx): New variable.
(gfc_resolve_omp_parallel_blocks, gfc_resolve_do_iterator): New
functions.
* Make-lang.in (fortran/openmp.o): Depend on pointer-set.h.
* openmp.c (gfc_match_omp_clauses): For max/min/iand/ior/ieor,
look up symbol if it exists, use its name instead and, if it is not
INTRINSIC, issue diagnostics.
* parse.c (parse_omp_do): Handle implied end do properly.
(parse_executable): If parse_omp_do returned ST_IMPLIED_ENDDO,
return it instead of continuing.
* trans-openmp.c (gfc_trans_omp_critical): Update for changed
operand numbering.
(gfc_trans_omp_do, gfc_trans_omp_parallel, gfc_trans_omp_parallel_do,
gfc_trans_omp_parallel_sections, gfc_trans_omp_parallel_workshare,
gfc_trans_omp_sections, gfc_trans_omp_single): Likewise.
* trans.h (gfc_omp_privatize_by_reference): New prototype.
* f95-lang.c (LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Redefine
to gfc_omp_privatize_by_reference.
* trans-openmp.c (gfc_omp_privatize_by_reference): New function.
* trans-stmt.h (gfc_trans_omp_directive): Add comment.
* openmp.c (gfc_match_omp_variable_list): Add ALLOW_COMMON argument.
Disallow COMMON matching if it is set.
(gfc_match_omp_clauses, gfc_match_omp_flush): Adjust all callers.
(resolve_omp_clauses): Show locus in error messages. Check that
variable types in reduction clauses are appropriate for reduction
operators.
* resolve.c (resolve_symbol): Don't error if a threadprivate module
variable isn't SAVEd.
* trans-openmp.c (gfc_trans_omp_do): Put count into BLOCK, not BODY.
Fix typo in condition. Fix DOVAR initialization.
* openmp.c (gfc_match_omp_clauses): Match min/iand/ior/ieor
rather than .min. etc.
* trans-openmpc.c (omp_not_yet): Remove.
(gfc_trans_omp_parallel_do): Keep listprivate clause on parallel.
Force creation of BIND_EXPR around the workshare construct.
(gfc_trans_omp_parallel_sections): Likewise.
(gfc_trans_omp_parallel_workshare): Likewise.
* types.def (BT_I16, BT_FN_I16_VPTR_I16,
BT_FN_BOOL_VPTR_I16_I16, BT_FN_I16_VPTR_I16_I16): Add.
* trans-openmp.c (gfc_trans_omp_clauses): Create OMP_CLAUSE_DEFAULT.
(gfc_trans_omp_code): New function.
(gfc_trans_omp_do): Use it, remove omp_not_yet uses.
(gfc_trans_omp_parallel, gfc_trans_omp_single): Likewise.
(gfc_trans_omp_sections): Likewise. Only treat empty last section
specially if lastprivate clause is present.
* f95-lang.c (gfc_init_builtin_functions): Create BUILT_IN_TRAP
builtin.
* trans-openmp.c (gfc_trans_omp_variable_list): Update for
OMP_CLAUSE_DECL name change.
(gfc_trans_omp_do): Likewise.
* trans-openmp.c (gfc_trans_omp_clauses): Create OMP_CLAUSE_REDUCTION
clauses.
(gfc_trans_omp_atomic): Build OMP_ATOMIC instead of expanding
sync builtins directly.
(gfc_trans_omp_single): Build OMP_SINGLE statement.
* trans-openmp.c (gfc_trans_add_clause): New.
(gfc_trans_omp_variable_list): Take a tree code and build the clause
node here. Link it to the head of a list.
(gfc_trans_omp_clauses): Update to match.
(gfc_trans_omp_do): Use gfc_trans_add_clause.
* trans-openmp.c (gfc_trans_omp_clauses): Change second argument to
gfc_omp_clauses *. Use gfc_evaluate_now instead of creating
temporaries by hand.
(gfc_trans_omp_atomic, gfc_trans_omp_critical): Use buildN_v macros.
(gfc_trans_omp_do): New function.
(gfc_trans_omp_master): Dont' check for gfc_trans_code returning NULL.
(gfc_trans_omp_parallel): Adjust gfc_trans_omp_clauses caller.
Use buildN_v macros.
(gfc_trans_omp_parallel_do, gfc_trans_omp_parallel_sections,
gfc_trans_omp_parallel_workshare, gfc_trans_omp_sections,
gfc_trans_omp_single, gfc_trans_omp_workshare): New functions.
(gfc_trans_omp_directive): Use them.
* parse.c (parse_omp_do): Allow new_st.op == EXEC_NOP.
* openmp.c (resolve_omp_clauses): Check for list items present
in multiple clauses.
(resolve_omp_do): Check that iteration variable is not THREADPRIVATE
and is not present in any clause variable lists other than PRIVATE
or LASTPRIVATE.
* gfortran.h (symbol_attribute): Add threadprivate bit.
(gfc_common_head): Add threadprivate member, change use_assoc
and saved into char to save space.
(gfc_add_threadprivate): New prototype.
* symbol.c (check_conflict): Handle threadprivate.
(gfc_add_threadprivate): New function.
(gfc_copy_attr): Copy threadprivate.
* trans-openmp.c (gfc_trans_omp_clauses): Avoid creating a temporary
if IF or NUM_THREADS is constant. Create OMP_CLAUSE_SCHEDULE and
OMP_CLAUSE_ORDERED.
* resolve.c (resolve_symbol): Complain if a THREADPRIVATE symbol
outside a module and not in COMMON has is not SAVEd.
(resolve_equivalence): Ensure THREADPRIVATE objects don't get
EQUIVALENCEd.
* trans-common.c: Include target.h and rtl.h.
(build_common_decl): Set DECL_TLS_MODEL if THREADPRIVATE.
* trans-decl.c: Include rtl.h.
(gfc_finish_var_decl): Set DECL_TLS_MODEL if THREADPRIVATE.
* dump-parse-tree.c (gfc_show_attr): Handle THREADPRIVATE.
* Make-lang.in (fortran/trans-decl.o): Depend on $(RTL_H).
(fortran/trans-common.o): Depend on $(RTL_H) and $(TARGET_H).
* openmp.c (gfc_match_omp_variable_list): Ensure COMMON block
is from current namespace.
(gfc_match_omp_threadprivate): Rewrite.
(resolve_omp_clauses): Check some clause restrictions.
* module.c (ab_attribute): Add AB_THREADPRIVATE.
(attr_bits): Add THREADPRIVATE.
(mio_symbol_attribute, mio_symbol_attribute): Handle threadprivate.
(load_commons, write_common, write_blank_common): Adjust for type
change of saved, store/load threadprivate bit from the integer
as well.
* types.def (BT_FN_UINT_UINT): New.
(BT_FN_VOID_UINT_UINT): Remove.
* trans-openmp.c (gfc_trans_omp_clauses, gfc_trans_omp_barrier,
gfc_trans_omp_critical, gfc_trans_omp_flush, gfc_trans_omp_master,
gfc_trans_omp_ordered, gfc_trans_omp_parallel): New functions.
(gfc_trans_omp_directive): Use them.
* openmp.c (expr_references_sym): Add SE argument, don't look
into SE tree.
(is_conversion): New function.
(resolve_omp_atomic): Adjust expr_references_sym callers. Handle
promoted expressions.
* trans-openmp.c (gfc_trans_omp_atomic): New function.
(gfc_trans_omp_directive): Call it.
* f95-lang.c (builtin_type_for_size): New function.
(gfc_init_builtin_functions): Initialize synchronization and
OpenMP builtins.
* types.def: New file.
* Make-lang.in (f95-lang.o): Depend on $(BUILTINS_DEF) and
fortran/types.def.
* trans-openmp.c: Rename GOMP_* tree codes into OMP_*.
* dump-parse-tree.c (show_symtree): Don't crash if ns->proc_name
is NULL.
* dump-parse-tree.c (gfc_show_namelist, gfc_show_omp_node): New
functions.
(gfc_show_code_node): Call gfc_show_omp_node for EXEC_OMP_* nodes.
* parse.c (parse_omp_do): Call pop_state before next_statement.
* openmp.c (expr_references_sym, resolve_omp_atomic, resolve_omp_do):
New functions.
(gfc_resolve_omp_directive): Call them.
* match.c (match_exit_cycle): Issue error if EXIT or CYCLE statement
leaves an OpenMP structured block or if EXIT terminates !$omp do
loop.
* Make-lang.in (F95_PARSER_OBJS): Add fortran/openmp.o.
(F95_OBJS): Add fortran/trans-openmp.o.
(fortran/trans-openmp.o): Depend on $(GFORTRAN_TRANS_DEPS).
* lang.opt: Add -fopenmp option.
* options.c (gfc_init_options): Initialize it.
(gfc_handle_option): Handle it.
* gfortran.h (ST_OMP_ATOMIC, ST_OMP_BARRIER, ST_OMP_CRITICAL,
ST_OMP_END_CRITICAL, ST_OMP_END_DO, ST_OMP_END_MASTER,
ST_OMP_END_ORDERED, ST_OMP_END_PARALLEL, ST_OMP_END_PARALLEL_DO,
ST_OMP_END_PARALLEL_SECTIONS, ST_OMP_END_PARALLEL_WORKSHARE,
ST_OMP_END_SECTIONS, ST_OMP_END_SINGLE, ST_OMP_END_WORKSHARE,
ST_OMP_DO, ST_OMP_FLUSH, ST_OMP_MASTER, ST_OMP_ORDERED,
ST_OMP_PARALLEL, ST_OMP_PARALLEL_DO, ST_OMP_PARALLEL_SECTIONS,
ST_OMP_PARALLEL_WORKSHARE, ST_OMP_SECTIONS, ST_OMP_SECTION,
ST_OMP_SINGLE, ST_OMP_THREADPRIVATE, ST_OMP_WORKSHARE): New
statement codes.
(OMP_LIST_PRIVATE, OMP_LIST_FIRSTPRIVATE, OMP_LIST_LASTPRIVATE,
OMP_LIST_COPYPRIVATE, OMP_LIST_SHARED, OMP_LIST_COPYIN,
OMP_LIST_PLUS, OMP_LIST_REDUCTION_FIRST, OMP_LIST_MULT,
OMP_LIST_SUB, OMP_LIST_AND, OMP_LIST_OR, OMP_LIST_EQV,
OMP_LIST_NEQV, OMP_LIST_MAX, OMP_LIST_MIN, OMP_LIST_IAND,
OMP_LIST_IOR, OMP_LIST_IEOR, OMP_LIST_REDUCTION_LAST, OMP_LIST_NUM):
New OpenMP variable list types.
(gfc_omp_clauses): New typedef.
(gfc_get_omp_clauses): Define.
(EXEC_OMP_CRITICAL, EXEC_OMP_DO, EXEC_OMP_FLUSH, EXEC_OMP_MASTER,
EXEC_OMP_ORDERED, EXEC_OMP_PARALLEL, EXEC_OMP_PARALLEL_DO,
EXEC_OMP_PARALLEL_SECTIONS, EXEC_OMP_PARALLEL_WORKSHARE,
EXEC_OMP_SECTIONS, EXEC_OMP_SINGLE, EXEC_OMP_WORKSHARE,
EXEC_OMP_ATOMIC, EXEC_OMP_BARRIER, EXEC_OMP_END_NOWAIT,
EXEC_OMP_END_SINGLE): New OpenMP gfc_exec_op codes.
(struct gfc_code): Add omp_clauses, omp_name, omp_namelist
and omp_bool fields to ext union.
(flag_openmp): Declare.
(gfc_free_omp_clauses, gfc_resolve_omp_directive): New prototypes.
* scanner.c (openmp_flag, openmp_locus): New variables.
(skip_free_comments, skip_fixed_comments, gfc_next_char_literal):
Handle OpenMP directive lines and conditional compilation magic
comments.
* parse.h (COMP_OMP_STRUCTURED_BLOCK): New compile state.
* parse.c (decode_omp_directive, parse_omp_do, parse_omp_atomic,
parse_omp_structured_block): New functions.
(next_free, next_fixed): Parse OpenMP directives.
(case_executable, case_exec_markers, case_decl): Add ST_OMP_*
codes.
(gfc_ascii_statement): Handle ST_OMP_* codes.
(parse_executable): Rearrange the loop slightly, so that
parse_omp_do can return next_statement.
* match.h (gfc_match_omp_eos, gfc_match_omp_atomic,
gfc_match_omp_barrier, gfc_match_omp_critical, gfc_match_omp_do,
gfc_match_omp_flush, gfc_match_omp_master, gfc_match_omp_ordered,
gfc_match_omp_parallel, gfc_match_omp_parallel_do,
gfc_match_omp_parallel_sections, gfc_match_omp_parallel_workshare,
gfc_match_omp_sections, gfc_match_omp_single,
gfc_match_omp_threadprivate, gfc_match_omp_workshare,
gfc_match_omp_end_nowait, gfc_match_omp_end_single): New prototypes.
* resolve.c (resolve_blocks): Ignore EXEC_OMP_* block directives.
(resolve_code): Call gfc_resolve_omp_directive on EXEC_OMP_*
directives.
* trans.c (gfc_trans_code): Call gfc_trans_omp_directive for
EXEC_OMP_* directives.
* st.c (gfc_free_statement): Handle EXEC_OMP_* statement freeing.
* trans-stmt.h (gfc_trans_omp_directive): New prototype.
* openmp.c: New file.
* trans-openmp.c: New file.
gcc/testsuite/
2006-02-14 Jakub Jelinek <jakub@redhat.com>
Diego Novillo <dnovillo@redhat.com>
Uros Bizjak <uros@kss-loka.si>
* gfortran.dg/gomp: New directory.
libgomp/
2006-02-14 Jakub Jelinek <jakub@redhat.com>
* testsuite/libgomp.fortran/vla7.f90: Add -w to options.
Remove tests for returning assumed character length arrays.
Co-Authored-By: Diego Novillo <dnovillo@redhat.com>
Co-Authored-By: Richard Henderson <rth@redhat.com>
Co-Authored-By: Uros Bizjak <uros@kss-loka.si>
From-SVN: r110984
2006-02-14 17:38:03 +01:00
|
|
|
* OpenMP::
|
Merge current set of OpenACC changes from gomp-4_0-branch.
contrib/
* gcc_update (files_and_dependencies): Update rules for new
libgomp/plugin/Makefrag.am and libgomp/plugin/configfrag.ac files.
gcc/
* builtin-types.def (BT_FN_VOID_INT_INT_VAR)
(BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR)
(BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR):
New function types.
* builtins.c: Include "gomp-constants.h".
(expand_builtin_acc_on_device): New function.
(expand_builtin, is_inexpensive_builtin): Handle
BUILT_IN_ACC_ON_DEVICE.
* builtins.def (DEF_GOACC_BUILTIN, DEF_GOACC_BUILTIN_COMPILER):
New macros.
* cgraph.c (cgraph_node::create): Consider flag_openacc next to
flag_openmp.
* config.gcc <nvptx-*> (tm_file): Add nvptx/offload.h.
<*-intelmic-* | *-intelmicemul-*> (tm_file): Add
i386/intelmic-offload.h.
* gcc.c (LINK_COMMAND_SPEC, GOMP_SELF_SPECS): For -fopenacc, link
to libgomp and its dependencies.
* config/arc/arc.h (LINK_COMMAND_SPEC): Likewise.
* config/darwin.h (LINK_COMMAND_SPEC_A): Likewise.
* config/i386/mingw32.h (GOMP_SELF_SPECS): Likewise.
* config/ia64/hpux.h (LIB_SPEC): Likewise.
* config/pa/pa-hpux11.h (LIB_SPEC): Likewise.
* config/pa/pa64-hpux.h (LIB_SPEC): Likewise.
* doc/generic.texi: Update for OpenACC changes.
* doc/gimple.texi: Likewise.
* doc/invoke.texi: Likewise.
* doc/sourcebuild.texi: Likewise.
* gimple-pretty-print.c (dump_gimple_omp_for): Handle
GF_OMP_FOR_KIND_OACC_LOOP.
(dump_gimple_omp_target): Handle GF_OMP_TARGET_KIND_OACC_KERNELS,
GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_DATA,
GF_OMP_TARGET_KIND_OACC_UPDATE,
GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA.
Dump more data.
* gimple.c: Update comments for OpenACC changes.
* gimple.def: Likewise.
* gimple.h: Likewise.
(enum gf_mask): Add GF_OMP_FOR_KIND_OACC_LOOP,
GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS,
GF_OMP_TARGET_KIND_OACC_DATA, GF_OMP_TARGET_KIND_OACC_UPDATE,
GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA.
(gimple_omp_for_cond, gimple_omp_for_set_cond): Sort in the
appropriate place.
(is_gimple_omp_oacc, is_gimple_omp_offloaded): New functions.
* gimplify.c: Include "gomp-constants.h".
Update comments for OpenACC changes.
(is_gimple_stmt): Handle OACC_PARALLEL, OACC_KERNELS, OACC_DATA,
OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE, OACC_ENTER_DATA,
OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP.
(gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle
OMP_CLAUSE__CACHE_, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT,
OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS,
OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER,
OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT,
OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_AUTO,
OMP_CLAUSE_SEQ.
(gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Use
GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use
OMP_CLAUSE_SET_MAP_KIND.
(gimplify_oacc_cache): New function.
(gimplify_omp_for): Handle OACC_LOOP.
(gimplify_omp_workshare): Handle OACC_KERNELS, OACC_PARALLEL,
OACC_DATA.
(gimplify_omp_target_update): Handle OACC_ENTER_DATA,
OACC_EXIT_DATA, OACC_UPDATE.
(gimplify_expr): Handle OACC_LOOP, OACC_CACHE, OACC_HOST_DATA,
OACC_DECLARE, OACC_KERNELS, OACC_PARALLEL, OACC_DATA,
OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE.
(gimplify_body): Consider flag_openacc next to flag_openmp.
* lto-streamer-out.c: Include "gomp-constants.h".
* omp-builtins.def (BUILT_IN_ACC_GET_DEVICE_TYPE)
(BUILT_IN_GOACC_DATA_START, BUILT_IN_GOACC_DATA_END)
(BUILT_IN_GOACC_ENTER_EXIT_DATA, BUILT_IN_GOACC_PARALLEL)
(BUILT_IN_GOACC_UPDATE, BUILT_IN_GOACC_WAIT)
(BUILT_IN_GOACC_GET_THREAD_NUM, BUILT_IN_GOACC_GET_NUM_THREADS)
(BUILT_IN_ACC_ON_DEVICE): New builtins.
* omp-low.c: Include "gomp-constants.h".
Update comments for OpenACC changes.
(struct omp_context): Add reduction_map, gwv_below, gwv_this
members.
(extract_omp_for_data, use_pointer_for_field, install_var_field)
(new_omp_context, delete_omp_context, scan_sharing_clauses)
(create_omp_child_function, scan_omp_for, scan_omp_target)
(check_omp_nesting_restrictions, lower_reduction_clauses)
(build_omp_regions_1, diagnose_sb_0, make_gimple_omp_edges):
Update for OpenACC changes.
(scan_sharing_clauses): Handle OMP_CLAUSE_NUM_GANGS:
OMP_CLAUSE_NUM_WORKERS: OMP_CLAUSE_VECTOR_LENGTH,
OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_GANG,
OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT,
OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_INDEPENDENT,
OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ. Use GOMP_MAP_* instead of
OMP_CLAUSE_MAP_*.
(expand_omp_for_static_nochunk, expand_omp_for_static_chunk):
Handle GF_OMP_FOR_KIND_OACC_LOOP.
(expand_omp_target, lower_omp_target): Handle
GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS,
GF_OMP_TARGET_KIND_OACC_UPDATE,
GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA,
GF_OMP_TARGET_KIND_OACC_DATA.
(pass_expand_omp::execute, execute_lower_omp)
(pass_diagnose_omp_blocks::gate): Consider flag_openacc next to
flag_openmp.
(offload_symbol_decl): New variable.
(oacc_get_reduction_array_id, oacc_max_threads)
(get_offload_symbol_decl, get_base_type, lookup_oacc_reduction)
(maybe_lookup_oacc_reduction, enclosing_target_ctx)
(oacc_loop_or_target_p, oacc_lower_reduction_var_helper)
(oacc_gimple_assign, oacc_initialize_reduction_data)
(oacc_finalize_reduction_data, oacc_process_reduction_data): New
functions.
(is_targetreg_ctx): Remove function.
* tree-core.h (enum omp_clause_code): Add OMP_CLAUSE__CACHE_,
OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE,
OMP_CLAUSE_GANG, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT,
OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT,
OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_NUM_GANGS,
OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH.
* tree.c (omp_clause_code_name, walk_tree_1): Update accordingly.
* tree.h (OMP_CLAUSE_GANG_EXPR, OMP_CLAUSE_GANG_STATIC_EXPR)
(OMP_CLAUSE_ASYNC_EXPR, OMP_CLAUSE_WAIT_EXPR)
(OMP_CLAUSE_VECTOR_EXPR, OMP_CLAUSE_WORKER_EXPR)
(OMP_CLAUSE_NUM_GANGS_EXPR, OMP_CLAUSE_NUM_WORKERS_EXPR)
(OMP_CLAUSE_VECTOR_LENGTH_EXPR): New macros.
* tree-core.h: Update comments for OpenACC changes.
(enum omp_clause_map_kind): Remove.
(struct tree_omp_clause): Change type of map_kind member from enum
omp_clause_map_kind to unsigned char.
* tree-inline.c: Update comments for OpenACC changes.
* tree-nested.c: Likewise. Include "gomp-constants.h".
(convert_nonlocal_reference_stmt, convert_local_reference_stmt)
(convert_tramp_reference_stmt, convert_gimple_call): Update for
OpenACC changes. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use
OMP_CLAUSE_SET_MAP_KIND.
* tree-pretty-print.c: Include "gomp-constants.h".
(dump_omp_clause): Handle OMP_CLAUSE_DEVICE_RESIDENT,
OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_GANG,
OMP_CLAUSE_ASYNC, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ,
OMP_CLAUSE_WAIT, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR,
OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS,
OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_INDEPENDENT. Use GOMP_MAP_*
instead of OMP_CLAUSE_MAP_*.
(dump_generic_node): Handle OACC_PARALLEL, OACC_KERNELS,
OACC_DATA, OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE,
OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP.
* tree-streamer-in.c: Include "gomp-constants.h".
(unpack_ts_omp_clause_value_fields) Use GOMP_MAP_* instead of
OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND.
* tree-streamer-out.c: Include "gomp-constants.h".
(pack_ts_omp_clause_value_fields): Use GOMP_MAP_* instead of
OMP_CLAUSE_MAP_*.
* tree.def (OACC_PARALLEL, OACC_KERNELS, OACC_DATA)
(OACC_HOST_DATA, OACC_LOOP, OACC_CACHE, OACC_DECLARE)
(OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE): New tree codes.
* tree.c (omp_clause_num_ops): Update accordingly.
* tree.h (OMP_BODY, OMP_CLAUSES, OMP_LOOP_CHECK, OMP_CLAUSE_SIZE):
Likewise.
(OACC_PARALLEL_BODY, OACC_PARALLEL_CLAUSES, OACC_KERNELS_BODY)
(OACC_KERNELS_CLAUSES, OACC_DATA_BODY, OACC_DATA_CLAUSES)
(OACC_HOST_DATA_BODY, OACC_HOST_DATA_CLAUSES, OACC_CACHE_CLAUSES)
(OACC_DECLARE_CLAUSES, OACC_ENTER_DATA_CLAUSES)
(OACC_EXIT_DATA_CLAUSES, OACC_UPDATE_CLAUSES)
(OACC_KERNELS_COMBINED, OACC_PARALLEL_COMBINED): New macros.
* tree.h (OMP_CLAUSE_MAP_KIND): Cast it to enum gomp_map_kind.
(OMP_CLAUSE_SET_MAP_KIND): New macro.
* varpool.c (varpool_node::get_create): Consider flag_openacc next
to flag_openmp.
* config/i386/intelmic-offload.h: New file.
* config/nvptx/offload.h: Likewise.
gcc/ada/
* gcc-interface/utils.c (DEF_FUNCTION_TYPE_VAR_8)
(DEF_FUNCTION_TYPE_VAR_12): New macros.
gcc/c-family/
* c.opt (fopenacc): New option.
* c-cppbuiltin.c (c_cpp_builtins): Conditionally define _OPENACC.
* c-common.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12):
New macros.
* c-common.h (c_finish_oacc_wait): New prototype.
* c-omp.c: Include "omp-low.h" and "gomp-constants.h".
(c_finish_oacc_wait): New function.
* c-pragma.c (oacc_pragmas): New variable.
(c_pp_lookup_pragma, init_pragma): Handle it.
* c-pragma.h (enum pragma_kind): Add PRAGMA_OACC_CACHE,
PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA,
PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP, PRAGMA_OACC_PARALLEL,
PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT.
(enum pragma_omp_clause): Add PRAGMA_OACC_CLAUSE_ASYNC,
PRAGMA_OACC_CLAUSE_AUTO, PRAGMA_OACC_CLAUSE_COLLAPSE,
PRAGMA_OACC_CLAUSE_COPY, PRAGMA_OACC_CLAUSE_COPYIN,
PRAGMA_OACC_CLAUSE_COPYOUT, PRAGMA_OACC_CLAUSE_CREATE,
PRAGMA_OACC_CLAUSE_DELETE, PRAGMA_OACC_CLAUSE_DEVICE,
PRAGMA_OACC_CLAUSE_DEVICEPTR, PRAGMA_OACC_CLAUSE_FIRSTPRIVATE,
PRAGMA_OACC_CLAUSE_GANG, PRAGMA_OACC_CLAUSE_HOST,
PRAGMA_OACC_CLAUSE_IF, PRAGMA_OACC_CLAUSE_NUM_GANGS,
PRAGMA_OACC_CLAUSE_NUM_WORKERS, PRAGMA_OACC_CLAUSE_PRESENT,
PRAGMA_OACC_CLAUSE_PRESENT_OR_COPY,
PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYIN,
PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYOUT,
PRAGMA_OACC_CLAUSE_PRESENT_OR_CREATE, PRAGMA_OACC_CLAUSE_PRIVATE,
PRAGMA_OACC_CLAUSE_REDUCTION, PRAGMA_OACC_CLAUSE_SELF,
PRAGMA_OACC_CLAUSE_SEQ, PRAGMA_OACC_CLAUSE_VECTOR,
PRAGMA_OACC_CLAUSE_VECTOR_LENGTH, PRAGMA_OACC_CLAUSE_WAIT,
PRAGMA_OACC_CLAUSE_WORKER.
gcc/c/
* c-parser.c: Include "gomp-constants.h".
(c_parser_omp_clause_map): Use enum gomp_map_kind instead of enum
omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*.
Use OMP_CLAUSE_SET_MAP_KIND.
(c_parser_pragma): Handle PRAGMA_OACC_ENTER_DATA,
PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_UPDATE.
(c_parser_omp_construct): Handle PRAGMA_OACC_CACHE,
PRAGMA_OACC_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP,
PRAGMA_OACC_PARALLEL, PRAGMA_OACC_WAIT.
(c_parser_omp_clause_name): Handle "auto", "async", "copy",
"copyout", "create", "delete", "deviceptr", "gang", "host",
"num_gangs", "num_workers", "present", "present_or_copy", "pcopy",
"present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout",
"present_or_create", "pcreate", "seq", "self", "vector",
"vector_length", "wait", "worker".
(OACC_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK)
(OACC_ENTER_DATA_CLAUSE_MASK, OACC_EXIT_DATA_CLAUSE_MASK)
(OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK)
(OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros.
(c_parser_omp_variable_list): Handle OMP_CLAUSE__CACHE_.
(c_parser_oacc_wait_list, c_parser_oacc_data_clause)
(c_parser_oacc_data_clause_deviceptr)
(c_parser_omp_clause_num_gangs, c_parser_omp_clause_num_workers)
(c_parser_oacc_clause_async, c_parser_oacc_clause_wait)
(c_parser_omp_clause_vector_length, c_parser_oacc_all_clauses)
(c_parser_oacc_cache, c_parser_oacc_data, c_parser_oacc_kernels)
(c_parser_oacc_enter_exit_data, c_parser_oacc_loop)
(c_parser_oacc_parallel, c_parser_oacc_update)
(c_parser_oacc_wait): New functions.
* c-tree.h (c_finish_oacc_parallel, c_finish_oacc_kernels)
(c_finish_oacc_data): New prototypes.
* c-typeck.c: Include "gomp-constants.h".
(handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use
GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use
OMP_CLAUSE_SET_MAP_KIND.
(c_finish_oacc_parallel, c_finish_oacc_kernels)
(c_finish_oacc_data): New functions.
(c_finish_omp_clauses): Handle OMP_CLAUSE__CACHE_,
OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS,
OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT,
OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_GANG,
OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, and OMP_CLAUSE_MAP's
GOMP_MAP_FORCE_DEVICEPTR.
gcc/cp/
* parser.c: Include "gomp-constants.h".
(cp_parser_omp_clause_map): Use enum gomp_map_kind instead of enum
omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*.
Use OMP_CLAUSE_SET_MAP_KIND.
(cp_parser_omp_construct, cp_parser_pragma): Handle
PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA,
PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_PARALLEL,
PRAGMA_OACC_LOOP, PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT.
(cp_parser_omp_clause_name): Handle "async", "copy", "copyout",
"create", "delete", "deviceptr", "host", "num_gangs",
"num_workers", "present", "present_or_copy", "pcopy",
"present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout",
"present_or_create", "pcreate", "vector_length", "wait".
(OACC_DATA_CLAUSE_MASK, OACC_ENTER_DATA_CLAUSE_MASK)
(OACC_EXIT_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK)
(OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK)
(OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros.
(cp_parser_omp_var_list_no_open): Handle OMP_CLAUSE__CACHE_.
(cp_parser_oacc_data_clause, cp_parser_oacc_data_clause_deviceptr)
(cp_parser_oacc_clause_vector_length, cp_parser_oacc_wait_list)
(cp_parser_oacc_clause_wait, cp_parser_omp_clause_num_gangs)
(cp_parser_omp_clause_num_workers, cp_parser_oacc_clause_async)
(cp_parser_oacc_all_clauses, cp_parser_oacc_cache)
(cp_parser_oacc_data, cp_parser_oacc_enter_exit_data)
(cp_parser_oacc_kernels, cp_parser_oacc_loop)
(cp_parser_oacc_parallel, cp_parser_oacc_update)
(cp_parser_oacc_wait): New functions.
* cp-tree.h (finish_oacc_data, finish_oacc_kernels)
(finish_oacc_parallel): New prototypes.
* semantics.c: Include "gomp-constants.h".
(handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use
GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use
OMP_CLAUSE_SET_MAP_KIND.
(finish_omp_clauses): Handle OMP_CLAUSE_ASYNC,
OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_WAIT, OMP_CLAUSE__CACHE_.
Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*.
(finish_oacc_data, finish_oacc_kernels, finish_oacc_parallel): New
functions.
gcc/fortran/
* lang.opt (fopenacc): New option.
* cpp.c (cpp_define_builtins): Conditionally define _OPENACC.
* dump-parse-tree.c (show_omp_node): Split part of it into...
(show_omp_clauses): ... this new function.
(show_omp_node, show_code_node): Handle EXEC_OACC_PARALLEL_LOOP,
EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS,
EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP,
EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE,
EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA.
(show_namespace): Update for OpenACC.
* f95-lang.c (DEF_FUNCTION_TYPE_VAR_2, DEF_FUNCTION_TYPE_VAR_8)
(DEF_FUNCTION_TYPE_VAR_12, DEF_GOACC_BUILTIN)
(DEF_GOACC_BUILTIN_COMPILER): New macros.
* types.def (BT_FN_VOID_INT_INT_VAR)
(BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR)
(BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR):
New function types.
* gfortran.h (gfc_statement): Add ST_OACC_PARALLEL_LOOP,
ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL,
ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_DATA,
ST_OACC_END_DATA, ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA,
ST_OACC_LOOP, ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE,
ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_KERNELS_LOOP,
ST_OACC_END_KERNELS_LOOP, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA,
ST_OACC_ROUTINE.
(struct gfc_expr_list): New data type.
(gfc_get_expr_list): New macro.
(gfc_omp_map_op): Add OMP_MAP_FORCE_ALLOC, OMP_MAP_FORCE_DEALLOC,
OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM, OMP_MAP_FORCE_TOFROM,
OMP_MAP_FORCE_PRESENT, OMP_MAP_FORCE_DEVICEPTR.
(OMP_LIST_FIRST, OMP_LIST_DEVICE_RESIDENT, OMP_LIST_USE_DEVICE)
(OMP_LIST_CACHE): New enumerators.
(struct gfc_omp_clauses): Add async_expr, gang_expr, worker_expr,
vector_expr, num_gangs_expr, num_workers_expr, vector_length_expr,
wait_list, tile_list, async, gang, worker, vector, seq,
independent, wait, par_auto, gang_static, and loc members.
(struct gfc_namespace): Add oacc_declare_clauses member.
(gfc_exec_op): Add EXEC_OACC_KERNELS_LOOP,
EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS,
EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP,
EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE,
EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA.
(gfc_free_expr_list, gfc_resolve_oacc_directive)
(gfc_resolve_oacc_declare, gfc_resolve_oacc_parallel_loop_blocks)
(gfc_resolve_oacc_blocks): New prototypes.
* match.c (match_exit_cycle): Handle EXEC_OACC_LOOP and
EXEC_OACC_PARALLEL_LOOP.
* match.h (gfc_match_oacc_cache, gfc_match_oacc_wait)
(gfc_match_oacc_update, gfc_match_oacc_declare)
(gfc_match_oacc_loop, gfc_match_oacc_host_data)
(gfc_match_oacc_data, gfc_match_oacc_kernels)
(gfc_match_oacc_kernels_loop, gfc_match_oacc_parallel)
(gfc_match_oacc_parallel_loop, gfc_match_oacc_enter_data)
(gfc_match_oacc_exit_data, gfc_match_oacc_routine): New
prototypes.
* openmp.c: Include "diagnostic.h" and "gomp-constants.h".
(gfc_free_omp_clauses): Update for members added to struct
gfc_omp_clauses.
(gfc_match_omp_clauses): Change mask paramter to uint64_t. Add
openacc parameter.
(resolve_omp_clauses): Add openacc parameter. Update for OpenACC.
(struct fortran_omp_context): Add is_openmp member.
(gfc_resolve_omp_parallel_blocks): Initialize it.
(gfc_resolve_do_iterator): Update for OpenACC.
(gfc_resolve_omp_directive): Call
resolve_omp_directive_inside_oacc_region.
(OMP_CLAUSE_PRIVATE, OMP_CLAUSE_FIRSTPRIVATE)
(OMP_CLAUSE_LASTPRIVATE, OMP_CLAUSE_COPYPRIVATE)
(OMP_CLAUSE_SHARED, OMP_CLAUSE_COPYIN, OMP_CLAUSE_REDUCTION)
(OMP_CLAUSE_IF, OMP_CLAUSE_NUM_THREADS, OMP_CLAUSE_SCHEDULE)
(OMP_CLAUSE_DEFAULT, OMP_CLAUSE_ORDERED, OMP_CLAUSE_COLLAPSE)
(OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE)
(OMP_CLAUSE_ALIGNED, OMP_CLAUSE_DEPEND, OMP_CLAUSE_INBRANCH)
(OMP_CLAUSE_LINEAR, OMP_CLAUSE_NOTINBRANCH, OMP_CLAUSE_PROC_BIND)
(OMP_CLAUSE_SAFELEN, OMP_CLAUSE_SIMDLEN, OMP_CLAUSE_UNIFORM)
(OMP_CLAUSE_DEVICE, OMP_CLAUSE_MAP, OMP_CLAUSE_TO)
(OMP_CLAUSE_FROM, OMP_CLAUSE_NUM_TEAMS, OMP_CLAUSE_THREAD_LIMIT)
(OMP_CLAUSE_DIST_SCHEDULE): Use uint64_t.
(OMP_CLAUSE_ASYNC, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS)
(OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_COPY, OMP_CLAUSE_COPYOUT)
(OMP_CLAUSE_CREATE, OMP_CLAUSE_PRESENT)
(OMP_CLAUSE_PRESENT_OR_COPY, OMP_CLAUSE_PRESENT_OR_COPYIN)
(OMP_CLAUSE_PRESENT_OR_COPYOUT, OMP_CLAUSE_PRESENT_OR_CREATE)
(OMP_CLAUSE_DEVICEPTR, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER)
(OMP_CLAUSE_VECTOR, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT)
(OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_DEVICE_RESIDENT)
(OMP_CLAUSE_HOST_SELF, OMP_CLAUSE_OACC_DEVICE, OMP_CLAUSE_WAIT)
(OMP_CLAUSE_DELETE, OMP_CLAUSE_AUTO, OMP_CLAUSE_TILE): New macros.
(gfc_match_omp_clauses): Handle those.
(OACC_PARALLEL_CLAUSES, OACC_KERNELS_CLAUSES, OACC_DATA_CLAUSES)
(OACC_LOOP_CLAUSES, OACC_PARALLEL_LOOP_CLAUSES)
(OACC_KERNELS_LOOP_CLAUSES, OACC_HOST_DATA_CLAUSES)
(OACC_DECLARE_CLAUSES, OACC_UPDATE_CLAUSES)
(OACC_ENTER_DATA_CLAUSES, OACC_EXIT_DATA_CLAUSES)
(OACC_WAIT_CLAUSES): New macros.
(gfc_free_expr_list, match_oacc_expr_list, match_oacc_clause_gang)
(gfc_match_omp_map_clause, gfc_match_oacc_parallel_loop)
(gfc_match_oacc_parallel, gfc_match_oacc_kernels_loop)
(gfc_match_oacc_kernels, gfc_match_oacc_data)
(gfc_match_oacc_host_data, gfc_match_oacc_loop)
(gfc_match_oacc_declare, gfc_match_oacc_update)
(gfc_match_oacc_enter_data, gfc_match_oacc_exit_data)
(gfc_match_oacc_wait, gfc_match_oacc_cache)
(gfc_match_oacc_routine, oacc_is_loop)
(resolve_oacc_scalar_int_expr, resolve_oacc_positive_int_expr)
(check_symbol_not_pointer, check_array_not_assumed)
(resolve_oacc_data_clauses, resolve_oacc_deviceptr_clause)
(oacc_compatible_clauses, oacc_is_parallel, oacc_is_kernels)
(omp_code_to_statement, oacc_code_to_statement)
(resolve_oacc_directive_inside_omp_region)
(resolve_omp_directive_inside_oacc_region)
(resolve_oacc_nested_loops, resolve_oacc_params_in_parallel)
(resolve_oacc_loop_blocks, gfc_resolve_oacc_blocks)
(resolve_oacc_loop, resolve_oacc_cache, gfc_resolve_oacc_declare)
(gfc_resolve_oacc_directive): New functions.
* parse.c (next_free): Update for OpenACC. Move some code into...
(verify_token_free): ... this new function.
(next_fixed): Update for OpenACC. Move some code into...
(verify_token_fixed): ... this new function.
(case_executable): Add ST_OACC_UPDATE, ST_OACC_WAIT,
ST_OACC_CACHE, ST_OACC_ENTER_DATA, and ST_OACC_EXIT_DATA.
(case_exec_markers): Add ST_OACC_PARALLEL_LOOP, ST_OACC_PARALLEL,
ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA, ST_OACC_LOOP,
ST_OACC_KERNELS_LOOP.
(case_decl): Add ST_OACC_ROUTINE.
(push_state, parse_critical_block, parse_progunit): Update for
OpenACC.
(gfc_ascii_statement): Handle ST_OACC_PARALLEL_LOOP,
ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL,
ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_KERNELS_LOOP,
ST_OACC_END_KERNELS_LOOP, ST_OACC_DATA, ST_OACC_END_DATA,
ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA, ST_OACC_LOOP,
ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE, ST_OACC_WAIT,
ST_OACC_CACHE, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA,
ST_OACC_ROUTINE.
(verify_st_order, parse_spec): Handle ST_OACC_DECLARE.
(parse_executable): Handle ST_OACC_PARALLEL_LOOP,
ST_OACC_KERNELS_LOOP, ST_OACC_LOOP, ST_OACC_PARALLEL,
ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA.
(decode_oacc_directive, parse_oacc_structured_block)
(parse_oacc_loop, is_oacc): New functions.
* parse.h (struct gfc_state_data): Add oacc_declare_clauses
member.
(is_oacc): New prototype.
* resolve.c (gfc_resolve_blocks, gfc_resolve_code): Handle
EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL,
EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA,
EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE,
EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA,
EXEC_OACC_EXIT_DATA.
(resolve_codes): Call gfc_resolve_oacc_declare.
* scanner.c (openacc_flag, openacc_locus): New variables.
(skip_free_comments): Update for OpenACC. Move some code into...
(skip_omp_attribute): ... this new function.
(skip_oacc_attribute): New function.
(skip_fixed_comments, gfc_next_char_literal): Update for OpenACC.
* st.c (gfc_free_statement): Handle EXEC_OACC_PARALLEL_LOOP,
EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS,
EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP,
EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE,
EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA.
* trans-decl.c (gfc_generate_function_code): Update for OpenACC.
* trans-openmp.c: Include "gomp-constants.h".
(gfc_omp_finish_clause, gfc_trans_omp_clauses): Use GOMP_MAP_*
instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND.
(gfc_trans_omp_clauses): Handle OMP_LIST_USE_DEVICE,
OMP_LIST_DEVICE_RESIDENT, OMP_LIST_CACHE, and OMP_MAP_FORCE_ALLOC,
OMP_MAP_FORCE_DEALLOC, OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM,
OMP_MAP_FORCE_TOFROM, OMP_MAP_FORCE_PRESENT,
OMP_MAP_FORCE_DEVICEPTR, and gfc_omp_clauses' async, seq,
independent, wait_list, num_gangs_expr, num_workers_expr,
vector_length_expr, vector, vector_expr, worker, worker_expr,
gang, gang_expr members.
(gfc_trans_omp_do): Handle EXEC_OACC_LOOP.
(gfc_convert_expr_to_tree, gfc_trans_oacc_construct)
(gfc_trans_oacc_executable_directive)
(gfc_trans_oacc_wait_directive, gfc_trans_oacc_combined_directive)
(gfc_trans_oacc_declare, gfc_trans_oacc_directive): New functions.
* trans-stmt.c (gfc_trans_block_construct): Update for OpenACC.
* trans-stmt.h (gfc_trans_oacc_directive, gfc_trans_oacc_declare):
New prototypes.
* trans.c (tranc_code): Handle EXEC_OACC_CACHE, EXEC_OACC_WAIT,
EXEC_OACC_UPDATE, EXEC_OACC_LOOP, EXEC_OACC_HOST_DATA,
EXEC_OACC_DATA, EXEC_OACC_KERNELS, EXEC_OACC_KERNELS_LOOP,
EXEC_OACC_PARALLEL, EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_ENTER_DATA,
EXEC_OACC_EXIT_DATA.
* gfortran.texi: Update for OpenACC.
* intrinsic.texi: Likewise.
* invoke.texi: Likewise.
gcc/lto/
* lto-lang.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12):
New macros.
* lto.c: Include "gomp-constants.h".
gcc/testsuite/
* lib/target-supports.exp (check_effective_target_fopenacc): New
procedure.
* g++.dg/goacc-gomp/goacc-gomp.exp: New file.
* g++.dg/goacc/goacc.exp: Likewise.
* gcc.dg/goacc-gomp/goacc-gomp.exp: Likewise.
* gcc.dg/goacc/goacc.exp: Likewise.
* gfortran.dg/goacc/goacc.exp: Likewise.
* c-c++-common/cpp/openacc-define-1.c: New file.
* c-c++-common/cpp/openacc-define-2.c: Likewise.
* c-c++-common/cpp/openacc-define-3.c: Likewise.
* c-c++-common/goacc-gomp/nesting-1.c: Likewise.
* c-c++-common/goacc-gomp/nesting-fail-1.c: Likewise.
* c-c++-common/goacc/acc_on_device-2-off.c: Likewise.
* c-c++-common/goacc/acc_on_device-2.c: Likewise.
* c-c++-common/goacc/asyncwait-1.c: Likewise.
* c-c++-common/goacc/cache-1.c: Likewise.
* c-c++-common/goacc/clauses-fail.c: Likewise.
* c-c++-common/goacc/collapse-1.c: Likewise.
* c-c++-common/goacc/data-1.c: Likewise.
* c-c++-common/goacc/data-2.c: Likewise.
* c-c++-common/goacc/data-clause-duplicate-1.c: Likewise.
* c-c++-common/goacc/deviceptr-1.c: Likewise.
* c-c++-common/goacc/deviceptr-2.c: Likewise.
* c-c++-common/goacc/deviceptr-3.c: Likewise.
* c-c++-common/goacc/if-clause-1.c: Likewise.
* c-c++-common/goacc/if-clause-2.c: Likewise.
* c-c++-common/goacc/kernels-1.c: Likewise.
* c-c++-common/goacc/loop-1.c: Likewise.
* c-c++-common/goacc/loop-private-1.c: Likewise.
* c-c++-common/goacc/nesting-1.c: Likewise.
* c-c++-common/goacc/nesting-data-1.c: Likewise.
* c-c++-common/goacc/nesting-fail-1.c: Likewise.
* c-c++-common/goacc/parallel-1.c: Likewise.
* c-c++-common/goacc/pcopy.c: Likewise.
* c-c++-common/goacc/pcopyin.c: Likewise.
* c-c++-common/goacc/pcopyout.c: Likewise.
* c-c++-common/goacc/pcreate.c: Likewise.
* c-c++-common/goacc/pragma_context.c: Likewise.
* c-c++-common/goacc/present-1.c: Likewise.
* c-c++-common/goacc/reduction-1.c: Likewise.
* c-c++-common/goacc/reduction-2.c: Likewise.
* c-c++-common/goacc/reduction-3.c: Likewise.
* c-c++-common/goacc/reduction-4.c: Likewise.
* c-c++-common/goacc/sb-1.c: Likewise.
* c-c++-common/goacc/sb-2.c: Likewise.
* c-c++-common/goacc/sb-3.c: Likewise.
* c-c++-common/goacc/update-1.c: Likewise.
* gcc.dg/goacc/acc_on_device-1.c: Likewise.
* gfortran.dg/goacc/acc_on_device-1.f95: Likewise.
* gfortran.dg/goacc/acc_on_device-2-off.f95: Likewise.
* gfortran.dg/goacc/acc_on_device-2.f95: Likewise.
* gfortran.dg/goacc/assumed.f95: Likewise.
* gfortran.dg/goacc/asyncwait-1.f95: Likewise.
* gfortran.dg/goacc/asyncwait-2.f95: Likewise.
* gfortran.dg/goacc/asyncwait-3.f95: Likewise.
* gfortran.dg/goacc/asyncwait-4.f95: Likewise.
* gfortran.dg/goacc/branch.f95: Likewise.
* gfortran.dg/goacc/cache-1.f95: Likewise.
* gfortran.dg/goacc/coarray.f95: Likewise.
* gfortran.dg/goacc/continuation-free-form.f95: Likewise.
* gfortran.dg/goacc/cray.f95: Likewise.
* gfortran.dg/goacc/critical.f95: Likewise.
* gfortran.dg/goacc/data-clauses.f95: Likewise.
* gfortran.dg/goacc/data-tree.f95: Likewise.
* gfortran.dg/goacc/declare-1.f95: Likewise.
* gfortran.dg/goacc/enter-exit-data.f95: Likewise.
* gfortran.dg/goacc/fixed-1.f: Likewise.
* gfortran.dg/goacc/fixed-2.f: Likewise.
* gfortran.dg/goacc/fixed-3.f: Likewise.
* gfortran.dg/goacc/fixed-4.f: Likewise.
* gfortran.dg/goacc/host_data-tree.f95: Likewise.
* gfortran.dg/goacc/if.f95: Likewise.
* gfortran.dg/goacc/kernels-tree.f95: Likewise.
* gfortran.dg/goacc/list.f95: Likewise.
* gfortran.dg/goacc/literal.f95: Likewise.
* gfortran.dg/goacc/loop-1.f95: Likewise.
* gfortran.dg/goacc/loop-2.f95: Likewise.
* gfortran.dg/goacc/loop-3.f95: Likewise.
* gfortran.dg/goacc/loop-tree-1.f90: Likewise.
* gfortran.dg/goacc/omp.f95: Likewise.
* gfortran.dg/goacc/parallel-kernels-clauses.f95: Likewise.
* gfortran.dg/goacc/parallel-kernels-regions.f95: Likewise.
* gfortran.dg/goacc/parallel-tree.f95: Likewise.
* gfortran.dg/goacc/parameter.f95: Likewise.
* gfortran.dg/goacc/private-1.f95: Likewise.
* gfortran.dg/goacc/private-2.f95: Likewise.
* gfortran.dg/goacc/private-3.f95: Likewise.
* gfortran.dg/goacc/pure-elemental-procedures.f95: Likewise.
* gfortran.dg/goacc/reduction-2.f95: Likewise.
* gfortran.dg/goacc/reduction.f95: Likewise.
* gfortran.dg/goacc/routine-1.f90: Likewise.
* gfortran.dg/goacc/routine-2.f90: Likewise.
* gfortran.dg/goacc/sentinel-free-form.f95: Likewise.
* gfortran.dg/goacc/several-directives.f95: Likewise.
* gfortran.dg/goacc/sie.f95: Likewise.
* gfortran.dg/goacc/subarrays.f95: Likewise.
* gfortran.dg/gomp/map-1.f90: Likewise.
* gfortran.dg/openacc-define-1.f90: Likewise.
* gfortran.dg/openacc-define-2.f90: Likewise.
* gfortran.dg/openacc-define-3.f90: Likewise.
* g++.dg/gomp/block-1.C: Update for changed compiler output.
* g++.dg/gomp/block-2.C: Likewise.
* g++.dg/gomp/block-3.C: Likewise.
* g++.dg/gomp/block-5.C: Likewise.
* g++.dg/gomp/target-1.C: Likewise.
* g++.dg/gomp/target-2.C: Likewise.
* g++.dg/gomp/taskgroup-1.C: Likewise.
* g++.dg/gomp/teams-1.C: Likewise.
* gcc.dg/cilk-plus/jump-openmp.c: Likewise.
* gcc.dg/cilk-plus/jump.c: Likewise.
* gcc.dg/gomp/block-1.c: Likewise.
* gcc.dg/gomp/block-10.c: Likewise.
* gcc.dg/gomp/block-2.c: Likewise.
* gcc.dg/gomp/block-3.c: Likewise.
* gcc.dg/gomp/block-4.c: Likewise.
* gcc.dg/gomp/block-5.c: Likewise.
* gcc.dg/gomp/block-6.c: Likewise.
* gcc.dg/gomp/block-7.c: Likewise.
* gcc.dg/gomp/block-8.c: Likewise.
* gcc.dg/gomp/block-9.c: Likewise.
* gcc.dg/gomp/target-1.c: Likewise.
* gcc.dg/gomp/target-2.c: Likewise.
* gcc.dg/gomp/taskgroup-1.c: Likewise.
* gcc.dg/gomp/teams-1.c: Likewise.
include/
* gomp-constants.h: New file.
libgomp/
* Makefile.am (search_path): Add $(top_srcdir)/../include.
(libgomp_la_SOURCES): Add splay-tree.c, libgomp-plugin.c,
oacc-parallel.c, oacc-host.c, oacc-init.c, oacc-mem.c,
oacc-async.c, oacc-plugin.c, oacc-cuda.c.
[USE_FORTRAN] (libgomp_la_SOURCES): Add openacc.f90.
Include $(top_srcdir)/plugin/Makefrag.am.
(nodist_libsubinclude_HEADERS): Add openacc.h.
[USE_FORTRAN] (nodist_finclude_HEADERS): Add openacc_lib.h,
openacc.f90, openacc.mod, openacc_kinds.mod.
(omp_lib.mod): Generalize into...
(%.mod): ... this new rule.
(openacc_kinds.mod, openacc.mod): New rules.
* plugin/configfrag.ac: New file.
* configure.ac: Move plugin/offloading support into it. Include
it. Instantiate testsuite/libgomp-test-support.pt.exp.
* plugin/Makefrag.am: New file.
* testsuite/Makefile.am (OFFLOAD_TARGETS)
(OFFLOAD_ADDITIONAL_OPTIONS, OFFLOAD_ADDITIONAL_LIB_PATHS): Don't
export.
(libgomp-test-support.exp): New rule.
(all-local): Depend on it.
* Makefile.in: Regenerate.
* testsuite/Makefile.in: Regenerate.
* config.h.in: Likewise.
* configure: Likewise.
* configure.tgt: Harden shell syntax.
* env.c: Include "oacc-int.h".
(parse_acc_device_type): New function.
(gomp_debug_var, goacc_device_type, goacc_device_num): New
variables.
(initialize_env): Initialize those. Call
goacc_runtime_initialize.
* error.c (gomp_vdebug, gomp_debug, gomp_vfatal): New functions.
(gomp_fatal): Call gomp_vfatal.
* libgomp.h: Include "libgomp-plugin.h" and <stdarg.h>.
(gomp_debug_var, goacc_device_type, goacc_device_num, gomp_vdebug)
(gomp_debug, gomp_verror, gomp_vfatal, gomp_init_targets_once)
(splay_tree_node, splay_tree, splay_tree_key)
(struct target_mem_desc, struct splay_tree_key_s)
(struct gomp_memory_mapping, struct acc_dispatch_t)
(struct gomp_device_descr, gomp_acc_insert_pointer)
(gomp_acc_remove_pointer, target_mem_desc, gomp_copy_from_async)
(gomp_unmap_vars, gomp_init_device, gomp_init_tables)
(gomp_free_memmap, gomp_fini_device): New declarations.
(gomp_vdebug, gomp_debug): New macros.
Include "splay-tree.h".
* libgomp.map (OACC_2.0): New symbol version. Use for
acc_get_num_devices, acc_get_num_devices_h_, acc_set_device_type,
acc_set_device_type_h_, acc_get_device_type,
acc_get_device_type_h_, acc_set_device_num, acc_set_device_num_h_,
acc_get_device_num, acc_get_device_num_h_, acc_async_test,
acc_async_test_h_, acc_async_test_all, acc_async_test_all_h_,
acc_wait, acc_wait_h_, acc_wait_async, acc_wait_async_h_,
acc_wait_all, acc_wait_all_h_, acc_wait_all_async,
acc_wait_all_async_h_, acc_init, acc_init_h_, acc_shutdown,
acc_shutdown_h_, acc_on_device, acc_on_device_h_, acc_malloc,
acc_free, acc_copyin, acc_copyin_32_h_, acc_copyin_64_h_,
acc_copyin_array_h_, acc_present_or_copyin,
acc_present_or_copyin_32_h_, acc_present_or_copyin_64_h_,
acc_present_or_copyin_array_h_, acc_create, acc_create_32_h_,
acc_create_64_h_, acc_create_array_h_, acc_present_or_create,
acc_present_or_create_32_h_, acc_present_or_create_64_h_,
acc_present_or_create_array_h_, acc_copyout, acc_copyout_32_h_,
acc_copyout_64_h_, acc_copyout_array_h_, acc_delete,
acc_delete_32_h_, acc_delete_64_h_, acc_delete_array_h_,
acc_update_device, acc_update_device_32_h_,
acc_update_device_64_h_, acc_update_device_array_h_,
acc_update_self, acc_update_self_32_h_, acc_update_self_64_h_,
acc_update_self_array_h_, acc_map_data, acc_unmap_data,
acc_deviceptr, acc_hostptr, acc_is_present, acc_is_present_32_h_,
acc_is_present_64_h_, acc_is_present_array_h_,
acc_memcpy_to_device, acc_memcpy_from_device,
acc_get_current_cuda_device, acc_get_current_cuda_context,
acc_get_cuda_stream, acc_set_cuda_stream.
(GOACC_2.0): New symbol version. Use for GOACC_data_end,
GOACC_data_start, GOACC_enter_exit_data, GOACC_parallel,
GOACC_update, GOACC_wait, GOACC_get_thread_num,
GOACC_get_num_threads.
(GOMP_PLUGIN_1.0): New symbol version. Use for
GOMP_PLUGIN_malloc, GOMP_PLUGIN_malloc_cleared,
GOMP_PLUGIN_realloc, GOMP_PLUGIN_debug, GOMP_PLUGIN_error,
GOMP_PLUGIN_fatal, GOMP_PLUGIN_async_unmap_vars,
GOMP_PLUGIN_acc_thread.
* libgomp.texi: Update for OpenACC changes, and GOMP_DEBUG
environment variable.
* libgomp_g.h (GOACC_data_start, GOACC_data_end)
(GOACC_enter_exit_data, GOACC_parallel, GOACC_update, GOACC_wait)
(GOACC_get_num_threads, GOACC_get_thread_num): New declarations.
* splay-tree.h (splay_tree_lookup, splay_tree_insert)
(splay_tree_remove): New declarations.
(rotate_left, rotate_right, splay_tree_splay, splay_tree_insert)
(splay_tree_remove, splay_tree_lookup): Move into...
* splay-tree.c: ... this new file.
* target.c: Include "oacc-plugin.h", "oacc-int.h", <assert.h>.
(splay_tree_node, splay_tree, splay_tree_key)
(struct target_mem_desc, struct splay_tree_key_s)
(struct gomp_device_descr): Don't declare.
(num_devices_openmp): New variable.
(gomp_get_num_devices ): Use it.
(gomp_init_targets_once): New function.
(gomp_get_num_devices ): Use it.
(get_kind, gomp_copy_from_async, gomp_free_memmap)
(gomp_fini_device, gomp_register_image_for_device): New functions.
(gomp_map_vars): Add devaddrs parameter.
(gomp_update): Add mm parameter.
(gomp_init_device): Move most of it into...
(gomp_init_tables): ... this new function.
(gomp_register_images_for_device): Remove function.
(splay_compare, gomp_map_vars, gomp_unmap_vars, gomp_init_device):
Make them hidden instead of static.
(gomp_map_vars_existing, gomp_map_vars, gomp_unmap_vars)
(gomp_update, gomp_init_device, GOMP_target, GOMP_target_data)
(GOMP_target_end_data, GOMP_target_update)
(gomp_load_plugin_for_device, gomp_target_init): Update for
OpenACC changes.
* oacc-async.c: New file.
* oacc-cuda.c: Likewise.
* oacc-host.c: Likewise.
* oacc-init.c: Likewise.
* oacc-int.h: Likewise.
* oacc-mem.c: Likewise.
* oacc-parallel.c: Likewise.
* oacc-plugin.c: Likewise.
* oacc-plugin.h: Likewise.
* oacc-ptx.h: Likewise.
* openacc.f90: Likewise.
* openacc.h: Likewise.
* openacc_lib.h: Likewise.
* plugin/plugin-host.c: Likewise.
* plugin/plugin-nvptx.c: Likewise.
* libgomp-plugin.c: Likewise.
* libgomp-plugin.h: Likewise.
* libgomp_target.h: Remove file after merging content into the
former file. Update all users.
* testsuite/lib/libgomp.exp: Load libgomp-test-support.exp.
(offload_targets_s, offload_targets_s_openacc): New variables.
(check_effective_target_openacc_nvidia_accel_present)
(check_effective_target_openacc_nvidia_accel_selected): New
procedures.
(libgomp_init): Update for OpenACC changes.
* testsuite/libgomp-test-support.exp.in: New file.
* testsuite/libgomp.oacc-c++/c++.exp: Likewise.
* testsuite/libgomp.oacc-c/c.exp: Likewise.
* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
* testsuite/libgomp.oacc-c-c++-common/abort-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/abort-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/abort-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/abort-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/asyncwait-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/cache-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/clauses-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/clauses-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/collapse-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/collapse-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/collapse-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/collapse-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/context-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/context-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/context-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/context-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-5.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-6.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-7.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-8.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/deviceptr-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/if-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-empty.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-10.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-11.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-12.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-13.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-14.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-15.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-16.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-17.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-18.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-19.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-20.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-21.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-22.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-23.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-24.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-25.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-26.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-27.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-28.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-29.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-30.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-31.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-32.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-33.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-34.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-35.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-36.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-37.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-38.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-39.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-40.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-41.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-42.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-43.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-44.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-45.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-46.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-47.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-48.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-49.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-5.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-50.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-51.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-52.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-53.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-54.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-55.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-56.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-57.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-58.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-59.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-6.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-60.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-61.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-62.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-63.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-64.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-65.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-66.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-67.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-68.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-69.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-7.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-70.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-71.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-72.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-73.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-74.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-75.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-76.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-77.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-78.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-79.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-80.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-81.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-82.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-83.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-84.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-85.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-86.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-87.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-88.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-89.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-9.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-90.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-91.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-92.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/nested-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/nested-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/offset-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/parallel-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/parallel-empty.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/pointer-align-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/present-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/present-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-initial-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/subr.h: Likewise.
* testsuite/libgomp.oacc-c-c++-common/subr.ptx: Likewise.
* testsuite/libgomp.oacc-c-c++-common/timer.h: Likewise.
* testsuite/libgomp.oacc-c-c++-common/update-1-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/update-1.c: Likewise.
* testsuite/libgomp.oacc-fortran/abort-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/abort-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f: Likewise.
* testsuite/libgomp.oacc-fortran/asyncwait-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/asyncwait-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/asyncwait-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-4.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-5.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-6.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-7.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-8.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-4-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-4.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-1.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-3.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-4.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-5.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-6.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-7.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-8.f: Likewise.
* testsuite/libgomp.oacc-fortran/lib-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-10.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/lib-3.f: Likewise.
* testsuite/libgomp.oacc-fortran/lib-4.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-5.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-6.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-7.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-8.f90: Likewise.
* testsuite/libgomp.oacc-fortran/map-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/openacc_version-1.f: Likewise.
* testsuite/libgomp.oacc-fortran/openacc_version-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/pointer-align-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/pset-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-4.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-5.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-6.f90: Likewise.
* testsuite/libgomp.oacc-fortran/routine-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/routine-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/routine-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/routine-4.f90: Likewise.
* testsuite/libgomp.oacc-fortran/subarrays-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/subarrays-2.f90: Likewise.
liboffloadmic/
* plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_get_name)
(GOMP_OFFLOAD_get_caps, GOMP_OFFLOAD_fini_device): New functions.
Co-Authored-By: Bernd Schmidt <bernds@codesourcery.com>
Co-Authored-By: Cesar Philippidis <cesar@codesourcery.com>
Co-Authored-By: Dmitry Bocharnikov <dmitry.b@samsung.com>
Co-Authored-By: Evgeny Gavrin <e.gavrin@samsung.com>
Co-Authored-By: Ilmir Usmanov <i.usmanov@samsung.com>
Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
Co-Authored-By: James Norris <jnorris@codesourcery.com>
Co-Authored-By: Julian Brown <julian@codesourcery.com>
Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
Co-Authored-By: Tobias Burnus <burnus@net-b.de>
Co-Authored-By: Tom de Vries <tom@codesourcery.com>
From-SVN: r219682
2015-01-15 21:11:12 +01:00
|
|
|
* OpenACC::
|
2007-03-31 18:42:58 +02:00
|
|
|
* Argument list functions::
|
2015-03-22 22:37:13 +01:00
|
|
|
* Read/Write after EOF marker::
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
* STRUCTURE and RECORD::
|
|
|
|
* UNION and MAP::
|
2016-08-03 16:55:26 +02:00
|
|
|
* Type variants for integer intrinsics::
|
lang.opt, [...]: New flag -fdec-static.
2016-09-23 Fritz Reese <fritzoreese@gmail.com>
gcc/fortran/
* lang.opt, invoke.texi, gfortran.texi: New flag -fdec-static.
* options.c (set_dec_flags): Set -fdec-static with -fdec.
* gfortran.h (symbol_attribute): New attribute automatic.
* gfortran.h (gfc_add_automatic): New prototype.
* match.h (gfc_match_automatic, gfc_match_static): New functions.
* decl.c (gfc_match_automatic, gfc_match_static): Ditto.
* symbol.c (gfc_add_automatic): Ditto.
* decl.c (match_attr_spec): Match AUTOMATIC and STATIC decls.
* parse.c (decode_specification_statement, decode_statement): Ditto.
* resolve.c (apply_default_init_local, resolve_fl_variable_derived,
resolve_symbol): Support for automatic attribute.
* symbol.c (check_conflict, gfc_copy_attr, gfc_is_var_automatic):
Ditto.
* trans-decl.c (gfc_finish_var_decl): Ditto.
gcc/testsuite/gfortran.dg/
* dec_static_1.f90, dec_static_2.f90, dec_static_3.f90,
dec_static_4.f90: New testcases.
From-SVN: r240458
2016-09-23 23:06:18 +02:00
|
|
|
* AUTOMATIC and STATIC attributes::
|
New flag -fdec-math for COTAN and degree trig intrinsics.
2016-10-11 Fritz Reese <fritzoreese@gmail.com>
New flag -fdec-math for COTAN and degree trig intrinsics.
gcc/fortran/
* lang.opt: New flag -fdec-math.
* options.c (set_dec_flags): Enable with -fdec.
* invoke.texi, gfortran.texi, intrinsic.texi: Update documentation.
* intrinsics.c (add_functions, do_simplify): New intrinsics
with -fdec-math.
* gfortran.h (gfc_isym_id): New isym GFC_ISYM_COTAN.
* gfortran.h (gfc_resolve_atan2d, gfc_resolve_cotan,
gfc_resolve_trigd, gfc_resolve_atrigd): New prototypes.
* iresolve.c (resolve_trig_call, get_degrees, get_radians,
is_trig_resolved, gfc_resolve_cotan, gfc_resolve_trigd,
gfc_resolve_atrigd, gfc_resolve_atan2d): New functions.
* intrinsics.h (gfc_simplify_atan2d, gfc_simplify_atrigd,
gfc_simplify_cotan, gfc_simplify_trigd): New prototypes.
* simplify.c (simplify_trig_call, degrees_f, radians_f,
gfc_simplify_cotan, gfc_simplify_trigd, gfc_simplify_atrigd,
gfc_simplify_atan2d): New functions.
gcc/testsuite/gfortran.dg/
* dec_math.f90: New testsuite.
From-SVN: r240989
2016-10-11 13:21:07 +02:00
|
|
|
* Extended math intrinsics::
|
2016-10-25 17:20:36 +02:00
|
|
|
* Form feed as whitespace::
|
2016-10-25 17:24:36 +02:00
|
|
|
* TYPE as an alias for PRINT::
|
2016-10-25 17:27:39 +02:00
|
|
|
* %LOC as an rvalue::
|
2016-10-25 17:30:51 +02:00
|
|
|
* .XOR. operator::
|
2016-10-25 20:27:51 +02:00
|
|
|
* Bitwise logical operators::
|
New I/O specifiers CARRIAGECONTROL, READONLY, SHARE with -fdec.
gcc/fortran/
* gfortran.texi: Document.
* frontend-passes.c (gfc_code_walker): Add SHARE and CARRIAGECONTROL.
* io.c (gfc_free_open, gfc_resolve_open, gfc_match_open): Ditto.
* gfortran.h (gfc_open): Add SHARE, CARRIAGECONTROL, and READONLY.
* io.c (io_tag, match_open_element): Ditto.
* ioparm.def: Ditto.
* trans-io.c (gfc_trans_open): Ditto.
* io.c (match_dec_etag, match_dec_ftag): New functions.
libgfortran/io/
* libgfortran.h (IOPARM_OPEN_HAS_READONLY, IOPARM_OPEN_HAS_SHARE,
IOPARM_OPEN_HAS_CC): New for READONLY, SHARE, and CARRIAGECONTROL.
* close.c (st_close): Support READONLY.
* io.h (st_parameter_open, unit_flags): Support SHARE, CARRIAGECONTROL,
and READONLY.
* open.c (st_open): Ditto.
* transfer.c (data_transfer_init): Ditto.
* io.h (st_parameter_dt): New member 'cc' for CARRIAGECONTROL.
* write.c (write_check_cc, write_cc): New functions for CARRIAGECONTROL.
* transfer.c (next_record_cc): Ditto.
* file_pos.c (st_endfile): Support SHARE and CARRIAGECONTROL.
* io.h (st_parameter_inquire): Ditto.
* open.c (edit_modes, new_unit): Ditto.
* inquire.c (inquire_via_unit, inquire_via_filename): Ditto.
* io.h (unit_share, unit_cc, cc_fortran, IOPARM_INQUIRE_HAS_SHARE,
IOPARM_INQUIRE_HAS_CC): New for SHARE and CARRIAGECONTROL.
* open.c (share_opt, cc_opt): Ditto.
* read.c (read_x): Support CARRIAGECONTROL.
* transfer.c (read_sf, next_record_r, next_record_w): Ditto.
* write.c (list_formatted_write_scalar, write_a): Ditto.
* unix.h (close_share): New prototype.
* unix.c (open_share, close_share): New functions to handle SHARE.
* unix.c (open_external): Handle READONLY. Call open_share.
* close.c (st_close): Call close_share.
gcc/testsuite/
* dec_io_1.f90: New test.
* dec_io_2.f90: New test.
* dec_io_3.f90: New test.
* dec_io_4.f90: New test.
* dec_io_5.f90: New test.
* dec_io_6.f90: New test.
From-SVN: r241550
2016-10-26 14:11:44 +02:00
|
|
|
* Extended I/O specifiers::
|
2016-11-03 17:00:58 +01:00
|
|
|
* Legacy PARAMETER statements::
|
2016-11-03 19:09:44 +01:00
|
|
|
* Default exponents::
|
2004-08-29 18:58:39 +02:00
|
|
|
@end menu
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2004-08-29 18:58:39 +02:00
|
|
|
@node Old-style kind specifications
|
2008-02-16 15:10:12 +01:00
|
|
|
@subsection Old-style kind specifications
|
2007-04-29 12:49:08 +02:00
|
|
|
@cindex kind, old-style
|
2004-08-29 18:58:39 +02:00
|
|
|
|
2010-09-24 08:39:20 +02:00
|
|
|
GNU Fortran allows old-style kind specifications in declarations. These
|
2007-02-22 22:03:05 +01:00
|
|
|
look like:
|
2004-08-29 18:58:39 +02:00
|
|
|
@smallexample
|
2007-02-22 22:03:05 +01:00
|
|
|
TYPESPEC*size x,y,z
|
2004-08-29 18:58:39 +02:00
|
|
|
@end smallexample
|
2007-03-06 09:00:02 +01:00
|
|
|
@noindent
|
2007-01-04 02:02:40 +01:00
|
|
|
where @code{TYPESPEC} is a basic type (@code{INTEGER}, @code{REAL},
|
2007-03-06 09:00:02 +01:00
|
|
|
etc.), and where @code{size} is a byte count corresponding to the
|
|
|
|
storage size of a valid kind for that type. (For @code{COMPLEX}
|
|
|
|
variables, @code{size} is the total size of the real and imaginary
|
|
|
|
parts.) The statement then declares @code{x}, @code{y} and @code{z} to
|
|
|
|
be of type @code{TYPESPEC} with the appropriate kind. This is
|
|
|
|
equivalent to the standard-conforming declaration
|
2004-08-29 18:58:39 +02:00
|
|
|
@smallexample
|
|
|
|
TYPESPEC(k) x,y,z
|
|
|
|
@end smallexample
|
2007-03-06 09:00:02 +01:00
|
|
|
@noindent
|
2008-12-21 19:45:17 +01:00
|
|
|
where @code{k} is the kind parameter suitable for the intended precision. As
|
|
|
|
kind parameters are implementation-dependent, use the @code{KIND},
|
|
|
|
@code{SELECTED_INT_KIND} and @code{SELECTED_REAL_KIND} intrinsics to retrieve
|
|
|
|
the correct value, for instance @code{REAL*8 x} can be replaced by:
|
|
|
|
@smallexample
|
|
|
|
INTEGER, PARAMETER :: dbl = KIND(1.0d0)
|
|
|
|
REAL(KIND=dbl) :: x
|
|
|
|
@end smallexample
|
2004-08-29 18:58:39 +02:00
|
|
|
|
|
|
|
@node Old-style variable initialization
|
2008-02-16 15:10:12 +01:00
|
|
|
@subsection Old-style variable initialization
|
2004-08-29 18:58:39 +02:00
|
|
|
|
2006-10-05 01:07:39 +02:00
|
|
|
GNU Fortran allows old-style initialization of variables of the
|
2004-08-29 18:58:39 +02:00
|
|
|
form:
|
|
|
|
@smallexample
|
2007-01-04 02:02:40 +01:00
|
|
|
INTEGER i/1/,j/2/
|
|
|
|
REAL x(2,2) /3*0.,1./
|
2004-08-29 18:58:39 +02:00
|
|
|
@end smallexample
|
2007-01-04 02:02:40 +01:00
|
|
|
The syntax for the initializers is as for the @code{DATA} statement, but
|
2004-08-29 18:58:39 +02:00
|
|
|
unlike in a @code{DATA} statement, an initializer only applies to the
|
2007-01-04 02:02:40 +01:00
|
|
|
variable immediately preceding the initialization. In other words,
|
|
|
|
something like @code{INTEGER I,J/2,3/} is not valid. This style of
|
|
|
|
initialization is only allowed in declarations without double colons
|
|
|
|
(@code{::}); the double colons were introduced in Fortran 90, which also
|
2007-01-08 02:23:16 +01:00
|
|
|
introduced a standard syntax for initializing variables in type
|
2007-01-04 02:02:40 +01:00
|
|
|
declarations.
|
|
|
|
|
|
|
|
Examples of standard-conforming code equivalent to the above example
|
|
|
|
are:
|
2004-08-29 18:58:39 +02:00
|
|
|
@smallexample
|
|
|
|
! Fortran 90
|
2007-01-04 02:02:40 +01:00
|
|
|
INTEGER :: i = 1, j = 2
|
|
|
|
REAL :: x(2,2) = RESHAPE((/0.,0.,0.,1./),SHAPE(x))
|
2004-08-29 18:58:39 +02:00
|
|
|
! Fortran 77
|
2007-01-04 02:02:40 +01:00
|
|
|
INTEGER i, j
|
|
|
|
REAL x(2,2)
|
|
|
|
DATA i/1/, j/2/, x/3*0.,1./
|
2004-08-29 18:58:39 +02:00
|
|
|
@end smallexample
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2007-01-04 02:02:40 +01:00
|
|
|
Note that variables which are explicitly initialized in declarations
|
|
|
|
or in @code{DATA} statements automatically acquire the @code{SAVE}
|
|
|
|
attribute.
|
2006-08-26 19:28:09 +02:00
|
|
|
|
2005-04-23 19:03:07 +02:00
|
|
|
@node Extensions to namelist
|
2008-02-16 15:10:12 +01:00
|
|
|
@subsection Extensions to namelist
|
2005-04-23 19:03:07 +02:00
|
|
|
@cindex Namelist
|
|
|
|
|
2006-10-05 01:07:39 +02:00
|
|
|
GNU Fortran fully supports the Fortran 95 standard for namelist I/O
|
2005-04-23 19:03:07 +02:00
|
|
|
including array qualifiers, substrings and fully qualified derived types.
|
|
|
|
The output from a namelist write is compatible with namelist read. The
|
|
|
|
output has all names in upper case and indentation to column 1 after the
|
|
|
|
namelist name. Two extensions are permitted:
|
|
|
|
|
2007-01-04 02:02:40 +01:00
|
|
|
Old-style use of @samp{$} instead of @samp{&}
|
2005-04-23 19:03:07 +02:00
|
|
|
@smallexample
|
|
|
|
$MYNML
|
|
|
|
X(:)%Y(2) = 1.0 2.0 3.0
|
|
|
|
CH(1:4) = "abcd"
|
|
|
|
$END
|
|
|
|
@end smallexample
|
|
|
|
|
2007-01-04 02:02:40 +01:00
|
|
|
It should be noted that the default terminator is @samp{/} rather than
|
|
|
|
@samp{&END}.
|
2005-04-23 19:03:07 +02:00
|
|
|
|
2010-09-24 08:39:20 +02:00
|
|
|
Querying of the namelist when inputting from stdin. After at least
|
2007-01-04 02:02:40 +01:00
|
|
|
one space, entering @samp{?} sends to stdout the namelist name and the names of
|
2005-04-23 19:03:07 +02:00
|
|
|
the variables in the namelist:
|
|
|
|
@smallexample
|
2007-01-04 02:02:40 +01:00
|
|
|
?
|
2005-04-23 19:03:07 +02:00
|
|
|
|
|
|
|
&mynml
|
|
|
|
x
|
|
|
|
x%y
|
|
|
|
ch
|
|
|
|
&end
|
|
|
|
@end smallexample
|
|
|
|
|
2007-01-04 02:02:40 +01:00
|
|
|
Entering @samp{=?} outputs the namelist to stdout, as if
|
|
|
|
@code{WRITE(*,NML = mynml)} had been called:
|
2005-04-23 19:03:07 +02:00
|
|
|
@smallexample
|
|
|
|
=?
|
|
|
|
|
|
|
|
&MYNML
|
|
|
|
X(1)%Y= 0.000000 , 1.000000 , 0.000000 ,
|
|
|
|
X(2)%Y= 0.000000 , 2.000000 , 0.000000 ,
|
|
|
|
X(3)%Y= 0.000000 , 3.000000 , 0.000000 ,
|
|
|
|
CH=abcd, /
|
|
|
|
@end smallexample
|
|
|
|
|
2005-07-02 02:45:55 +02:00
|
|
|
To aid this dialog, when input is from stdin, errors send their
|
2007-01-04 02:02:40 +01:00
|
|
|
messages to stderr and execution continues, even if @code{IOSTAT} is set.
|
2005-04-23 19:03:07 +02:00
|
|
|
|
2007-01-04 02:02:40 +01:00
|
|
|
@code{PRINT} namelist is permitted. This causes an error if
|
|
|
|
@option{-std=f95} is used.
|
2005-08-14 23:43:12 +02:00
|
|
|
@smallexample
|
|
|
|
PROGRAM test_print
|
|
|
|
REAL, dimension (4) :: x = (/1.0, 2.0, 3.0, 4.0/)
|
|
|
|
NAMELIST /mynml/ x
|
|
|
|
PRINT mynml
|
|
|
|
END PROGRAM test_print
|
|
|
|
@end smallexample
|
|
|
|
|
2007-01-04 02:02:40 +01:00
|
|
|
Expanded namelist reads are permitted. This causes an error if
|
|
|
|
@option{-std=f95} is used. In the following example, the first element
|
|
|
|
of the array will be given the value 0.00 and the two succeeding
|
|
|
|
elements will be given the values 1.00 and 2.00.
|
2006-05-29 21:33:43 +02:00
|
|
|
@smallexample
|
|
|
|
&MYNML
|
|
|
|
X(1,1) = 0.00 , 1.00 , 2.00
|
|
|
|
/
|
|
|
|
@end smallexample
|
|
|
|
|
2014-03-21 23:14:36 +01:00
|
|
|
When writing a namelist, if no @code{DELIM=} is specified, by default a
|
|
|
|
double quote is used to delimit character strings. If -std=F95, F2003,
|
|
|
|
or F2008, etc, the delim status is set to 'none'. Defaulting to
|
|
|
|
quotes ensures that namelists with character strings can be subsequently
|
|
|
|
read back in accurately.
|
|
|
|
|
2007-01-04 02:02:40 +01:00
|
|
|
@node X format descriptor without count field
|
2008-02-16 15:10:12 +01:00
|
|
|
@subsection @code{X} format descriptor without count field
|
2005-05-23 05:20:19 +02:00
|
|
|
|
2007-01-04 02:02:40 +01:00
|
|
|
To support legacy codes, GNU Fortran permits the count field of the
|
|
|
|
@code{X} edit descriptor in @code{FORMAT} statements to be omitted.
|
|
|
|
When omitted, the count is implicitly assumed to be one.
|
2005-05-23 05:20:19 +02:00
|
|
|
|
|
|
|
@smallexample
|
|
|
|
PRINT 10, 2, 3
|
|
|
|
10 FORMAT (I1, X, I1)
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
@node Commas in FORMAT specifications
|
2008-02-16 15:10:12 +01:00
|
|
|
@subsection Commas in @code{FORMAT} specifications
|
2005-05-23 05:20:19 +02:00
|
|
|
|
2006-10-05 01:07:39 +02:00
|
|
|
To support legacy codes, GNU Fortran allows the comma separator
|
2005-05-23 05:20:19 +02:00
|
|
|
to be omitted immediately before and after character string edit
|
2007-01-04 02:02:40 +01:00
|
|
|
descriptors in @code{FORMAT} statements.
|
2005-05-23 05:20:19 +02:00
|
|
|
|
|
|
|
@smallexample
|
|
|
|
PRINT 10, 2, 3
|
|
|
|
10 FORMAT ('FOO='I1' BAR='I2)
|
|
|
|
@end smallexample
|
|
|
|
|
2006-05-29 21:33:43 +02:00
|
|
|
|
|
|
|
@node Missing period in FORMAT specifications
|
2008-02-16 15:10:12 +01:00
|
|
|
@subsection Missing period in @code{FORMAT} specifications
|
2006-05-29 21:33:43 +02:00
|
|
|
|
2006-10-05 01:07:39 +02:00
|
|
|
To support legacy codes, GNU Fortran allows missing periods in format
|
2007-01-04 02:02:40 +01:00
|
|
|
specifications if and only if @option{-std=legacy} is given on the
|
|
|
|
command line. This is considered non-conforming code and is
|
|
|
|
discouraged.
|
2006-05-29 21:33:43 +02:00
|
|
|
|
|
|
|
@smallexample
|
|
|
|
REAL :: value
|
|
|
|
READ(*,10) value
|
|
|
|
10 FORMAT ('F4')
|
|
|
|
@end smallexample
|
|
|
|
|
2005-05-23 05:20:19 +02:00
|
|
|
@node I/O item lists
|
2008-02-16 15:10:12 +01:00
|
|
|
@subsection I/O item lists
|
2005-05-23 05:20:19 +02:00
|
|
|
@cindex I/O item lists
|
|
|
|
|
2006-10-05 01:07:39 +02:00
|
|
|
To support legacy codes, GNU Fortran allows the input item list
|
2007-01-04 02:02:40 +01:00
|
|
|
of the @code{READ} statement, and the output item lists of the
|
|
|
|
@code{WRITE} and @code{PRINT} statements, to start with a comma.
|
2005-05-23 05:20:19 +02:00
|
|
|
|
2011-05-03 03:23:46 +02:00
|
|
|
@node @code{Q} exponent-letter
|
|
|
|
@subsection @code{Q} exponent-letter
|
|
|
|
@cindex @code{Q} exponent-letter
|
|
|
|
|
|
|
|
GNU Fortran accepts real literal constants with an exponent-letter
|
|
|
|
of @code{Q}, for example, @code{1.23Q45}. The constant is interpreted
|
2012-02-17 12:18:20 +01:00
|
|
|
as a @code{REAL(16)} entity on targets that support this type. If
|
2011-05-03 03:23:46 +02:00
|
|
|
the target does not support @code{REAL(16)} but has a @code{REAL(10)}
|
|
|
|
type, then the real-literal-constant will be interpreted as a
|
|
|
|
@code{REAL(10)} entity. In the absence of @code{REAL(16)} and
|
|
|
|
@code{REAL(10)}, an error will occur.
|
|
|
|
|
2007-01-04 02:02:40 +01:00
|
|
|
@node BOZ literal constants
|
2008-02-16 15:10:12 +01:00
|
|
|
@subsection BOZ literal constants
|
2007-01-04 02:02:40 +01:00
|
|
|
@cindex BOZ literal constants
|
2005-05-23 05:20:19 +02:00
|
|
|
|
2007-12-08 22:46:56 +01:00
|
|
|
Besides decimal constants, Fortran also supports binary (@code{b}),
|
2010-09-24 08:39:20 +02:00
|
|
|
octal (@code{o}) and hexadecimal (@code{z}) integer constants. The
|
2007-12-08 22:46:56 +01:00
|
|
|
syntax is: @samp{prefix quote digits quote}, were the prefix is
|
|
|
|
either @code{b}, @code{o} or @code{z}, quote is either @code{'} or
|
|
|
|
@code{"} and the digits are for binary @code{0} or @code{1}, for
|
|
|
|
octal between @code{0} and @code{7}, and for hexadecimal between
|
2010-09-24 08:39:20 +02:00
|
|
|
@code{0} and @code{F}. (Example: @code{b'01011101'}.)
|
2007-12-08 22:46:56 +01:00
|
|
|
|
|
|
|
Up to Fortran 95, BOZ literals were only allowed to initialize
|
2010-09-24 08:39:20 +02:00
|
|
|
integer variables in DATA statements. Since Fortran 2003 BOZ literals
|
2007-12-08 22:46:56 +01:00
|
|
|
are also allowed as argument of @code{REAL}, @code{DBLE}, @code{INT}
|
|
|
|
and @code{CMPLX}; the result is the same as if the integer BOZ
|
|
|
|
literal had been converted by @code{TRANSFER} to, respectively,
|
|
|
|
@code{real}, @code{double precision}, @code{integer} or @code{complex}.
|
2007-12-17 12:24:06 +01:00
|
|
|
As GNU Fortran extension the intrinsic procedures @code{FLOAT},
|
|
|
|
@code{DFLOAT}, @code{COMPLEX} and @code{DCMPLX} are treated alike.
|
2007-12-08 22:46:56 +01:00
|
|
|
|
2007-01-04 02:02:40 +01:00
|
|
|
As an extension, GNU Fortran allows hexadecimal BOZ literal constants to
|
2007-12-08 22:46:56 +01:00
|
|
|
be specified using the @code{X} prefix, in addition to the standard
|
2010-09-24 08:39:20 +02:00
|
|
|
@code{Z} prefix. The BOZ literal can also be specified by adding a
|
2007-12-08 22:46:56 +01:00
|
|
|
suffix to the string, for example, @code{Z'ABC'} and @code{'ABC'Z} are
|
|
|
|
equivalent.
|
|
|
|
|
|
|
|
Furthermore, GNU Fortran allows using BOZ literal constants outside
|
|
|
|
DATA statements and the four intrinsic functions allowed by Fortran 2003.
|
|
|
|
In DATA statements, in direct assignments, where the right-hand side
|
|
|
|
only contains a BOZ literal constant, and for old-style initializers of
|
|
|
|
the form @code{integer i /o'0173'/}, the constant is transferred
|
2007-12-20 09:13:09 +01:00
|
|
|
as if @code{TRANSFER} had been used; for @code{COMPLEX} numbers, only
|
2010-09-24 08:39:20 +02:00
|
|
|
the real part is initialized unless @code{CMPLX} is used. In all other
|
2007-12-20 09:13:09 +01:00
|
|
|
cases, the BOZ literal constant is converted to an @code{INTEGER} value with
|
2007-12-08 22:46:56 +01:00
|
|
|
the largest decimal representation. This value is then converted
|
|
|
|
numerically to the type and kind of the variable in question.
|
2009-06-03 22:32:23 +02:00
|
|
|
(For instance, @code{real :: r = b'0000001' + 1} initializes @code{r}
|
2007-12-08 22:46:56 +01:00
|
|
|
with @code{2.0}.) As different compilers implement the extension
|
|
|
|
differently, one should be careful when doing bitwise initialization
|
|
|
|
of non-integer variables.
|
|
|
|
|
|
|
|
Note that initializing an @code{INTEGER} variable with a statement such
|
|
|
|
as @code{DATA i/Z'FFFFFFFF'/} will give an integer overflow error rather
|
2007-01-04 02:02:40 +01:00
|
|
|
than the desired result of @math{-1} when @code{i} is a 32-bit integer
|
|
|
|
on a system that supports 64-bit integers. The @samp{-fno-range-check}
|
|
|
|
option can be used as a workaround for legacy code that initializes
|
|
|
|
integers in this manner.
|
2005-05-23 05:20:19 +02:00
|
|
|
|
|
|
|
@node Real array indices
|
2008-02-16 15:10:12 +01:00
|
|
|
@subsection Real array indices
|
2007-04-29 12:49:08 +02:00
|
|
|
@cindex array, indices of type real
|
2005-05-23 05:20:19 +02:00
|
|
|
|
2007-01-04 02:02:40 +01:00
|
|
|
As an extension, GNU Fortran allows the use of @code{REAL} expressions
|
|
|
|
or variables as array indices.
|
2005-05-23 05:20:19 +02:00
|
|
|
|
|
|
|
@node Unary operators
|
2008-02-16 15:10:12 +01:00
|
|
|
@subsection Unary operators
|
2007-04-29 12:49:08 +02:00
|
|
|
@cindex operators, unary
|
2005-05-23 05:20:19 +02:00
|
|
|
|
2007-01-04 02:02:40 +01:00
|
|
|
As an extension, GNU Fortran allows unary plus and unary minus operators
|
|
|
|
to appear as the second operand of binary arithmetic operators without
|
|
|
|
the need for parenthesis.
|
2005-05-23 05:20:19 +02:00
|
|
|
|
|
|
|
@smallexample
|
|
|
|
X = Y * -Z
|
|
|
|
@end smallexample
|
|
|
|
|
2007-01-04 02:02:40 +01:00
|
|
|
@node Implicitly convert LOGICAL and INTEGER values
|
2008-02-16 15:10:12 +01:00
|
|
|
@subsection Implicitly convert @code{LOGICAL} and @code{INTEGER} values
|
2007-04-29 12:49:08 +02:00
|
|
|
@cindex conversion, to integer
|
|
|
|
@cindex conversion, to logical
|
2005-06-01 21:17:37 +02:00
|
|
|
|
2007-01-04 02:02:40 +01:00
|
|
|
As an extension for backwards compatibility with other compilers, GNU
|
|
|
|
Fortran allows the implicit conversion of @code{LOGICAL} values to
|
|
|
|
@code{INTEGER} values and vice versa. When converting from a
|
|
|
|
@code{LOGICAL} to an @code{INTEGER}, @code{.FALSE.} is interpreted as
|
|
|
|
zero, and @code{.TRUE.} is interpreted as one. When converting from
|
|
|
|
@code{INTEGER} to @code{LOGICAL}, the value zero is interpreted as
|
decl.c, [...]: Fix comment/doc typos.
* decl.c, dump-parse-tree.c, gfortran.texi, intrinsic.texi,
invoke.texi, resolve.c, trans-array.c, trans-array.h,
trans-common.c, trans-expr.c, trans-io.c, trans.h: Fix
comment/doc typos. Follow spelling conventions.
From-SVN: r102806
2005-08-06 14:56:19 +02:00
|
|
|
@code{.FALSE.} and any nonzero value is interpreted as @code{.TRUE.}.
|
2005-06-01 21:17:37 +02:00
|
|
|
|
|
|
|
@smallexample
|
2007-12-26 07:36:46 +01:00
|
|
|
LOGICAL :: l
|
|
|
|
l = 1
|
|
|
|
@end smallexample
|
|
|
|
@smallexample
|
|
|
|
INTEGER :: i
|
|
|
|
i = .TRUE.
|
2005-06-01 21:17:37 +02:00
|
|
|
@end smallexample
|
|
|
|
|
2007-12-26 07:36:46 +01:00
|
|
|
However, there is no implicit conversion of @code{INTEGER} values in
|
|
|
|
@code{if}-statements, nor of @code{LOGICAL} or @code{INTEGER} values
|
|
|
|
in I/O operations.
|
2007-10-26 01:27:12 +02:00
|
|
|
|
2005-07-07 09:56:46 +02:00
|
|
|
@node Hollerith constants support
|
2008-02-16 15:10:12 +01:00
|
|
|
@subsection Hollerith constants support
|
2005-07-07 09:56:46 +02:00
|
|
|
@cindex Hollerith constants
|
|
|
|
|
2007-01-04 02:02:40 +01:00
|
|
|
GNU Fortran supports Hollerith constants in assignments, function
|
|
|
|
arguments, and @code{DATA} and @code{ASSIGN} statements. A Hollerith
|
2007-01-08 02:23:16 +01:00
|
|
|
constant is written as a string of characters preceded by an integer
|
2007-01-04 02:02:40 +01:00
|
|
|
constant indicating the character count, and the letter @code{H} or
|
|
|
|
@code{h}, and stored in bytewise fashion in a numeric (@code{INTEGER},
|
|
|
|
@code{REAL}, or @code{complex}) or @code{LOGICAL} variable. The
|
|
|
|
constant will be padded or truncated to fit the size of the variable in
|
|
|
|
which it is stored.
|
2005-07-07 09:56:46 +02:00
|
|
|
|
2007-01-04 02:02:40 +01:00
|
|
|
Examples of valid uses of Hollerith constants:
|
2005-07-07 09:56:46 +02:00
|
|
|
@smallexample
|
2007-01-04 02:02:40 +01:00
|
|
|
complex*16 x(2)
|
|
|
|
data x /16Habcdefghijklmnop, 16Hqrstuvwxyz012345/
|
|
|
|
x(1) = 16HABCDEFGHIJKLMNOP
|
|
|
|
call foo (4h abc)
|
2005-07-07 09:56:46 +02:00
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
Invalid Hollerith constants examples:
|
|
|
|
@smallexample
|
2007-01-04 02:02:40 +01:00
|
|
|
integer*4 a
|
|
|
|
a = 8H12345678 ! Valid, but the Hollerith constant will be truncated.
|
|
|
|
a = 0H ! At least one character is needed.
|
2005-07-07 09:56:46 +02:00
|
|
|
@end smallexample
|
|
|
|
|
2007-01-04 02:02:40 +01:00
|
|
|
In general, Hollerith constants were used to provide a rudimentary
|
|
|
|
facility for handling character strings in early Fortran compilers,
|
|
|
|
prior to the introduction of @code{CHARACTER} variables in Fortran 77;
|
|
|
|
in those cases, the standard-compliant equivalent is to convert the
|
|
|
|
program to use proper character strings. On occasion, there may be a
|
|
|
|
case where the intent is specifically to initialize a numeric variable
|
|
|
|
with a given byte sequence. In these cases, the same result can be
|
|
|
|
obtained by using the @code{TRANSFER} statement, as in this example.
|
|
|
|
@smallexample
|
|
|
|
INTEGER(KIND=4) :: a
|
|
|
|
a = TRANSFER ("abcd", a) ! equivalent to: a = 4Habcd
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
|
2005-10-24 21:28:18 +02:00
|
|
|
@node Cray pointers
|
2008-02-16 15:10:12 +01:00
|
|
|
@subsection Cray pointers
|
|
|
|
@cindex pointer, Cray
|
2005-10-24 21:28:18 +02:00
|
|
|
|
|
|
|
Cray pointers are part of a non-standard extension that provides a
|
|
|
|
C-like pointer in Fortran. This is accomplished through a pair of
|
|
|
|
variables: an integer "pointer" that holds a memory address, and a
|
|
|
|
"pointee" that is used to dereference the pointer.
|
|
|
|
|
|
|
|
Pointer/pointee pairs are declared in statements of the form:
|
|
|
|
@smallexample
|
|
|
|
pointer ( <pointer> , <pointee> )
|
|
|
|
@end smallexample
|
|
|
|
or,
|
|
|
|
@smallexample
|
|
|
|
pointer ( <pointer1> , <pointee1> ), ( <pointer2> , <pointee2> ), ...
|
|
|
|
@end smallexample
|
|
|
|
The pointer is an integer that is intended to hold a memory address.
|
|
|
|
The pointee may be an array or scalar. A pointee can be an assumed
|
2006-10-11 05:35:08 +02:00
|
|
|
size array---that is, the last dimension may be left unspecified by
|
2007-01-04 02:02:40 +01:00
|
|
|
using a @code{*} in place of a value---but a pointee cannot be an
|
|
|
|
assumed shape array. No space is allocated for the pointee.
|
2005-10-24 21:28:18 +02:00
|
|
|
|
|
|
|
The pointee may have its type declared before or after the pointer
|
|
|
|
statement, and its array specification (if any) may be declared
|
|
|
|
before, during, or after the pointer statement. The pointer may be
|
|
|
|
declared as an integer prior to the pointer statement. However, some
|
|
|
|
machines have default integer sizes that are different than the size
|
|
|
|
of a pointer, and so the following code is not portable:
|
|
|
|
@smallexample
|
|
|
|
integer ipt
|
|
|
|
pointer (ipt, iarr)
|
|
|
|
@end smallexample
|
|
|
|
If a pointer is declared with a kind that is too small, the compiler
|
|
|
|
will issue a warning; the resulting binary will probably not work
|
|
|
|
correctly, because the memory addresses stored in the pointers may be
|
|
|
|
truncated. It is safer to omit the first line of the above example;
|
|
|
|
if explicit declaration of ipt's type is omitted, then the compiler
|
|
|
|
will ensure that ipt is an integer variable large enough to hold a
|
|
|
|
pointer.
|
|
|
|
|
|
|
|
Pointer arithmetic is valid with Cray pointers, but it is not the same
|
|
|
|
as C pointer arithmetic. Cray pointers are just ordinary integers, so
|
|
|
|
the user is responsible for determining how many bytes to add to a
|
|
|
|
pointer in order to increment it. Consider the following example:
|
|
|
|
@smallexample
|
|
|
|
real target(10)
|
|
|
|
real pointee(10)
|
|
|
|
pointer (ipt, pointee)
|
|
|
|
ipt = loc (target)
|
|
|
|
ipt = ipt + 1
|
|
|
|
@end smallexample
|
2007-01-04 02:02:40 +01:00
|
|
|
The last statement does not set @code{ipt} to the address of
|
|
|
|
@code{target(1)}, as it would in C pointer arithmetic. Adding @code{1}
|
|
|
|
to @code{ipt} just adds one byte to the address stored in @code{ipt}.
|
2005-10-24 21:28:18 +02:00
|
|
|
|
|
|
|
Any expression involving the pointee will be translated to use the
|
2005-10-25 20:43:22 +02:00
|
|
|
value stored in the pointer as the base address.
|
2005-10-24 21:28:18 +02:00
|
|
|
|
|
|
|
To get the address of elements, this extension provides an intrinsic
|
2007-01-04 02:02:40 +01:00
|
|
|
function @code{LOC()}. The @code{LOC()} function is equivalent to the
|
|
|
|
@code{&} operator in C, except the address is cast to an integer type:
|
2005-10-24 21:28:18 +02:00
|
|
|
@smallexample
|
|
|
|
real ar(10)
|
|
|
|
pointer(ipt, arpte(10))
|
|
|
|
real arpte
|
|
|
|
ipt = loc(ar) ! Makes arpte is an alias for ar
|
|
|
|
arpte(1) = 1.0 ! Sets ar(1) to 1.0
|
|
|
|
@end smallexample
|
2006-10-01 21:11:31 +02:00
|
|
|
The pointer can also be set by a call to the @code{MALLOC} intrinsic
|
|
|
|
(see @ref{MALLOC}).
|
|
|
|
|
2005-10-24 21:28:18 +02:00
|
|
|
Cray pointees often are used to alias an existing variable. For
|
|
|
|
example:
|
|
|
|
@smallexample
|
|
|
|
integer target(10)
|
|
|
|
integer iarr(10)
|
|
|
|
pointer (ipt, iarr)
|
|
|
|
ipt = loc(target)
|
|
|
|
@end smallexample
|
2007-01-04 02:02:40 +01:00
|
|
|
As long as @code{ipt} remains unchanged, @code{iarr} is now an alias for
|
2010-09-24 08:39:20 +02:00
|
|
|
@code{target}. The optimizer, however, will not detect this aliasing, so
|
2007-01-04 02:02:40 +01:00
|
|
|
it is unsafe to use @code{iarr} and @code{target} simultaneously. Using
|
|
|
|
a pointee in any way that violates the Fortran aliasing rules or
|
2010-09-24 08:39:20 +02:00
|
|
|
assumptions is illegal. It is the user's responsibility to avoid doing
|
2007-01-04 02:02:40 +01:00
|
|
|
this; the compiler works under the assumption that no such aliasing
|
|
|
|
occurs.
|
|
|
|
|
|
|
|
Cray pointers will work correctly when there is no aliasing (i.e., when
|
|
|
|
they are used to access a dynamically allocated block of memory), and
|
|
|
|
also in any routine where a pointee is used, but any variable with which
|
|
|
|
it shares storage is not used. Code that violates these rules may not
|
|
|
|
run as the user intends. This is not a bug in the optimizer; any code
|
|
|
|
that violates the aliasing rules is illegal. (Note that this is not
|
|
|
|
unique to GNU Fortran; any Fortran compiler that supports Cray pointers
|
|
|
|
will ``incorrectly'' optimize code with illegal aliasing.)
|
|
|
|
|
|
|
|
There are a number of restrictions on the attributes that can be applied
|
|
|
|
to Cray pointers and pointees. Pointees may not have the
|
|
|
|
@code{ALLOCATABLE}, @code{INTENT}, @code{OPTIONAL}, @code{DUMMY},
|
2010-09-24 08:39:20 +02:00
|
|
|
@code{TARGET}, @code{INTRINSIC}, or @code{POINTER} attributes. Pointers
|
2007-01-04 02:02:40 +01:00
|
|
|
may not have the @code{DIMENSION}, @code{POINTER}, @code{TARGET},
|
2010-06-10 22:02:39 +02:00
|
|
|
@code{ALLOCATABLE}, @code{EXTERNAL}, or @code{INTRINSIC} attributes, nor
|
2010-09-24 08:39:20 +02:00
|
|
|
may they be function results. Pointees may not occur in more than one
|
2010-06-10 22:02:39 +02:00
|
|
|
pointer statement. A pointee cannot be a pointer. Pointees cannot occur
|
|
|
|
in equivalence, common, or data statements.
|
2005-10-24 21:28:18 +02:00
|
|
|
|
2007-01-04 02:02:40 +01:00
|
|
|
A Cray pointer may also point to a function or a subroutine. For
|
|
|
|
example, the following excerpt is valid:
|
2006-05-31 01:27:38 +02:00
|
|
|
@smallexample
|
|
|
|
implicit none
|
|
|
|
external sub
|
|
|
|
pointer (subptr,subpte)
|
|
|
|
external subpte
|
|
|
|
subptr = loc(sub)
|
|
|
|
call subpte()
|
|
|
|
[...]
|
|
|
|
subroutine sub
|
|
|
|
[...]
|
|
|
|
end subroutine sub
|
|
|
|
@end smallexample
|
|
|
|
|
2005-10-24 21:28:18 +02:00
|
|
|
A pointer may be modified during the course of a program, and this
|
|
|
|
will change the location to which the pointee refers. However, when
|
|
|
|
pointees are passed as arguments, they are treated as ordinary
|
|
|
|
variables in the invoked function. Subsequent changes to the pointer
|
|
|
|
will not change the base address of the array that was passed.
|
|
|
|
|
2005-12-10 21:01:56 +01:00
|
|
|
@node CONVERT specifier
|
2008-02-16 15:10:12 +01:00
|
|
|
@subsection @code{CONVERT} specifier
|
|
|
|
@cindex @code{CONVERT} specifier
|
2005-12-10 21:01:56 +01:00
|
|
|
|
2006-10-05 01:07:39 +02:00
|
|
|
GNU Fortran allows the conversion of unformatted data between little-
|
2005-12-10 21:01:56 +01:00
|
|
|
and big-endian representation to facilitate moving of data
|
2006-02-06 21:12:44 +01:00
|
|
|
between different systems. The conversion can be indicated with
|
2005-12-10 21:01:56 +01:00
|
|
|
the @code{CONVERT} specifier on the @code{OPEN} statement.
|
2006-02-06 21:12:44 +01:00
|
|
|
@xref{GFORTRAN_CONVERT_UNIT}, for an alternative way of specifying
|
|
|
|
the data format via an environment variable.
|
2005-12-10 21:01:56 +01:00
|
|
|
|
|
|
|
Valid values for @code{CONVERT} are:
|
|
|
|
@itemize @w{}
|
|
|
|
@item @code{CONVERT='NATIVE'} Use the native format. This is the default.
|
|
|
|
@item @code{CONVERT='SWAP'} Swap between little- and big-endian.
|
2006-02-06 21:12:44 +01:00
|
|
|
@item @code{CONVERT='LITTLE_ENDIAN'} Use the little-endian representation
|
2008-06-15 11:42:13 +02:00
|
|
|
for unformatted files.
|
2006-02-06 21:12:44 +01:00
|
|
|
@item @code{CONVERT='BIG_ENDIAN'} Use the big-endian representation for
|
2008-06-15 11:42:13 +02:00
|
|
|
unformatted files.
|
2005-12-10 21:01:56 +01:00
|
|
|
@end itemize
|
|
|
|
|
|
|
|
Using the option could look like this:
|
|
|
|
@smallexample
|
|
|
|
open(file='big.dat',form='unformatted',access='sequential', &
|
|
|
|
convert='big_endian')
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
The value of the conversion can be queried by using
|
|
|
|
@code{INQUIRE(CONVERT=ch)}. The values returned are
|
|
|
|
@code{'BIG_ENDIAN'} and @code{'LITTLE_ENDIAN'}.
|
|
|
|
|
|
|
|
@code{CONVERT} works between big- and little-endian for
|
|
|
|
@code{INTEGER} values of all supported kinds and for @code{REAL}
|
2005-12-16 06:49:45 +01:00
|
|
|
on IEEE systems of kinds 4 and 8. Conversion between different
|
2005-12-10 21:01:56 +01:00
|
|
|
``extended double'' types on different architectures such as
|
2006-10-05 01:07:39 +02:00
|
|
|
m68k and x86_64, which GNU Fortran
|
2007-01-04 02:02:40 +01:00
|
|
|
supports as @code{REAL(KIND=10)} and @code{REAL(KIND=16)}, will
|
|
|
|
probably not work.
|
2005-12-10 21:01:56 +01:00
|
|
|
|
2006-02-06 21:12:44 +01:00
|
|
|
@emph{Note that the values specified via the GFORTRAN_CONVERT_UNIT
|
|
|
|
environment variable will override the CONVERT specifier in the
|
|
|
|
open statement}. This is to give control over data formats to
|
2007-01-04 02:02:40 +01:00
|
|
|
users who do not have the source code of their program available.
|
2006-02-06 21:12:44 +01:00
|
|
|
|
|
|
|
Using anything but the native representation for unformatted data
|
|
|
|
carries a significant speed overhead. If speed in this area matters
|
|
|
|
to you, it is best if you use this only for data that needs to be
|
|
|
|
portable.
|
|
|
|
|
re PR fortran/25162 (Issue with OpenMP COPYIN and gfortran)
gcc/fortran/
2006-02-14 Jakub Jelinek <jakub@redhat.com>
Richard Henderson <rth@redhat.com>
Diego Novillo <dnovillo@redhat.com>
* invoke.texi: Document -fopenmp.
* gfortran.texi (Extensions): Document OpenMP.
Backport from gomp-20050608-branch
* trans-openmp.c: Call build_omp_clause instead of
make_node when creating OMP_CLAUSE_* trees.
(gfc_trans_omp_reduction_list): Remove argument 'code'.
Adjust all callers.
* trans.h (build4_v): Define.
* trans-openmp.c: Call build4_v to create OMP_PARALLEL nodes.
Call build3_v to create OMP_SECTIONS nodes.
PR fortran/25162
* openmp.c (gfc_match_omp_variable_list): Call gfc_set_sym_referenced
on all symbols added to the variable list.
* openmp.c (gfc_match_omp_clauses): Fix check for non-INTRINSIC
procedure symbol in REDUCTION.
* trans-openmp.c (gfc_trans_omp_array_reduction): Use gfc_add
for MINUS_EXPR OMP_CLAUSE_REDUCTION_CODE.
* trans-openmp.c (gfc_trans_omp_do): Add PBLOCK argument. If PBLOCK
is non-NULL, evaluate INIT/COND/INCR and chunk size expressions in
that statement block.
(gfc_trans_omp_parallel_do): Pass non-NULL PBLOCK to gfc_trans_omp_do
for non-ordered non-static combined loops.
(gfc_trans_omp_directive): Pass NULL PBLOCK to gfc_trans_omp_do.
* openmp.c: Include target.h and toplev.h.
(gfc_match_omp_threadprivate): Emit diagnostic if target does
not support TLS.
* Make-lang.in (fortran/openmp.o): Add dependencies on
target.h and toplev.h.
* trans-decl.c (gfc_get_fake_result_decl): Set GFC_DECL_RESULT.
* trans-openmp.c (gfc_omp_privatize_by_reference): Make
DECL_ARTIFICIAL vars predetermined shared except GFC_DECL_RESULT.
(gfc_omp_disregard_value_expr): Handle GFC_DECL_RESULT.
(gfc_trans_omp_variable): New function.
(gfc_trans_omp_variable_list, gfc_trans_omp_reduction_list): Use it.
* trans.h (GFC_DECL_RESULT): Define.
* trans-openmp.c (gfc_omp_firstprivatize_type_sizes): New function.
* f95-lang.c (LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES): Define.
* trans.h (gfc_omp_firstprivatize_type_sizes): New prototype.
* trans-openmp.c (gfc_omp_privatize_by_reference): Return
true if a pointer has GFC_DECL_SAVED_DESCRIPTOR set.
(gfc_trans_omp_array_reduction, gfc_trans_omp_reduction_list): New
functions.
(gfc_trans_omp_clauses): Add WHERE argument. Call
gfc_trans_omp_reduction_list rather than gfc_trans_omp_variable_list
for reductions.
(gfc_trans_omp_do, gfc_trans_omp_parallel, gfc_trans_omp_parallel_do,
gfc_trans_omp_parallel_sections, gfc_trans_omp_parallel_workshare,
gfc_trans_omp_sections, gfc_trans_omp_single): Adjust
gfc_trans_omp_clauses callers.
* openmp.c (omp_current_do_code): New var.
(gfc_resolve_omp_do_blocks): New function.
(gfc_resolve_omp_parallel_blocks): Call it.
(gfc_resolve_do_iterator): Add CODE argument. Don't propagate
predetermination if argument is !$omp do or !$omp parallel do
iteration variable.
* resolve.c (resolve_code): Call gfc_resolve_omp_do_blocks
for EXEC_OMP_DO. Adjust gfc_resolve_do_iterator caller.
* fortran.h (gfc_resolve_omp_do_blocks): New prototype.
(gfc_resolve_do_iterator): Add CODE argument.
* trans.h (gfc_omp_predetermined_sharing,
gfc_omp_disregard_value_expr, gfc_omp_private_debug_clause): New
prototypes.
(GFC_DECL_COMMON_OR_EQUIV, GFC_DECL_CRAY_POINTEE): Define.
* trans-openmp.c (gfc_omp_predetermined_sharing,
gfc_omp_disregard_value_expr, gfc_omp_private_debug_clause): New
functions.
* trans-common.c (build_equiv_decl, build_common_decl,
create_common): Set GFC_DECL_COMMON_OR_EQUIV flag on the decls.
* trans-decl.c (gfc_finish_cray_pointee): Set GFC_DECL_CRAY_POINTEE
on the decl.
* f95-lang.c (LANG_HOOKS_OMP_PREDETERMINED_SHARING,
LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR,
LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE): Define.
* openmp.c (resolve_omp_clauses): Remove extraneous comma.
* symbol.c (check_conflict): Add conflict between cray_pointee and
threadprivate.
* openmp.c (gfc_match_omp_threadprivate): Fail if
gfc_add_threadprivate returned FAILURE.
(resolve_omp_clauses): Diagnose Cray pointees in SHARED,
{,FIRST,LAST}PRIVATE and REDUCTION clauses and Cray pointers in
{FIRST,LAST}PRIVATE and REDUCTION clauses.
* resolve.c (omp_workshare_flag): New variable.
(resolve_function): Diagnose use of non-ELEMENTAL user defined
function in WORKSHARE construct.
(resolve_code): Cleanup forall_save use. Make sure omp_workshare_flag
is set to correct value in different contexts.
* openmp.c (resolve_omp_clauses): Replace %s with '%s' when printing
variable name.
(resolve_omp_atomic): Likewise.
PR fortran/24493
* scanner.c (skip_free_comments): Set at_bol at the beginning of the
loop, not before it.
(skip_fixed_comments): Handle ! comments in the middle of line here
as well.
(gfc_skip_comments): Use skip_fixed_comments for FIXED_FORM even if
not at BOL.
(gfc_next_char_literal): Fix expected canonicalized *$omp string.
* trans-openmp.c (gfc_trans_omp_do): Use make_node and explicit
initialization to build OMP_FOR instead of build.
* trans-decl.c (gfc_gimplify_function): Invoke
diagnose_omp_structured_block_errors.
* trans-openmp.c (gfc_trans_omp_master): Use OMP_MASTER.
(gfc_trans_omp_ordered): Use OMP_ORDERED.
* gfortran.h (gfc_resolve_do_iterator, gfc_resolve_blocks,
gfc_resolve_omp_parallel_blocks): New prototypes.
* resolve.c (resolve_blocks): Renamed to...
(gfc_resolve_blocks): ... this. Remove static.
(gfc_resolve_forall): Adjust caller.
(resolve_code): Only call gfc_resolve_blocks if code->block != 0
and not for EXEC_OMP_PARALLEL* directives. Call
gfc_resolve_omp_parallel_blocks for EXEC_OMP_PARALLEL* directives.
Call gfc_resolve_do_iterator if resolved successfully EXEC_DO
iterator.
* openmp.c: Include pointer-set.h.
(omp_current_ctx): New variable.
(gfc_resolve_omp_parallel_blocks, gfc_resolve_do_iterator): New
functions.
* Make-lang.in (fortran/openmp.o): Depend on pointer-set.h.
* openmp.c (gfc_match_omp_clauses): For max/min/iand/ior/ieor,
look up symbol if it exists, use its name instead and, if it is not
INTRINSIC, issue diagnostics.
* parse.c (parse_omp_do): Handle implied end do properly.
(parse_executable): If parse_omp_do returned ST_IMPLIED_ENDDO,
return it instead of continuing.
* trans-openmp.c (gfc_trans_omp_critical): Update for changed
operand numbering.
(gfc_trans_omp_do, gfc_trans_omp_parallel, gfc_trans_omp_parallel_do,
gfc_trans_omp_parallel_sections, gfc_trans_omp_parallel_workshare,
gfc_trans_omp_sections, gfc_trans_omp_single): Likewise.
* trans.h (gfc_omp_privatize_by_reference): New prototype.
* f95-lang.c (LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Redefine
to gfc_omp_privatize_by_reference.
* trans-openmp.c (gfc_omp_privatize_by_reference): New function.
* trans-stmt.h (gfc_trans_omp_directive): Add comment.
* openmp.c (gfc_match_omp_variable_list): Add ALLOW_COMMON argument.
Disallow COMMON matching if it is set.
(gfc_match_omp_clauses, gfc_match_omp_flush): Adjust all callers.
(resolve_omp_clauses): Show locus in error messages. Check that
variable types in reduction clauses are appropriate for reduction
operators.
* resolve.c (resolve_symbol): Don't error if a threadprivate module
variable isn't SAVEd.
* trans-openmp.c (gfc_trans_omp_do): Put count into BLOCK, not BODY.
Fix typo in condition. Fix DOVAR initialization.
* openmp.c (gfc_match_omp_clauses): Match min/iand/ior/ieor
rather than .min. etc.
* trans-openmpc.c (omp_not_yet): Remove.
(gfc_trans_omp_parallel_do): Keep listprivate clause on parallel.
Force creation of BIND_EXPR around the workshare construct.
(gfc_trans_omp_parallel_sections): Likewise.
(gfc_trans_omp_parallel_workshare): Likewise.
* types.def (BT_I16, BT_FN_I16_VPTR_I16,
BT_FN_BOOL_VPTR_I16_I16, BT_FN_I16_VPTR_I16_I16): Add.
* trans-openmp.c (gfc_trans_omp_clauses): Create OMP_CLAUSE_DEFAULT.
(gfc_trans_omp_code): New function.
(gfc_trans_omp_do): Use it, remove omp_not_yet uses.
(gfc_trans_omp_parallel, gfc_trans_omp_single): Likewise.
(gfc_trans_omp_sections): Likewise. Only treat empty last section
specially if lastprivate clause is present.
* f95-lang.c (gfc_init_builtin_functions): Create BUILT_IN_TRAP
builtin.
* trans-openmp.c (gfc_trans_omp_variable_list): Update for
OMP_CLAUSE_DECL name change.
(gfc_trans_omp_do): Likewise.
* trans-openmp.c (gfc_trans_omp_clauses): Create OMP_CLAUSE_REDUCTION
clauses.
(gfc_trans_omp_atomic): Build OMP_ATOMIC instead of expanding
sync builtins directly.
(gfc_trans_omp_single): Build OMP_SINGLE statement.
* trans-openmp.c (gfc_trans_add_clause): New.
(gfc_trans_omp_variable_list): Take a tree code and build the clause
node here. Link it to the head of a list.
(gfc_trans_omp_clauses): Update to match.
(gfc_trans_omp_do): Use gfc_trans_add_clause.
* trans-openmp.c (gfc_trans_omp_clauses): Change second argument to
gfc_omp_clauses *. Use gfc_evaluate_now instead of creating
temporaries by hand.
(gfc_trans_omp_atomic, gfc_trans_omp_critical): Use buildN_v macros.
(gfc_trans_omp_do): New function.
(gfc_trans_omp_master): Dont' check for gfc_trans_code returning NULL.
(gfc_trans_omp_parallel): Adjust gfc_trans_omp_clauses caller.
Use buildN_v macros.
(gfc_trans_omp_parallel_do, gfc_trans_omp_parallel_sections,
gfc_trans_omp_parallel_workshare, gfc_trans_omp_sections,
gfc_trans_omp_single, gfc_trans_omp_workshare): New functions.
(gfc_trans_omp_directive): Use them.
* parse.c (parse_omp_do): Allow new_st.op == EXEC_NOP.
* openmp.c (resolve_omp_clauses): Check for list items present
in multiple clauses.
(resolve_omp_do): Check that iteration variable is not THREADPRIVATE
and is not present in any clause variable lists other than PRIVATE
or LASTPRIVATE.
* gfortran.h (symbol_attribute): Add threadprivate bit.
(gfc_common_head): Add threadprivate member, change use_assoc
and saved into char to save space.
(gfc_add_threadprivate): New prototype.
* symbol.c (check_conflict): Handle threadprivate.
(gfc_add_threadprivate): New function.
(gfc_copy_attr): Copy threadprivate.
* trans-openmp.c (gfc_trans_omp_clauses): Avoid creating a temporary
if IF or NUM_THREADS is constant. Create OMP_CLAUSE_SCHEDULE and
OMP_CLAUSE_ORDERED.
* resolve.c (resolve_symbol): Complain if a THREADPRIVATE symbol
outside a module and not in COMMON has is not SAVEd.
(resolve_equivalence): Ensure THREADPRIVATE objects don't get
EQUIVALENCEd.
* trans-common.c: Include target.h and rtl.h.
(build_common_decl): Set DECL_TLS_MODEL if THREADPRIVATE.
* trans-decl.c: Include rtl.h.
(gfc_finish_var_decl): Set DECL_TLS_MODEL if THREADPRIVATE.
* dump-parse-tree.c (gfc_show_attr): Handle THREADPRIVATE.
* Make-lang.in (fortran/trans-decl.o): Depend on $(RTL_H).
(fortran/trans-common.o): Depend on $(RTL_H) and $(TARGET_H).
* openmp.c (gfc_match_omp_variable_list): Ensure COMMON block
is from current namespace.
(gfc_match_omp_threadprivate): Rewrite.
(resolve_omp_clauses): Check some clause restrictions.
* module.c (ab_attribute): Add AB_THREADPRIVATE.
(attr_bits): Add THREADPRIVATE.
(mio_symbol_attribute, mio_symbol_attribute): Handle threadprivate.
(load_commons, write_common, write_blank_common): Adjust for type
change of saved, store/load threadprivate bit from the integer
as well.
* types.def (BT_FN_UINT_UINT): New.
(BT_FN_VOID_UINT_UINT): Remove.
* trans-openmp.c (gfc_trans_omp_clauses, gfc_trans_omp_barrier,
gfc_trans_omp_critical, gfc_trans_omp_flush, gfc_trans_omp_master,
gfc_trans_omp_ordered, gfc_trans_omp_parallel): New functions.
(gfc_trans_omp_directive): Use them.
* openmp.c (expr_references_sym): Add SE argument, don't look
into SE tree.
(is_conversion): New function.
(resolve_omp_atomic): Adjust expr_references_sym callers. Handle
promoted expressions.
* trans-openmp.c (gfc_trans_omp_atomic): New function.
(gfc_trans_omp_directive): Call it.
* f95-lang.c (builtin_type_for_size): New function.
(gfc_init_builtin_functions): Initialize synchronization and
OpenMP builtins.
* types.def: New file.
* Make-lang.in (f95-lang.o): Depend on $(BUILTINS_DEF) and
fortran/types.def.
* trans-openmp.c: Rename GOMP_* tree codes into OMP_*.
* dump-parse-tree.c (show_symtree): Don't crash if ns->proc_name
is NULL.
* dump-parse-tree.c (gfc_show_namelist, gfc_show_omp_node): New
functions.
(gfc_show_code_node): Call gfc_show_omp_node for EXEC_OMP_* nodes.
* parse.c (parse_omp_do): Call pop_state before next_statement.
* openmp.c (expr_references_sym, resolve_omp_atomic, resolve_omp_do):
New functions.
(gfc_resolve_omp_directive): Call them.
* match.c (match_exit_cycle): Issue error if EXIT or CYCLE statement
leaves an OpenMP structured block or if EXIT terminates !$omp do
loop.
* Make-lang.in (F95_PARSER_OBJS): Add fortran/openmp.o.
(F95_OBJS): Add fortran/trans-openmp.o.
(fortran/trans-openmp.o): Depend on $(GFORTRAN_TRANS_DEPS).
* lang.opt: Add -fopenmp option.
* options.c (gfc_init_options): Initialize it.
(gfc_handle_option): Handle it.
* gfortran.h (ST_OMP_ATOMIC, ST_OMP_BARRIER, ST_OMP_CRITICAL,
ST_OMP_END_CRITICAL, ST_OMP_END_DO, ST_OMP_END_MASTER,
ST_OMP_END_ORDERED, ST_OMP_END_PARALLEL, ST_OMP_END_PARALLEL_DO,
ST_OMP_END_PARALLEL_SECTIONS, ST_OMP_END_PARALLEL_WORKSHARE,
ST_OMP_END_SECTIONS, ST_OMP_END_SINGLE, ST_OMP_END_WORKSHARE,
ST_OMP_DO, ST_OMP_FLUSH, ST_OMP_MASTER, ST_OMP_ORDERED,
ST_OMP_PARALLEL, ST_OMP_PARALLEL_DO, ST_OMP_PARALLEL_SECTIONS,
ST_OMP_PARALLEL_WORKSHARE, ST_OMP_SECTIONS, ST_OMP_SECTION,
ST_OMP_SINGLE, ST_OMP_THREADPRIVATE, ST_OMP_WORKSHARE): New
statement codes.
(OMP_LIST_PRIVATE, OMP_LIST_FIRSTPRIVATE, OMP_LIST_LASTPRIVATE,
OMP_LIST_COPYPRIVATE, OMP_LIST_SHARED, OMP_LIST_COPYIN,
OMP_LIST_PLUS, OMP_LIST_REDUCTION_FIRST, OMP_LIST_MULT,
OMP_LIST_SUB, OMP_LIST_AND, OMP_LIST_OR, OMP_LIST_EQV,
OMP_LIST_NEQV, OMP_LIST_MAX, OMP_LIST_MIN, OMP_LIST_IAND,
OMP_LIST_IOR, OMP_LIST_IEOR, OMP_LIST_REDUCTION_LAST, OMP_LIST_NUM):
New OpenMP variable list types.
(gfc_omp_clauses): New typedef.
(gfc_get_omp_clauses): Define.
(EXEC_OMP_CRITICAL, EXEC_OMP_DO, EXEC_OMP_FLUSH, EXEC_OMP_MASTER,
EXEC_OMP_ORDERED, EXEC_OMP_PARALLEL, EXEC_OMP_PARALLEL_DO,
EXEC_OMP_PARALLEL_SECTIONS, EXEC_OMP_PARALLEL_WORKSHARE,
EXEC_OMP_SECTIONS, EXEC_OMP_SINGLE, EXEC_OMP_WORKSHARE,
EXEC_OMP_ATOMIC, EXEC_OMP_BARRIER, EXEC_OMP_END_NOWAIT,
EXEC_OMP_END_SINGLE): New OpenMP gfc_exec_op codes.
(struct gfc_code): Add omp_clauses, omp_name, omp_namelist
and omp_bool fields to ext union.
(flag_openmp): Declare.
(gfc_free_omp_clauses, gfc_resolve_omp_directive): New prototypes.
* scanner.c (openmp_flag, openmp_locus): New variables.
(skip_free_comments, skip_fixed_comments, gfc_next_char_literal):
Handle OpenMP directive lines and conditional compilation magic
comments.
* parse.h (COMP_OMP_STRUCTURED_BLOCK): New compile state.
* parse.c (decode_omp_directive, parse_omp_do, parse_omp_atomic,
parse_omp_structured_block): New functions.
(next_free, next_fixed): Parse OpenMP directives.
(case_executable, case_exec_markers, case_decl): Add ST_OMP_*
codes.
(gfc_ascii_statement): Handle ST_OMP_* codes.
(parse_executable): Rearrange the loop slightly, so that
parse_omp_do can return next_statement.
* match.h (gfc_match_omp_eos, gfc_match_omp_atomic,
gfc_match_omp_barrier, gfc_match_omp_critical, gfc_match_omp_do,
gfc_match_omp_flush, gfc_match_omp_master, gfc_match_omp_ordered,
gfc_match_omp_parallel, gfc_match_omp_parallel_do,
gfc_match_omp_parallel_sections, gfc_match_omp_parallel_workshare,
gfc_match_omp_sections, gfc_match_omp_single,
gfc_match_omp_threadprivate, gfc_match_omp_workshare,
gfc_match_omp_end_nowait, gfc_match_omp_end_single): New prototypes.
* resolve.c (resolve_blocks): Ignore EXEC_OMP_* block directives.
(resolve_code): Call gfc_resolve_omp_directive on EXEC_OMP_*
directives.
* trans.c (gfc_trans_code): Call gfc_trans_omp_directive for
EXEC_OMP_* directives.
* st.c (gfc_free_statement): Handle EXEC_OMP_* statement freeing.
* trans-stmt.h (gfc_trans_omp_directive): New prototype.
* openmp.c: New file.
* trans-openmp.c: New file.
gcc/testsuite/
2006-02-14 Jakub Jelinek <jakub@redhat.com>
Diego Novillo <dnovillo@redhat.com>
Uros Bizjak <uros@kss-loka.si>
* gfortran.dg/gomp: New directory.
libgomp/
2006-02-14 Jakub Jelinek <jakub@redhat.com>
* testsuite/libgomp.fortran/vla7.f90: Add -w to options.
Remove tests for returning assumed character length arrays.
Co-Authored-By: Diego Novillo <dnovillo@redhat.com>
Co-Authored-By: Richard Henderson <rth@redhat.com>
Co-Authored-By: Uros Bizjak <uros@kss-loka.si>
From-SVN: r110984
2006-02-14 17:38:03 +01:00
|
|
|
@node OpenMP
|
2008-02-16 15:10:12 +01:00
|
|
|
@subsection OpenMP
|
re PR fortran/25162 (Issue with OpenMP COPYIN and gfortran)
gcc/fortran/
2006-02-14 Jakub Jelinek <jakub@redhat.com>
Richard Henderson <rth@redhat.com>
Diego Novillo <dnovillo@redhat.com>
* invoke.texi: Document -fopenmp.
* gfortran.texi (Extensions): Document OpenMP.
Backport from gomp-20050608-branch
* trans-openmp.c: Call build_omp_clause instead of
make_node when creating OMP_CLAUSE_* trees.
(gfc_trans_omp_reduction_list): Remove argument 'code'.
Adjust all callers.
* trans.h (build4_v): Define.
* trans-openmp.c: Call build4_v to create OMP_PARALLEL nodes.
Call build3_v to create OMP_SECTIONS nodes.
PR fortran/25162
* openmp.c (gfc_match_omp_variable_list): Call gfc_set_sym_referenced
on all symbols added to the variable list.
* openmp.c (gfc_match_omp_clauses): Fix check for non-INTRINSIC
procedure symbol in REDUCTION.
* trans-openmp.c (gfc_trans_omp_array_reduction): Use gfc_add
for MINUS_EXPR OMP_CLAUSE_REDUCTION_CODE.
* trans-openmp.c (gfc_trans_omp_do): Add PBLOCK argument. If PBLOCK
is non-NULL, evaluate INIT/COND/INCR and chunk size expressions in
that statement block.
(gfc_trans_omp_parallel_do): Pass non-NULL PBLOCK to gfc_trans_omp_do
for non-ordered non-static combined loops.
(gfc_trans_omp_directive): Pass NULL PBLOCK to gfc_trans_omp_do.
* openmp.c: Include target.h and toplev.h.
(gfc_match_omp_threadprivate): Emit diagnostic if target does
not support TLS.
* Make-lang.in (fortran/openmp.o): Add dependencies on
target.h and toplev.h.
* trans-decl.c (gfc_get_fake_result_decl): Set GFC_DECL_RESULT.
* trans-openmp.c (gfc_omp_privatize_by_reference): Make
DECL_ARTIFICIAL vars predetermined shared except GFC_DECL_RESULT.
(gfc_omp_disregard_value_expr): Handle GFC_DECL_RESULT.
(gfc_trans_omp_variable): New function.
(gfc_trans_omp_variable_list, gfc_trans_omp_reduction_list): Use it.
* trans.h (GFC_DECL_RESULT): Define.
* trans-openmp.c (gfc_omp_firstprivatize_type_sizes): New function.
* f95-lang.c (LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES): Define.
* trans.h (gfc_omp_firstprivatize_type_sizes): New prototype.
* trans-openmp.c (gfc_omp_privatize_by_reference): Return
true if a pointer has GFC_DECL_SAVED_DESCRIPTOR set.
(gfc_trans_omp_array_reduction, gfc_trans_omp_reduction_list): New
functions.
(gfc_trans_omp_clauses): Add WHERE argument. Call
gfc_trans_omp_reduction_list rather than gfc_trans_omp_variable_list
for reductions.
(gfc_trans_omp_do, gfc_trans_omp_parallel, gfc_trans_omp_parallel_do,
gfc_trans_omp_parallel_sections, gfc_trans_omp_parallel_workshare,
gfc_trans_omp_sections, gfc_trans_omp_single): Adjust
gfc_trans_omp_clauses callers.
* openmp.c (omp_current_do_code): New var.
(gfc_resolve_omp_do_blocks): New function.
(gfc_resolve_omp_parallel_blocks): Call it.
(gfc_resolve_do_iterator): Add CODE argument. Don't propagate
predetermination if argument is !$omp do or !$omp parallel do
iteration variable.
* resolve.c (resolve_code): Call gfc_resolve_omp_do_blocks
for EXEC_OMP_DO. Adjust gfc_resolve_do_iterator caller.
* fortran.h (gfc_resolve_omp_do_blocks): New prototype.
(gfc_resolve_do_iterator): Add CODE argument.
* trans.h (gfc_omp_predetermined_sharing,
gfc_omp_disregard_value_expr, gfc_omp_private_debug_clause): New
prototypes.
(GFC_DECL_COMMON_OR_EQUIV, GFC_DECL_CRAY_POINTEE): Define.
* trans-openmp.c (gfc_omp_predetermined_sharing,
gfc_omp_disregard_value_expr, gfc_omp_private_debug_clause): New
functions.
* trans-common.c (build_equiv_decl, build_common_decl,
create_common): Set GFC_DECL_COMMON_OR_EQUIV flag on the decls.
* trans-decl.c (gfc_finish_cray_pointee): Set GFC_DECL_CRAY_POINTEE
on the decl.
* f95-lang.c (LANG_HOOKS_OMP_PREDETERMINED_SHARING,
LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR,
LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE): Define.
* openmp.c (resolve_omp_clauses): Remove extraneous comma.
* symbol.c (check_conflict): Add conflict between cray_pointee and
threadprivate.
* openmp.c (gfc_match_omp_threadprivate): Fail if
gfc_add_threadprivate returned FAILURE.
(resolve_omp_clauses): Diagnose Cray pointees in SHARED,
{,FIRST,LAST}PRIVATE and REDUCTION clauses and Cray pointers in
{FIRST,LAST}PRIVATE and REDUCTION clauses.
* resolve.c (omp_workshare_flag): New variable.
(resolve_function): Diagnose use of non-ELEMENTAL user defined
function in WORKSHARE construct.
(resolve_code): Cleanup forall_save use. Make sure omp_workshare_flag
is set to correct value in different contexts.
* openmp.c (resolve_omp_clauses): Replace %s with '%s' when printing
variable name.
(resolve_omp_atomic): Likewise.
PR fortran/24493
* scanner.c (skip_free_comments): Set at_bol at the beginning of the
loop, not before it.
(skip_fixed_comments): Handle ! comments in the middle of line here
as well.
(gfc_skip_comments): Use skip_fixed_comments for FIXED_FORM even if
not at BOL.
(gfc_next_char_literal): Fix expected canonicalized *$omp string.
* trans-openmp.c (gfc_trans_omp_do): Use make_node and explicit
initialization to build OMP_FOR instead of build.
* trans-decl.c (gfc_gimplify_function): Invoke
diagnose_omp_structured_block_errors.
* trans-openmp.c (gfc_trans_omp_master): Use OMP_MASTER.
(gfc_trans_omp_ordered): Use OMP_ORDERED.
* gfortran.h (gfc_resolve_do_iterator, gfc_resolve_blocks,
gfc_resolve_omp_parallel_blocks): New prototypes.
* resolve.c (resolve_blocks): Renamed to...
(gfc_resolve_blocks): ... this. Remove static.
(gfc_resolve_forall): Adjust caller.
(resolve_code): Only call gfc_resolve_blocks if code->block != 0
and not for EXEC_OMP_PARALLEL* directives. Call
gfc_resolve_omp_parallel_blocks for EXEC_OMP_PARALLEL* directives.
Call gfc_resolve_do_iterator if resolved successfully EXEC_DO
iterator.
* openmp.c: Include pointer-set.h.
(omp_current_ctx): New variable.
(gfc_resolve_omp_parallel_blocks, gfc_resolve_do_iterator): New
functions.
* Make-lang.in (fortran/openmp.o): Depend on pointer-set.h.
* openmp.c (gfc_match_omp_clauses): For max/min/iand/ior/ieor,
look up symbol if it exists, use its name instead and, if it is not
INTRINSIC, issue diagnostics.
* parse.c (parse_omp_do): Handle implied end do properly.
(parse_executable): If parse_omp_do returned ST_IMPLIED_ENDDO,
return it instead of continuing.
* trans-openmp.c (gfc_trans_omp_critical): Update for changed
operand numbering.
(gfc_trans_omp_do, gfc_trans_omp_parallel, gfc_trans_omp_parallel_do,
gfc_trans_omp_parallel_sections, gfc_trans_omp_parallel_workshare,
gfc_trans_omp_sections, gfc_trans_omp_single): Likewise.
* trans.h (gfc_omp_privatize_by_reference): New prototype.
* f95-lang.c (LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Redefine
to gfc_omp_privatize_by_reference.
* trans-openmp.c (gfc_omp_privatize_by_reference): New function.
* trans-stmt.h (gfc_trans_omp_directive): Add comment.
* openmp.c (gfc_match_omp_variable_list): Add ALLOW_COMMON argument.
Disallow COMMON matching if it is set.
(gfc_match_omp_clauses, gfc_match_omp_flush): Adjust all callers.
(resolve_omp_clauses): Show locus in error messages. Check that
variable types in reduction clauses are appropriate for reduction
operators.
* resolve.c (resolve_symbol): Don't error if a threadprivate module
variable isn't SAVEd.
* trans-openmp.c (gfc_trans_omp_do): Put count into BLOCK, not BODY.
Fix typo in condition. Fix DOVAR initialization.
* openmp.c (gfc_match_omp_clauses): Match min/iand/ior/ieor
rather than .min. etc.
* trans-openmpc.c (omp_not_yet): Remove.
(gfc_trans_omp_parallel_do): Keep listprivate clause on parallel.
Force creation of BIND_EXPR around the workshare construct.
(gfc_trans_omp_parallel_sections): Likewise.
(gfc_trans_omp_parallel_workshare): Likewise.
* types.def (BT_I16, BT_FN_I16_VPTR_I16,
BT_FN_BOOL_VPTR_I16_I16, BT_FN_I16_VPTR_I16_I16): Add.
* trans-openmp.c (gfc_trans_omp_clauses): Create OMP_CLAUSE_DEFAULT.
(gfc_trans_omp_code): New function.
(gfc_trans_omp_do): Use it, remove omp_not_yet uses.
(gfc_trans_omp_parallel, gfc_trans_omp_single): Likewise.
(gfc_trans_omp_sections): Likewise. Only treat empty last section
specially if lastprivate clause is present.
* f95-lang.c (gfc_init_builtin_functions): Create BUILT_IN_TRAP
builtin.
* trans-openmp.c (gfc_trans_omp_variable_list): Update for
OMP_CLAUSE_DECL name change.
(gfc_trans_omp_do): Likewise.
* trans-openmp.c (gfc_trans_omp_clauses): Create OMP_CLAUSE_REDUCTION
clauses.
(gfc_trans_omp_atomic): Build OMP_ATOMIC instead of expanding
sync builtins directly.
(gfc_trans_omp_single): Build OMP_SINGLE statement.
* trans-openmp.c (gfc_trans_add_clause): New.
(gfc_trans_omp_variable_list): Take a tree code and build the clause
node here. Link it to the head of a list.
(gfc_trans_omp_clauses): Update to match.
(gfc_trans_omp_do): Use gfc_trans_add_clause.
* trans-openmp.c (gfc_trans_omp_clauses): Change second argument to
gfc_omp_clauses *. Use gfc_evaluate_now instead of creating
temporaries by hand.
(gfc_trans_omp_atomic, gfc_trans_omp_critical): Use buildN_v macros.
(gfc_trans_omp_do): New function.
(gfc_trans_omp_master): Dont' check for gfc_trans_code returning NULL.
(gfc_trans_omp_parallel): Adjust gfc_trans_omp_clauses caller.
Use buildN_v macros.
(gfc_trans_omp_parallel_do, gfc_trans_omp_parallel_sections,
gfc_trans_omp_parallel_workshare, gfc_trans_omp_sections,
gfc_trans_omp_single, gfc_trans_omp_workshare): New functions.
(gfc_trans_omp_directive): Use them.
* parse.c (parse_omp_do): Allow new_st.op == EXEC_NOP.
* openmp.c (resolve_omp_clauses): Check for list items present
in multiple clauses.
(resolve_omp_do): Check that iteration variable is not THREADPRIVATE
and is not present in any clause variable lists other than PRIVATE
or LASTPRIVATE.
* gfortran.h (symbol_attribute): Add threadprivate bit.
(gfc_common_head): Add threadprivate member, change use_assoc
and saved into char to save space.
(gfc_add_threadprivate): New prototype.
* symbol.c (check_conflict): Handle threadprivate.
(gfc_add_threadprivate): New function.
(gfc_copy_attr): Copy threadprivate.
* trans-openmp.c (gfc_trans_omp_clauses): Avoid creating a temporary
if IF or NUM_THREADS is constant. Create OMP_CLAUSE_SCHEDULE and
OMP_CLAUSE_ORDERED.
* resolve.c (resolve_symbol): Complain if a THREADPRIVATE symbol
outside a module and not in COMMON has is not SAVEd.
(resolve_equivalence): Ensure THREADPRIVATE objects don't get
EQUIVALENCEd.
* trans-common.c: Include target.h and rtl.h.
(build_common_decl): Set DECL_TLS_MODEL if THREADPRIVATE.
* trans-decl.c: Include rtl.h.
(gfc_finish_var_decl): Set DECL_TLS_MODEL if THREADPRIVATE.
* dump-parse-tree.c (gfc_show_attr): Handle THREADPRIVATE.
* Make-lang.in (fortran/trans-decl.o): Depend on $(RTL_H).
(fortran/trans-common.o): Depend on $(RTL_H) and $(TARGET_H).
* openmp.c (gfc_match_omp_variable_list): Ensure COMMON block
is from current namespace.
(gfc_match_omp_threadprivate): Rewrite.
(resolve_omp_clauses): Check some clause restrictions.
* module.c (ab_attribute): Add AB_THREADPRIVATE.
(attr_bits): Add THREADPRIVATE.
(mio_symbol_attribute, mio_symbol_attribute): Handle threadprivate.
(load_commons, write_common, write_blank_common): Adjust for type
change of saved, store/load threadprivate bit from the integer
as well.
* types.def (BT_FN_UINT_UINT): New.
(BT_FN_VOID_UINT_UINT): Remove.
* trans-openmp.c (gfc_trans_omp_clauses, gfc_trans_omp_barrier,
gfc_trans_omp_critical, gfc_trans_omp_flush, gfc_trans_omp_master,
gfc_trans_omp_ordered, gfc_trans_omp_parallel): New functions.
(gfc_trans_omp_directive): Use them.
* openmp.c (expr_references_sym): Add SE argument, don't look
into SE tree.
(is_conversion): New function.
(resolve_omp_atomic): Adjust expr_references_sym callers. Handle
promoted expressions.
* trans-openmp.c (gfc_trans_omp_atomic): New function.
(gfc_trans_omp_directive): Call it.
* f95-lang.c (builtin_type_for_size): New function.
(gfc_init_builtin_functions): Initialize synchronization and
OpenMP builtins.
* types.def: New file.
* Make-lang.in (f95-lang.o): Depend on $(BUILTINS_DEF) and
fortran/types.def.
* trans-openmp.c: Rename GOMP_* tree codes into OMP_*.
* dump-parse-tree.c (show_symtree): Don't crash if ns->proc_name
is NULL.
* dump-parse-tree.c (gfc_show_namelist, gfc_show_omp_node): New
functions.
(gfc_show_code_node): Call gfc_show_omp_node for EXEC_OMP_* nodes.
* parse.c (parse_omp_do): Call pop_state before next_statement.
* openmp.c (expr_references_sym, resolve_omp_atomic, resolve_omp_do):
New functions.
(gfc_resolve_omp_directive): Call them.
* match.c (match_exit_cycle): Issue error if EXIT or CYCLE statement
leaves an OpenMP structured block or if EXIT terminates !$omp do
loop.
* Make-lang.in (F95_PARSER_OBJS): Add fortran/openmp.o.
(F95_OBJS): Add fortran/trans-openmp.o.
(fortran/trans-openmp.o): Depend on $(GFORTRAN_TRANS_DEPS).
* lang.opt: Add -fopenmp option.
* options.c (gfc_init_options): Initialize it.
(gfc_handle_option): Handle it.
* gfortran.h (ST_OMP_ATOMIC, ST_OMP_BARRIER, ST_OMP_CRITICAL,
ST_OMP_END_CRITICAL, ST_OMP_END_DO, ST_OMP_END_MASTER,
ST_OMP_END_ORDERED, ST_OMP_END_PARALLEL, ST_OMP_END_PARALLEL_DO,
ST_OMP_END_PARALLEL_SECTIONS, ST_OMP_END_PARALLEL_WORKSHARE,
ST_OMP_END_SECTIONS, ST_OMP_END_SINGLE, ST_OMP_END_WORKSHARE,
ST_OMP_DO, ST_OMP_FLUSH, ST_OMP_MASTER, ST_OMP_ORDERED,
ST_OMP_PARALLEL, ST_OMP_PARALLEL_DO, ST_OMP_PARALLEL_SECTIONS,
ST_OMP_PARALLEL_WORKSHARE, ST_OMP_SECTIONS, ST_OMP_SECTION,
ST_OMP_SINGLE, ST_OMP_THREADPRIVATE, ST_OMP_WORKSHARE): New
statement codes.
(OMP_LIST_PRIVATE, OMP_LIST_FIRSTPRIVATE, OMP_LIST_LASTPRIVATE,
OMP_LIST_COPYPRIVATE, OMP_LIST_SHARED, OMP_LIST_COPYIN,
OMP_LIST_PLUS, OMP_LIST_REDUCTION_FIRST, OMP_LIST_MULT,
OMP_LIST_SUB, OMP_LIST_AND, OMP_LIST_OR, OMP_LIST_EQV,
OMP_LIST_NEQV, OMP_LIST_MAX, OMP_LIST_MIN, OMP_LIST_IAND,
OMP_LIST_IOR, OMP_LIST_IEOR, OMP_LIST_REDUCTION_LAST, OMP_LIST_NUM):
New OpenMP variable list types.
(gfc_omp_clauses): New typedef.
(gfc_get_omp_clauses): Define.
(EXEC_OMP_CRITICAL, EXEC_OMP_DO, EXEC_OMP_FLUSH, EXEC_OMP_MASTER,
EXEC_OMP_ORDERED, EXEC_OMP_PARALLEL, EXEC_OMP_PARALLEL_DO,
EXEC_OMP_PARALLEL_SECTIONS, EXEC_OMP_PARALLEL_WORKSHARE,
EXEC_OMP_SECTIONS, EXEC_OMP_SINGLE, EXEC_OMP_WORKSHARE,
EXEC_OMP_ATOMIC, EXEC_OMP_BARRIER, EXEC_OMP_END_NOWAIT,
EXEC_OMP_END_SINGLE): New OpenMP gfc_exec_op codes.
(struct gfc_code): Add omp_clauses, omp_name, omp_namelist
and omp_bool fields to ext union.
(flag_openmp): Declare.
(gfc_free_omp_clauses, gfc_resolve_omp_directive): New prototypes.
* scanner.c (openmp_flag, openmp_locus): New variables.
(skip_free_comments, skip_fixed_comments, gfc_next_char_literal):
Handle OpenMP directive lines and conditional compilation magic
comments.
* parse.h (COMP_OMP_STRUCTURED_BLOCK): New compile state.
* parse.c (decode_omp_directive, parse_omp_do, parse_omp_atomic,
parse_omp_structured_block): New functions.
(next_free, next_fixed): Parse OpenMP directives.
(case_executable, case_exec_markers, case_decl): Add ST_OMP_*
codes.
(gfc_ascii_statement): Handle ST_OMP_* codes.
(parse_executable): Rearrange the loop slightly, so that
parse_omp_do can return next_statement.
* match.h (gfc_match_omp_eos, gfc_match_omp_atomic,
gfc_match_omp_barrier, gfc_match_omp_critical, gfc_match_omp_do,
gfc_match_omp_flush, gfc_match_omp_master, gfc_match_omp_ordered,
gfc_match_omp_parallel, gfc_match_omp_parallel_do,
gfc_match_omp_parallel_sections, gfc_match_omp_parallel_workshare,
gfc_match_omp_sections, gfc_match_omp_single,
gfc_match_omp_threadprivate, gfc_match_omp_workshare,
gfc_match_omp_end_nowait, gfc_match_omp_end_single): New prototypes.
* resolve.c (resolve_blocks): Ignore EXEC_OMP_* block directives.
(resolve_code): Call gfc_resolve_omp_directive on EXEC_OMP_*
directives.
* trans.c (gfc_trans_code): Call gfc_trans_omp_directive for
EXEC_OMP_* directives.
* st.c (gfc_free_statement): Handle EXEC_OMP_* statement freeing.
* trans-stmt.h (gfc_trans_omp_directive): New prototype.
* openmp.c: New file.
* trans-openmp.c: New file.
gcc/testsuite/
2006-02-14 Jakub Jelinek <jakub@redhat.com>
Diego Novillo <dnovillo@redhat.com>
Uros Bizjak <uros@kss-loka.si>
* gfortran.dg/gomp: New directory.
libgomp/
2006-02-14 Jakub Jelinek <jakub@redhat.com>
* testsuite/libgomp.fortran/vla7.f90: Add -w to options.
Remove tests for returning assumed character length arrays.
Co-Authored-By: Diego Novillo <dnovillo@redhat.com>
Co-Authored-By: Richard Henderson <rth@redhat.com>
Co-Authored-By: Uros Bizjak <uros@kss-loka.si>
From-SVN: r110984
2006-02-14 17:38:03 +01:00
|
|
|
@cindex OpenMP
|
|
|
|
|
2008-01-24 19:28:11 +01:00
|
|
|
OpenMP (Open Multi-Processing) is an application programming
|
|
|
|
interface (API) that supports multi-platform shared memory
|
|
|
|
multiprocessing programming in C/C++ and Fortran on many
|
|
|
|
architectures, including Unix and Microsoft Windows platforms.
|
|
|
|
It consists of a set of compiler directives, library routines,
|
|
|
|
and environment variables that influence run-time behavior.
|
|
|
|
|
|
|
|
GNU Fortran strives to be compatible to the
|
2014-06-18 22:57:19 +02:00
|
|
|
@uref{http://openmp.org/wp/openmp-specifications/,
|
2016-11-10 18:05:18 +01:00
|
|
|
OpenMP Application Program Interface v4.5}.
|
2008-01-24 19:28:11 +01:00
|
|
|
|
|
|
|
To enable the processing of the OpenMP directive @code{!$omp} in
|
|
|
|
free-form source code; the @code{c$omp}, @code{*$omp} and @code{!$omp}
|
|
|
|
directives in fixed form; the @code{!$} conditional compilation sentinels
|
|
|
|
in free form; and the @code{c$}, @code{*$} and @code{!$} sentinels
|
|
|
|
in fixed form, @command{gfortran} needs to be invoked with the
|
2010-09-24 08:39:20 +02:00
|
|
|
@option{-fopenmp}. This also arranges for automatic linking of the
|
2015-01-10 20:10:37 +01:00
|
|
|
GNU Offloading and Multi Processing Runtime Library
|
|
|
|
@ref{Top,,libgomp,libgomp,GNU Offloading and Multi Processing Runtime
|
|
|
|
Library}.
|
2008-01-24 19:28:11 +01:00
|
|
|
|
|
|
|
The OpenMP Fortran runtime library routines are provided both in a
|
|
|
|
form of a Fortran 90 module named @code{omp_lib} and in a form of
|
|
|
|
a Fortran @code{include} file named @file{omp_lib.h}.
|
|
|
|
|
|
|
|
An example of a parallelized loop taken from Appendix A.1 of
|
|
|
|
the OpenMP Application Program Interface v2.5:
|
|
|
|
@smallexample
|
|
|
|
SUBROUTINE A1(N, A, B)
|
|
|
|
INTEGER I, N
|
|
|
|
REAL B(N), A(N)
|
|
|
|
!$OMP PARALLEL DO !I is private by default
|
|
|
|
DO I=2,N
|
|
|
|
B(I) = (A(I) + A(I-1)) / 2.0
|
|
|
|
ENDDO
|
|
|
|
!$OMP END PARALLEL DO
|
|
|
|
END SUBROUTINE A1
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
Please note:
|
|
|
|
@itemize
|
|
|
|
@item
|
2008-02-22 07:01:51 +01:00
|
|
|
@option{-fopenmp} implies @option{-frecursive}, i.e., all local arrays
|
2010-09-24 08:39:20 +02:00
|
|
|
will be allocated on the stack. When porting existing code to OpenMP,
|
2008-01-24 19:28:11 +01:00
|
|
|
this may lead to surprising results, especially to segmentation faults
|
|
|
|
if the stacksize is limited.
|
|
|
|
|
|
|
|
@item
|
2009-06-03 22:32:23 +02:00
|
|
|
On glibc-based systems, OpenMP enabled applications cannot be statically
|
2010-09-24 08:39:20 +02:00
|
|
|
linked due to limitations of the underlying pthreads-implementation. It
|
2008-01-24 19:28:11 +01:00
|
|
|
might be possible to get a working solution if
|
|
|
|
@command{-Wl,--whole-archive -lpthread -Wl,--no-whole-archive} is added
|
2010-09-24 08:39:20 +02:00
|
|
|
to the command line. However, this is not supported by @command{gcc} and
|
2008-01-24 19:28:11 +01:00
|
|
|
thus not recommended.
|
|
|
|
@end itemize
|
re PR fortran/25162 (Issue with OpenMP COPYIN and gfortran)
gcc/fortran/
2006-02-14 Jakub Jelinek <jakub@redhat.com>
Richard Henderson <rth@redhat.com>
Diego Novillo <dnovillo@redhat.com>
* invoke.texi: Document -fopenmp.
* gfortran.texi (Extensions): Document OpenMP.
Backport from gomp-20050608-branch
* trans-openmp.c: Call build_omp_clause instead of
make_node when creating OMP_CLAUSE_* trees.
(gfc_trans_omp_reduction_list): Remove argument 'code'.
Adjust all callers.
* trans.h (build4_v): Define.
* trans-openmp.c: Call build4_v to create OMP_PARALLEL nodes.
Call build3_v to create OMP_SECTIONS nodes.
PR fortran/25162
* openmp.c (gfc_match_omp_variable_list): Call gfc_set_sym_referenced
on all symbols added to the variable list.
* openmp.c (gfc_match_omp_clauses): Fix check for non-INTRINSIC
procedure symbol in REDUCTION.
* trans-openmp.c (gfc_trans_omp_array_reduction): Use gfc_add
for MINUS_EXPR OMP_CLAUSE_REDUCTION_CODE.
* trans-openmp.c (gfc_trans_omp_do): Add PBLOCK argument. If PBLOCK
is non-NULL, evaluate INIT/COND/INCR and chunk size expressions in
that statement block.
(gfc_trans_omp_parallel_do): Pass non-NULL PBLOCK to gfc_trans_omp_do
for non-ordered non-static combined loops.
(gfc_trans_omp_directive): Pass NULL PBLOCK to gfc_trans_omp_do.
* openmp.c: Include target.h and toplev.h.
(gfc_match_omp_threadprivate): Emit diagnostic if target does
not support TLS.
* Make-lang.in (fortran/openmp.o): Add dependencies on
target.h and toplev.h.
* trans-decl.c (gfc_get_fake_result_decl): Set GFC_DECL_RESULT.
* trans-openmp.c (gfc_omp_privatize_by_reference): Make
DECL_ARTIFICIAL vars predetermined shared except GFC_DECL_RESULT.
(gfc_omp_disregard_value_expr): Handle GFC_DECL_RESULT.
(gfc_trans_omp_variable): New function.
(gfc_trans_omp_variable_list, gfc_trans_omp_reduction_list): Use it.
* trans.h (GFC_DECL_RESULT): Define.
* trans-openmp.c (gfc_omp_firstprivatize_type_sizes): New function.
* f95-lang.c (LANG_HOOKS_OMP_FIRSTPRIVATIZE_TYPE_SIZES): Define.
* trans.h (gfc_omp_firstprivatize_type_sizes): New prototype.
* trans-openmp.c (gfc_omp_privatize_by_reference): Return
true if a pointer has GFC_DECL_SAVED_DESCRIPTOR set.
(gfc_trans_omp_array_reduction, gfc_trans_omp_reduction_list): New
functions.
(gfc_trans_omp_clauses): Add WHERE argument. Call
gfc_trans_omp_reduction_list rather than gfc_trans_omp_variable_list
for reductions.
(gfc_trans_omp_do, gfc_trans_omp_parallel, gfc_trans_omp_parallel_do,
gfc_trans_omp_parallel_sections, gfc_trans_omp_parallel_workshare,
gfc_trans_omp_sections, gfc_trans_omp_single): Adjust
gfc_trans_omp_clauses callers.
* openmp.c (omp_current_do_code): New var.
(gfc_resolve_omp_do_blocks): New function.
(gfc_resolve_omp_parallel_blocks): Call it.
(gfc_resolve_do_iterator): Add CODE argument. Don't propagate
predetermination if argument is !$omp do or !$omp parallel do
iteration variable.
* resolve.c (resolve_code): Call gfc_resolve_omp_do_blocks
for EXEC_OMP_DO. Adjust gfc_resolve_do_iterator caller.
* fortran.h (gfc_resolve_omp_do_blocks): New prototype.
(gfc_resolve_do_iterator): Add CODE argument.
* trans.h (gfc_omp_predetermined_sharing,
gfc_omp_disregard_value_expr, gfc_omp_private_debug_clause): New
prototypes.
(GFC_DECL_COMMON_OR_EQUIV, GFC_DECL_CRAY_POINTEE): Define.
* trans-openmp.c (gfc_omp_predetermined_sharing,
gfc_omp_disregard_value_expr, gfc_omp_private_debug_clause): New
functions.
* trans-common.c (build_equiv_decl, build_common_decl,
create_common): Set GFC_DECL_COMMON_OR_EQUIV flag on the decls.
* trans-decl.c (gfc_finish_cray_pointee): Set GFC_DECL_CRAY_POINTEE
on the decl.
* f95-lang.c (LANG_HOOKS_OMP_PREDETERMINED_SHARING,
LANG_HOOKS_OMP_DISREGARD_VALUE_EXPR,
LANG_HOOKS_OMP_PRIVATE_DEBUG_CLAUSE): Define.
* openmp.c (resolve_omp_clauses): Remove extraneous comma.
* symbol.c (check_conflict): Add conflict between cray_pointee and
threadprivate.
* openmp.c (gfc_match_omp_threadprivate): Fail if
gfc_add_threadprivate returned FAILURE.
(resolve_omp_clauses): Diagnose Cray pointees in SHARED,
{,FIRST,LAST}PRIVATE and REDUCTION clauses and Cray pointers in
{FIRST,LAST}PRIVATE and REDUCTION clauses.
* resolve.c (omp_workshare_flag): New variable.
(resolve_function): Diagnose use of non-ELEMENTAL user defined
function in WORKSHARE construct.
(resolve_code): Cleanup forall_save use. Make sure omp_workshare_flag
is set to correct value in different contexts.
* openmp.c (resolve_omp_clauses): Replace %s with '%s' when printing
variable name.
(resolve_omp_atomic): Likewise.
PR fortran/24493
* scanner.c (skip_free_comments): Set at_bol at the beginning of the
loop, not before it.
(skip_fixed_comments): Handle ! comments in the middle of line here
as well.
(gfc_skip_comments): Use skip_fixed_comments for FIXED_FORM even if
not at BOL.
(gfc_next_char_literal): Fix expected canonicalized *$omp string.
* trans-openmp.c (gfc_trans_omp_do): Use make_node and explicit
initialization to build OMP_FOR instead of build.
* trans-decl.c (gfc_gimplify_function): Invoke
diagnose_omp_structured_block_errors.
* trans-openmp.c (gfc_trans_omp_master): Use OMP_MASTER.
(gfc_trans_omp_ordered): Use OMP_ORDERED.
* gfortran.h (gfc_resolve_do_iterator, gfc_resolve_blocks,
gfc_resolve_omp_parallel_blocks): New prototypes.
* resolve.c (resolve_blocks): Renamed to...
(gfc_resolve_blocks): ... this. Remove static.
(gfc_resolve_forall): Adjust caller.
(resolve_code): Only call gfc_resolve_blocks if code->block != 0
and not for EXEC_OMP_PARALLEL* directives. Call
gfc_resolve_omp_parallel_blocks for EXEC_OMP_PARALLEL* directives.
Call gfc_resolve_do_iterator if resolved successfully EXEC_DO
iterator.
* openmp.c: Include pointer-set.h.
(omp_current_ctx): New variable.
(gfc_resolve_omp_parallel_blocks, gfc_resolve_do_iterator): New
functions.
* Make-lang.in (fortran/openmp.o): Depend on pointer-set.h.
* openmp.c (gfc_match_omp_clauses): For max/min/iand/ior/ieor,
look up symbol if it exists, use its name instead and, if it is not
INTRINSIC, issue diagnostics.
* parse.c (parse_omp_do): Handle implied end do properly.
(parse_executable): If parse_omp_do returned ST_IMPLIED_ENDDO,
return it instead of continuing.
* trans-openmp.c (gfc_trans_omp_critical): Update for changed
operand numbering.
(gfc_trans_omp_do, gfc_trans_omp_parallel, gfc_trans_omp_parallel_do,
gfc_trans_omp_parallel_sections, gfc_trans_omp_parallel_workshare,
gfc_trans_omp_sections, gfc_trans_omp_single): Likewise.
* trans.h (gfc_omp_privatize_by_reference): New prototype.
* f95-lang.c (LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Redefine
to gfc_omp_privatize_by_reference.
* trans-openmp.c (gfc_omp_privatize_by_reference): New function.
* trans-stmt.h (gfc_trans_omp_directive): Add comment.
* openmp.c (gfc_match_omp_variable_list): Add ALLOW_COMMON argument.
Disallow COMMON matching if it is set.
(gfc_match_omp_clauses, gfc_match_omp_flush): Adjust all callers.
(resolve_omp_clauses): Show locus in error messages. Check that
variable types in reduction clauses are appropriate for reduction
operators.
* resolve.c (resolve_symbol): Don't error if a threadprivate module
variable isn't SAVEd.
* trans-openmp.c (gfc_trans_omp_do): Put count into BLOCK, not BODY.
Fix typo in condition. Fix DOVAR initialization.
* openmp.c (gfc_match_omp_clauses): Match min/iand/ior/ieor
rather than .min. etc.
* trans-openmpc.c (omp_not_yet): Remove.
(gfc_trans_omp_parallel_do): Keep listprivate clause on parallel.
Force creation of BIND_EXPR around the workshare construct.
(gfc_trans_omp_parallel_sections): Likewise.
(gfc_trans_omp_parallel_workshare): Likewise.
* types.def (BT_I16, BT_FN_I16_VPTR_I16,
BT_FN_BOOL_VPTR_I16_I16, BT_FN_I16_VPTR_I16_I16): Add.
* trans-openmp.c (gfc_trans_omp_clauses): Create OMP_CLAUSE_DEFAULT.
(gfc_trans_omp_code): New function.
(gfc_trans_omp_do): Use it, remove omp_not_yet uses.
(gfc_trans_omp_parallel, gfc_trans_omp_single): Likewise.
(gfc_trans_omp_sections): Likewise. Only treat empty last section
specially if lastprivate clause is present.
* f95-lang.c (gfc_init_builtin_functions): Create BUILT_IN_TRAP
builtin.
* trans-openmp.c (gfc_trans_omp_variable_list): Update for
OMP_CLAUSE_DECL name change.
(gfc_trans_omp_do): Likewise.
* trans-openmp.c (gfc_trans_omp_clauses): Create OMP_CLAUSE_REDUCTION
clauses.
(gfc_trans_omp_atomic): Build OMP_ATOMIC instead of expanding
sync builtins directly.
(gfc_trans_omp_single): Build OMP_SINGLE statement.
* trans-openmp.c (gfc_trans_add_clause): New.
(gfc_trans_omp_variable_list): Take a tree code and build the clause
node here. Link it to the head of a list.
(gfc_trans_omp_clauses): Update to match.
(gfc_trans_omp_do): Use gfc_trans_add_clause.
* trans-openmp.c (gfc_trans_omp_clauses): Change second argument to
gfc_omp_clauses *. Use gfc_evaluate_now instead of creating
temporaries by hand.
(gfc_trans_omp_atomic, gfc_trans_omp_critical): Use buildN_v macros.
(gfc_trans_omp_do): New function.
(gfc_trans_omp_master): Dont' check for gfc_trans_code returning NULL.
(gfc_trans_omp_parallel): Adjust gfc_trans_omp_clauses caller.
Use buildN_v macros.
(gfc_trans_omp_parallel_do, gfc_trans_omp_parallel_sections,
gfc_trans_omp_parallel_workshare, gfc_trans_omp_sections,
gfc_trans_omp_single, gfc_trans_omp_workshare): New functions.
(gfc_trans_omp_directive): Use them.
* parse.c (parse_omp_do): Allow new_st.op == EXEC_NOP.
* openmp.c (resolve_omp_clauses): Check for list items present
in multiple clauses.
(resolve_omp_do): Check that iteration variable is not THREADPRIVATE
and is not present in any clause variable lists other than PRIVATE
or LASTPRIVATE.
* gfortran.h (symbol_attribute): Add threadprivate bit.
(gfc_common_head): Add threadprivate member, change use_assoc
and saved into char to save space.
(gfc_add_threadprivate): New prototype.
* symbol.c (check_conflict): Handle threadprivate.
(gfc_add_threadprivate): New function.
(gfc_copy_attr): Copy threadprivate.
* trans-openmp.c (gfc_trans_omp_clauses): Avoid creating a temporary
if IF or NUM_THREADS is constant. Create OMP_CLAUSE_SCHEDULE and
OMP_CLAUSE_ORDERED.
* resolve.c (resolve_symbol): Complain if a THREADPRIVATE symbol
outside a module and not in COMMON has is not SAVEd.
(resolve_equivalence): Ensure THREADPRIVATE objects don't get
EQUIVALENCEd.
* trans-common.c: Include target.h and rtl.h.
(build_common_decl): Set DECL_TLS_MODEL if THREADPRIVATE.
* trans-decl.c: Include rtl.h.
(gfc_finish_var_decl): Set DECL_TLS_MODEL if THREADPRIVATE.
* dump-parse-tree.c (gfc_show_attr): Handle THREADPRIVATE.
* Make-lang.in (fortran/trans-decl.o): Depend on $(RTL_H).
(fortran/trans-common.o): Depend on $(RTL_H) and $(TARGET_H).
* openmp.c (gfc_match_omp_variable_list): Ensure COMMON block
is from current namespace.
(gfc_match_omp_threadprivate): Rewrite.
(resolve_omp_clauses): Check some clause restrictions.
* module.c (ab_attribute): Add AB_THREADPRIVATE.
(attr_bits): Add THREADPRIVATE.
(mio_symbol_attribute, mio_symbol_attribute): Handle threadprivate.
(load_commons, write_common, write_blank_common): Adjust for type
change of saved, store/load threadprivate bit from the integer
as well.
* types.def (BT_FN_UINT_UINT): New.
(BT_FN_VOID_UINT_UINT): Remove.
* trans-openmp.c (gfc_trans_omp_clauses, gfc_trans_omp_barrier,
gfc_trans_omp_critical, gfc_trans_omp_flush, gfc_trans_omp_master,
gfc_trans_omp_ordered, gfc_trans_omp_parallel): New functions.
(gfc_trans_omp_directive): Use them.
* openmp.c (expr_references_sym): Add SE argument, don't look
into SE tree.
(is_conversion): New function.
(resolve_omp_atomic): Adjust expr_references_sym callers. Handle
promoted expressions.
* trans-openmp.c (gfc_trans_omp_atomic): New function.
(gfc_trans_omp_directive): Call it.
* f95-lang.c (builtin_type_for_size): New function.
(gfc_init_builtin_functions): Initialize synchronization and
OpenMP builtins.
* types.def: New file.
* Make-lang.in (f95-lang.o): Depend on $(BUILTINS_DEF) and
fortran/types.def.
* trans-openmp.c: Rename GOMP_* tree codes into OMP_*.
* dump-parse-tree.c (show_symtree): Don't crash if ns->proc_name
is NULL.
* dump-parse-tree.c (gfc_show_namelist, gfc_show_omp_node): New
functions.
(gfc_show_code_node): Call gfc_show_omp_node for EXEC_OMP_* nodes.
* parse.c (parse_omp_do): Call pop_state before next_statement.
* openmp.c (expr_references_sym, resolve_omp_atomic, resolve_omp_do):
New functions.
(gfc_resolve_omp_directive): Call them.
* match.c (match_exit_cycle): Issue error if EXIT or CYCLE statement
leaves an OpenMP structured block or if EXIT terminates !$omp do
loop.
* Make-lang.in (F95_PARSER_OBJS): Add fortran/openmp.o.
(F95_OBJS): Add fortran/trans-openmp.o.
(fortran/trans-openmp.o): Depend on $(GFORTRAN_TRANS_DEPS).
* lang.opt: Add -fopenmp option.
* options.c (gfc_init_options): Initialize it.
(gfc_handle_option): Handle it.
* gfortran.h (ST_OMP_ATOMIC, ST_OMP_BARRIER, ST_OMP_CRITICAL,
ST_OMP_END_CRITICAL, ST_OMP_END_DO, ST_OMP_END_MASTER,
ST_OMP_END_ORDERED, ST_OMP_END_PARALLEL, ST_OMP_END_PARALLEL_DO,
ST_OMP_END_PARALLEL_SECTIONS, ST_OMP_END_PARALLEL_WORKSHARE,
ST_OMP_END_SECTIONS, ST_OMP_END_SINGLE, ST_OMP_END_WORKSHARE,
ST_OMP_DO, ST_OMP_FLUSH, ST_OMP_MASTER, ST_OMP_ORDERED,
ST_OMP_PARALLEL, ST_OMP_PARALLEL_DO, ST_OMP_PARALLEL_SECTIONS,
ST_OMP_PARALLEL_WORKSHARE, ST_OMP_SECTIONS, ST_OMP_SECTION,
ST_OMP_SINGLE, ST_OMP_THREADPRIVATE, ST_OMP_WORKSHARE): New
statement codes.
(OMP_LIST_PRIVATE, OMP_LIST_FIRSTPRIVATE, OMP_LIST_LASTPRIVATE,
OMP_LIST_COPYPRIVATE, OMP_LIST_SHARED, OMP_LIST_COPYIN,
OMP_LIST_PLUS, OMP_LIST_REDUCTION_FIRST, OMP_LIST_MULT,
OMP_LIST_SUB, OMP_LIST_AND, OMP_LIST_OR, OMP_LIST_EQV,
OMP_LIST_NEQV, OMP_LIST_MAX, OMP_LIST_MIN, OMP_LIST_IAND,
OMP_LIST_IOR, OMP_LIST_IEOR, OMP_LIST_REDUCTION_LAST, OMP_LIST_NUM):
New OpenMP variable list types.
(gfc_omp_clauses): New typedef.
(gfc_get_omp_clauses): Define.
(EXEC_OMP_CRITICAL, EXEC_OMP_DO, EXEC_OMP_FLUSH, EXEC_OMP_MASTER,
EXEC_OMP_ORDERED, EXEC_OMP_PARALLEL, EXEC_OMP_PARALLEL_DO,
EXEC_OMP_PARALLEL_SECTIONS, EXEC_OMP_PARALLEL_WORKSHARE,
EXEC_OMP_SECTIONS, EXEC_OMP_SINGLE, EXEC_OMP_WORKSHARE,
EXEC_OMP_ATOMIC, EXEC_OMP_BARRIER, EXEC_OMP_END_NOWAIT,
EXEC_OMP_END_SINGLE): New OpenMP gfc_exec_op codes.
(struct gfc_code): Add omp_clauses, omp_name, omp_namelist
and omp_bool fields to ext union.
(flag_openmp): Declare.
(gfc_free_omp_clauses, gfc_resolve_omp_directive): New prototypes.
* scanner.c (openmp_flag, openmp_locus): New variables.
(skip_free_comments, skip_fixed_comments, gfc_next_char_literal):
Handle OpenMP directive lines and conditional compilation magic
comments.
* parse.h (COMP_OMP_STRUCTURED_BLOCK): New compile state.
* parse.c (decode_omp_directive, parse_omp_do, parse_omp_atomic,
parse_omp_structured_block): New functions.
(next_free, next_fixed): Parse OpenMP directives.
(case_executable, case_exec_markers, case_decl): Add ST_OMP_*
codes.
(gfc_ascii_statement): Handle ST_OMP_* codes.
(parse_executable): Rearrange the loop slightly, so that
parse_omp_do can return next_statement.
* match.h (gfc_match_omp_eos, gfc_match_omp_atomic,
gfc_match_omp_barrier, gfc_match_omp_critical, gfc_match_omp_do,
gfc_match_omp_flush, gfc_match_omp_master, gfc_match_omp_ordered,
gfc_match_omp_parallel, gfc_match_omp_parallel_do,
gfc_match_omp_parallel_sections, gfc_match_omp_parallel_workshare,
gfc_match_omp_sections, gfc_match_omp_single,
gfc_match_omp_threadprivate, gfc_match_omp_workshare,
gfc_match_omp_end_nowait, gfc_match_omp_end_single): New prototypes.
* resolve.c (resolve_blocks): Ignore EXEC_OMP_* block directives.
(resolve_code): Call gfc_resolve_omp_directive on EXEC_OMP_*
directives.
* trans.c (gfc_trans_code): Call gfc_trans_omp_directive for
EXEC_OMP_* directives.
* st.c (gfc_free_statement): Handle EXEC_OMP_* statement freeing.
* trans-stmt.h (gfc_trans_omp_directive): New prototype.
* openmp.c: New file.
* trans-openmp.c: New file.
gcc/testsuite/
2006-02-14 Jakub Jelinek <jakub@redhat.com>
Diego Novillo <dnovillo@redhat.com>
Uros Bizjak <uros@kss-loka.si>
* gfortran.dg/gomp: New directory.
libgomp/
2006-02-14 Jakub Jelinek <jakub@redhat.com>
* testsuite/libgomp.fortran/vla7.f90: Add -w to options.
Remove tests for returning assumed character length arrays.
Co-Authored-By: Diego Novillo <dnovillo@redhat.com>
Co-Authored-By: Richard Henderson <rth@redhat.com>
Co-Authored-By: Uros Bizjak <uros@kss-loka.si>
From-SVN: r110984
2006-02-14 17:38:03 +01:00
|
|
|
|
Merge current set of OpenACC changes from gomp-4_0-branch.
contrib/
* gcc_update (files_and_dependencies): Update rules for new
libgomp/plugin/Makefrag.am and libgomp/plugin/configfrag.ac files.
gcc/
* builtin-types.def (BT_FN_VOID_INT_INT_VAR)
(BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR)
(BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR):
New function types.
* builtins.c: Include "gomp-constants.h".
(expand_builtin_acc_on_device): New function.
(expand_builtin, is_inexpensive_builtin): Handle
BUILT_IN_ACC_ON_DEVICE.
* builtins.def (DEF_GOACC_BUILTIN, DEF_GOACC_BUILTIN_COMPILER):
New macros.
* cgraph.c (cgraph_node::create): Consider flag_openacc next to
flag_openmp.
* config.gcc <nvptx-*> (tm_file): Add nvptx/offload.h.
<*-intelmic-* | *-intelmicemul-*> (tm_file): Add
i386/intelmic-offload.h.
* gcc.c (LINK_COMMAND_SPEC, GOMP_SELF_SPECS): For -fopenacc, link
to libgomp and its dependencies.
* config/arc/arc.h (LINK_COMMAND_SPEC): Likewise.
* config/darwin.h (LINK_COMMAND_SPEC_A): Likewise.
* config/i386/mingw32.h (GOMP_SELF_SPECS): Likewise.
* config/ia64/hpux.h (LIB_SPEC): Likewise.
* config/pa/pa-hpux11.h (LIB_SPEC): Likewise.
* config/pa/pa64-hpux.h (LIB_SPEC): Likewise.
* doc/generic.texi: Update for OpenACC changes.
* doc/gimple.texi: Likewise.
* doc/invoke.texi: Likewise.
* doc/sourcebuild.texi: Likewise.
* gimple-pretty-print.c (dump_gimple_omp_for): Handle
GF_OMP_FOR_KIND_OACC_LOOP.
(dump_gimple_omp_target): Handle GF_OMP_TARGET_KIND_OACC_KERNELS,
GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_DATA,
GF_OMP_TARGET_KIND_OACC_UPDATE,
GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA.
Dump more data.
* gimple.c: Update comments for OpenACC changes.
* gimple.def: Likewise.
* gimple.h: Likewise.
(enum gf_mask): Add GF_OMP_FOR_KIND_OACC_LOOP,
GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS,
GF_OMP_TARGET_KIND_OACC_DATA, GF_OMP_TARGET_KIND_OACC_UPDATE,
GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA.
(gimple_omp_for_cond, gimple_omp_for_set_cond): Sort in the
appropriate place.
(is_gimple_omp_oacc, is_gimple_omp_offloaded): New functions.
* gimplify.c: Include "gomp-constants.h".
Update comments for OpenACC changes.
(is_gimple_stmt): Handle OACC_PARALLEL, OACC_KERNELS, OACC_DATA,
OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE, OACC_ENTER_DATA,
OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP.
(gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle
OMP_CLAUSE__CACHE_, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT,
OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS,
OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER,
OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT,
OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_INDEPENDENT, OMP_CLAUSE_AUTO,
OMP_CLAUSE_SEQ.
(gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Use
GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use
OMP_CLAUSE_SET_MAP_KIND.
(gimplify_oacc_cache): New function.
(gimplify_omp_for): Handle OACC_LOOP.
(gimplify_omp_workshare): Handle OACC_KERNELS, OACC_PARALLEL,
OACC_DATA.
(gimplify_omp_target_update): Handle OACC_ENTER_DATA,
OACC_EXIT_DATA, OACC_UPDATE.
(gimplify_expr): Handle OACC_LOOP, OACC_CACHE, OACC_HOST_DATA,
OACC_DECLARE, OACC_KERNELS, OACC_PARALLEL, OACC_DATA,
OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE.
(gimplify_body): Consider flag_openacc next to flag_openmp.
* lto-streamer-out.c: Include "gomp-constants.h".
* omp-builtins.def (BUILT_IN_ACC_GET_DEVICE_TYPE)
(BUILT_IN_GOACC_DATA_START, BUILT_IN_GOACC_DATA_END)
(BUILT_IN_GOACC_ENTER_EXIT_DATA, BUILT_IN_GOACC_PARALLEL)
(BUILT_IN_GOACC_UPDATE, BUILT_IN_GOACC_WAIT)
(BUILT_IN_GOACC_GET_THREAD_NUM, BUILT_IN_GOACC_GET_NUM_THREADS)
(BUILT_IN_ACC_ON_DEVICE): New builtins.
* omp-low.c: Include "gomp-constants.h".
Update comments for OpenACC changes.
(struct omp_context): Add reduction_map, gwv_below, gwv_this
members.
(extract_omp_for_data, use_pointer_for_field, install_var_field)
(new_omp_context, delete_omp_context, scan_sharing_clauses)
(create_omp_child_function, scan_omp_for, scan_omp_target)
(check_omp_nesting_restrictions, lower_reduction_clauses)
(build_omp_regions_1, diagnose_sb_0, make_gimple_omp_edges):
Update for OpenACC changes.
(scan_sharing_clauses): Handle OMP_CLAUSE_NUM_GANGS:
OMP_CLAUSE_NUM_WORKERS: OMP_CLAUSE_VECTOR_LENGTH,
OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT, OMP_CLAUSE_GANG,
OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_DEVICE_RESIDENT,
OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_INDEPENDENT,
OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ. Use GOMP_MAP_* instead of
OMP_CLAUSE_MAP_*.
(expand_omp_for_static_nochunk, expand_omp_for_static_chunk):
Handle GF_OMP_FOR_KIND_OACC_LOOP.
(expand_omp_target, lower_omp_target): Handle
GF_OMP_TARGET_KIND_OACC_PARALLEL, GF_OMP_TARGET_KIND_OACC_KERNELS,
GF_OMP_TARGET_KIND_OACC_UPDATE,
GF_OMP_TARGET_KIND_OACC_ENTER_EXIT_DATA,
GF_OMP_TARGET_KIND_OACC_DATA.
(pass_expand_omp::execute, execute_lower_omp)
(pass_diagnose_omp_blocks::gate): Consider flag_openacc next to
flag_openmp.
(offload_symbol_decl): New variable.
(oacc_get_reduction_array_id, oacc_max_threads)
(get_offload_symbol_decl, get_base_type, lookup_oacc_reduction)
(maybe_lookup_oacc_reduction, enclosing_target_ctx)
(oacc_loop_or_target_p, oacc_lower_reduction_var_helper)
(oacc_gimple_assign, oacc_initialize_reduction_data)
(oacc_finalize_reduction_data, oacc_process_reduction_data): New
functions.
(is_targetreg_ctx): Remove function.
* tree-core.h (enum omp_clause_code): Add OMP_CLAUSE__CACHE_,
OMP_CLAUSE_DEVICE_RESIDENT, OMP_CLAUSE_USE_DEVICE,
OMP_CLAUSE_GANG, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT,
OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT,
OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, OMP_CLAUSE_NUM_GANGS,
OMP_CLAUSE_NUM_WORKERS, OMP_CLAUSE_VECTOR_LENGTH.
* tree.c (omp_clause_code_name, walk_tree_1): Update accordingly.
* tree.h (OMP_CLAUSE_GANG_EXPR, OMP_CLAUSE_GANG_STATIC_EXPR)
(OMP_CLAUSE_ASYNC_EXPR, OMP_CLAUSE_WAIT_EXPR)
(OMP_CLAUSE_VECTOR_EXPR, OMP_CLAUSE_WORKER_EXPR)
(OMP_CLAUSE_NUM_GANGS_EXPR, OMP_CLAUSE_NUM_WORKERS_EXPR)
(OMP_CLAUSE_VECTOR_LENGTH_EXPR): New macros.
* tree-core.h: Update comments for OpenACC changes.
(enum omp_clause_map_kind): Remove.
(struct tree_omp_clause): Change type of map_kind member from enum
omp_clause_map_kind to unsigned char.
* tree-inline.c: Update comments for OpenACC changes.
* tree-nested.c: Likewise. Include "gomp-constants.h".
(convert_nonlocal_reference_stmt, convert_local_reference_stmt)
(convert_tramp_reference_stmt, convert_gimple_call): Update for
OpenACC changes. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use
OMP_CLAUSE_SET_MAP_KIND.
* tree-pretty-print.c: Include "gomp-constants.h".
(dump_omp_clause): Handle OMP_CLAUSE_DEVICE_RESIDENT,
OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE__CACHE_, OMP_CLAUSE_GANG,
OMP_CLAUSE_ASYNC, OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ,
OMP_CLAUSE_WAIT, OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR,
OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS,
OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_INDEPENDENT. Use GOMP_MAP_*
instead of OMP_CLAUSE_MAP_*.
(dump_generic_node): Handle OACC_PARALLEL, OACC_KERNELS,
OACC_DATA, OACC_HOST_DATA, OACC_DECLARE, OACC_UPDATE,
OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_CACHE, OACC_LOOP.
* tree-streamer-in.c: Include "gomp-constants.h".
(unpack_ts_omp_clause_value_fields) Use GOMP_MAP_* instead of
OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND.
* tree-streamer-out.c: Include "gomp-constants.h".
(pack_ts_omp_clause_value_fields): Use GOMP_MAP_* instead of
OMP_CLAUSE_MAP_*.
* tree.def (OACC_PARALLEL, OACC_KERNELS, OACC_DATA)
(OACC_HOST_DATA, OACC_LOOP, OACC_CACHE, OACC_DECLARE)
(OACC_ENTER_DATA, OACC_EXIT_DATA, OACC_UPDATE): New tree codes.
* tree.c (omp_clause_num_ops): Update accordingly.
* tree.h (OMP_BODY, OMP_CLAUSES, OMP_LOOP_CHECK, OMP_CLAUSE_SIZE):
Likewise.
(OACC_PARALLEL_BODY, OACC_PARALLEL_CLAUSES, OACC_KERNELS_BODY)
(OACC_KERNELS_CLAUSES, OACC_DATA_BODY, OACC_DATA_CLAUSES)
(OACC_HOST_DATA_BODY, OACC_HOST_DATA_CLAUSES, OACC_CACHE_CLAUSES)
(OACC_DECLARE_CLAUSES, OACC_ENTER_DATA_CLAUSES)
(OACC_EXIT_DATA_CLAUSES, OACC_UPDATE_CLAUSES)
(OACC_KERNELS_COMBINED, OACC_PARALLEL_COMBINED): New macros.
* tree.h (OMP_CLAUSE_MAP_KIND): Cast it to enum gomp_map_kind.
(OMP_CLAUSE_SET_MAP_KIND): New macro.
* varpool.c (varpool_node::get_create): Consider flag_openacc next
to flag_openmp.
* config/i386/intelmic-offload.h: New file.
* config/nvptx/offload.h: Likewise.
gcc/ada/
* gcc-interface/utils.c (DEF_FUNCTION_TYPE_VAR_8)
(DEF_FUNCTION_TYPE_VAR_12): New macros.
gcc/c-family/
* c.opt (fopenacc): New option.
* c-cppbuiltin.c (c_cpp_builtins): Conditionally define _OPENACC.
* c-common.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12):
New macros.
* c-common.h (c_finish_oacc_wait): New prototype.
* c-omp.c: Include "omp-low.h" and "gomp-constants.h".
(c_finish_oacc_wait): New function.
* c-pragma.c (oacc_pragmas): New variable.
(c_pp_lookup_pragma, init_pragma): Handle it.
* c-pragma.h (enum pragma_kind): Add PRAGMA_OACC_CACHE,
PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA, PRAGMA_OACC_EXIT_DATA,
PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP, PRAGMA_OACC_PARALLEL,
PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT.
(enum pragma_omp_clause): Add PRAGMA_OACC_CLAUSE_ASYNC,
PRAGMA_OACC_CLAUSE_AUTO, PRAGMA_OACC_CLAUSE_COLLAPSE,
PRAGMA_OACC_CLAUSE_COPY, PRAGMA_OACC_CLAUSE_COPYIN,
PRAGMA_OACC_CLAUSE_COPYOUT, PRAGMA_OACC_CLAUSE_CREATE,
PRAGMA_OACC_CLAUSE_DELETE, PRAGMA_OACC_CLAUSE_DEVICE,
PRAGMA_OACC_CLAUSE_DEVICEPTR, PRAGMA_OACC_CLAUSE_FIRSTPRIVATE,
PRAGMA_OACC_CLAUSE_GANG, PRAGMA_OACC_CLAUSE_HOST,
PRAGMA_OACC_CLAUSE_IF, PRAGMA_OACC_CLAUSE_NUM_GANGS,
PRAGMA_OACC_CLAUSE_NUM_WORKERS, PRAGMA_OACC_CLAUSE_PRESENT,
PRAGMA_OACC_CLAUSE_PRESENT_OR_COPY,
PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYIN,
PRAGMA_OACC_CLAUSE_PRESENT_OR_COPYOUT,
PRAGMA_OACC_CLAUSE_PRESENT_OR_CREATE, PRAGMA_OACC_CLAUSE_PRIVATE,
PRAGMA_OACC_CLAUSE_REDUCTION, PRAGMA_OACC_CLAUSE_SELF,
PRAGMA_OACC_CLAUSE_SEQ, PRAGMA_OACC_CLAUSE_VECTOR,
PRAGMA_OACC_CLAUSE_VECTOR_LENGTH, PRAGMA_OACC_CLAUSE_WAIT,
PRAGMA_OACC_CLAUSE_WORKER.
gcc/c/
* c-parser.c: Include "gomp-constants.h".
(c_parser_omp_clause_map): Use enum gomp_map_kind instead of enum
omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*.
Use OMP_CLAUSE_SET_MAP_KIND.
(c_parser_pragma): Handle PRAGMA_OACC_ENTER_DATA,
PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_UPDATE.
(c_parser_omp_construct): Handle PRAGMA_OACC_CACHE,
PRAGMA_OACC_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_LOOP,
PRAGMA_OACC_PARALLEL, PRAGMA_OACC_WAIT.
(c_parser_omp_clause_name): Handle "auto", "async", "copy",
"copyout", "create", "delete", "deviceptr", "gang", "host",
"num_gangs", "num_workers", "present", "present_or_copy", "pcopy",
"present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout",
"present_or_create", "pcreate", "seq", "self", "vector",
"vector_length", "wait", "worker".
(OACC_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK)
(OACC_ENTER_DATA_CLAUSE_MASK, OACC_EXIT_DATA_CLAUSE_MASK)
(OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK)
(OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros.
(c_parser_omp_variable_list): Handle OMP_CLAUSE__CACHE_.
(c_parser_oacc_wait_list, c_parser_oacc_data_clause)
(c_parser_oacc_data_clause_deviceptr)
(c_parser_omp_clause_num_gangs, c_parser_omp_clause_num_workers)
(c_parser_oacc_clause_async, c_parser_oacc_clause_wait)
(c_parser_omp_clause_vector_length, c_parser_oacc_all_clauses)
(c_parser_oacc_cache, c_parser_oacc_data, c_parser_oacc_kernels)
(c_parser_oacc_enter_exit_data, c_parser_oacc_loop)
(c_parser_oacc_parallel, c_parser_oacc_update)
(c_parser_oacc_wait): New functions.
* c-tree.h (c_finish_oacc_parallel, c_finish_oacc_kernels)
(c_finish_oacc_data): New prototypes.
* c-typeck.c: Include "gomp-constants.h".
(handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use
GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use
OMP_CLAUSE_SET_MAP_KIND.
(c_finish_oacc_parallel, c_finish_oacc_kernels)
(c_finish_oacc_data): New functions.
(c_finish_omp_clauses): Handle OMP_CLAUSE__CACHE_,
OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS,
OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_ASYNC, OMP_CLAUSE_WAIT,
OMP_CLAUSE_AUTO, OMP_CLAUSE_SEQ, OMP_CLAUSE_GANG,
OMP_CLAUSE_WORKER, OMP_CLAUSE_VECTOR, and OMP_CLAUSE_MAP's
GOMP_MAP_FORCE_DEVICEPTR.
gcc/cp/
* parser.c: Include "gomp-constants.h".
(cp_parser_omp_clause_map): Use enum gomp_map_kind instead of enum
omp_clause_map_kind. Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*.
Use OMP_CLAUSE_SET_MAP_KIND.
(cp_parser_omp_construct, cp_parser_pragma): Handle
PRAGMA_OACC_CACHE, PRAGMA_OACC_DATA, PRAGMA_OACC_ENTER_DATA,
PRAGMA_OACC_EXIT_DATA, PRAGMA_OACC_KERNELS, PRAGMA_OACC_PARALLEL,
PRAGMA_OACC_LOOP, PRAGMA_OACC_UPDATE, PRAGMA_OACC_WAIT.
(cp_parser_omp_clause_name): Handle "async", "copy", "copyout",
"create", "delete", "deviceptr", "host", "num_gangs",
"num_workers", "present", "present_or_copy", "pcopy",
"present_or_copyin", "pcopyin", "present_or_copyout", "pcopyout",
"present_or_create", "pcreate", "vector_length", "wait".
(OACC_DATA_CLAUSE_MASK, OACC_ENTER_DATA_CLAUSE_MASK)
(OACC_EXIT_DATA_CLAUSE_MASK, OACC_KERNELS_CLAUSE_MASK)
(OACC_LOOP_CLAUSE_MASK, OACC_PARALLEL_CLAUSE_MASK)
(OACC_UPDATE_CLAUSE_MASK, OACC_WAIT_CLAUSE_MASK): New macros.
(cp_parser_omp_var_list_no_open): Handle OMP_CLAUSE__CACHE_.
(cp_parser_oacc_data_clause, cp_parser_oacc_data_clause_deviceptr)
(cp_parser_oacc_clause_vector_length, cp_parser_oacc_wait_list)
(cp_parser_oacc_clause_wait, cp_parser_omp_clause_num_gangs)
(cp_parser_omp_clause_num_workers, cp_parser_oacc_clause_async)
(cp_parser_oacc_all_clauses, cp_parser_oacc_cache)
(cp_parser_oacc_data, cp_parser_oacc_enter_exit_data)
(cp_parser_oacc_kernels, cp_parser_oacc_loop)
(cp_parser_oacc_parallel, cp_parser_oacc_update)
(cp_parser_oacc_wait): New functions.
* cp-tree.h (finish_oacc_data, finish_oacc_kernels)
(finish_oacc_parallel): New prototypes.
* semantics.c: Include "gomp-constants.h".
(handle_omp_array_sections): Handle GOMP_MAP_FORCE_DEVICEPTR. Use
GOMP_MAP_* instead of OMP_CLAUSE_MAP_*. Use
OMP_CLAUSE_SET_MAP_KIND.
(finish_omp_clauses): Handle OMP_CLAUSE_ASYNC,
OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_WAIT, OMP_CLAUSE__CACHE_.
Use GOMP_MAP_* instead of OMP_CLAUSE_MAP_*.
(finish_oacc_data, finish_oacc_kernels, finish_oacc_parallel): New
functions.
gcc/fortran/
* lang.opt (fopenacc): New option.
* cpp.c (cpp_define_builtins): Conditionally define _OPENACC.
* dump-parse-tree.c (show_omp_node): Split part of it into...
(show_omp_clauses): ... this new function.
(show_omp_node, show_code_node): Handle EXEC_OACC_PARALLEL_LOOP,
EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS,
EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP,
EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE,
EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA.
(show_namespace): Update for OpenACC.
* f95-lang.c (DEF_FUNCTION_TYPE_VAR_2, DEF_FUNCTION_TYPE_VAR_8)
(DEF_FUNCTION_TYPE_VAR_12, DEF_GOACC_BUILTIN)
(DEF_GOACC_BUILTIN_COMPILER): New macros.
* types.def (BT_FN_VOID_INT_INT_VAR)
(BT_FN_VOID_INT_PTR_SIZE_PTR_PTR_PTR_INT_INT_VAR)
(BT_FN_VOID_INT_OMPFN_PTR_SIZE_PTR_PTR_PTR_INT_INT_INT_INT_INT_VAR):
New function types.
* gfortran.h (gfc_statement): Add ST_OACC_PARALLEL_LOOP,
ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL,
ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_DATA,
ST_OACC_END_DATA, ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA,
ST_OACC_LOOP, ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE,
ST_OACC_WAIT, ST_OACC_CACHE, ST_OACC_KERNELS_LOOP,
ST_OACC_END_KERNELS_LOOP, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA,
ST_OACC_ROUTINE.
(struct gfc_expr_list): New data type.
(gfc_get_expr_list): New macro.
(gfc_omp_map_op): Add OMP_MAP_FORCE_ALLOC, OMP_MAP_FORCE_DEALLOC,
OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM, OMP_MAP_FORCE_TOFROM,
OMP_MAP_FORCE_PRESENT, OMP_MAP_FORCE_DEVICEPTR.
(OMP_LIST_FIRST, OMP_LIST_DEVICE_RESIDENT, OMP_LIST_USE_DEVICE)
(OMP_LIST_CACHE): New enumerators.
(struct gfc_omp_clauses): Add async_expr, gang_expr, worker_expr,
vector_expr, num_gangs_expr, num_workers_expr, vector_length_expr,
wait_list, tile_list, async, gang, worker, vector, seq,
independent, wait, par_auto, gang_static, and loc members.
(struct gfc_namespace): Add oacc_declare_clauses member.
(gfc_exec_op): Add EXEC_OACC_KERNELS_LOOP,
EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS,
EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP,
EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE,
EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA.
(gfc_free_expr_list, gfc_resolve_oacc_directive)
(gfc_resolve_oacc_declare, gfc_resolve_oacc_parallel_loop_blocks)
(gfc_resolve_oacc_blocks): New prototypes.
* match.c (match_exit_cycle): Handle EXEC_OACC_LOOP and
EXEC_OACC_PARALLEL_LOOP.
* match.h (gfc_match_oacc_cache, gfc_match_oacc_wait)
(gfc_match_oacc_update, gfc_match_oacc_declare)
(gfc_match_oacc_loop, gfc_match_oacc_host_data)
(gfc_match_oacc_data, gfc_match_oacc_kernels)
(gfc_match_oacc_kernels_loop, gfc_match_oacc_parallel)
(gfc_match_oacc_parallel_loop, gfc_match_oacc_enter_data)
(gfc_match_oacc_exit_data, gfc_match_oacc_routine): New
prototypes.
* openmp.c: Include "diagnostic.h" and "gomp-constants.h".
(gfc_free_omp_clauses): Update for members added to struct
gfc_omp_clauses.
(gfc_match_omp_clauses): Change mask paramter to uint64_t. Add
openacc parameter.
(resolve_omp_clauses): Add openacc parameter. Update for OpenACC.
(struct fortran_omp_context): Add is_openmp member.
(gfc_resolve_omp_parallel_blocks): Initialize it.
(gfc_resolve_do_iterator): Update for OpenACC.
(gfc_resolve_omp_directive): Call
resolve_omp_directive_inside_oacc_region.
(OMP_CLAUSE_PRIVATE, OMP_CLAUSE_FIRSTPRIVATE)
(OMP_CLAUSE_LASTPRIVATE, OMP_CLAUSE_COPYPRIVATE)
(OMP_CLAUSE_SHARED, OMP_CLAUSE_COPYIN, OMP_CLAUSE_REDUCTION)
(OMP_CLAUSE_IF, OMP_CLAUSE_NUM_THREADS, OMP_CLAUSE_SCHEDULE)
(OMP_CLAUSE_DEFAULT, OMP_CLAUSE_ORDERED, OMP_CLAUSE_COLLAPSE)
(OMP_CLAUSE_UNTIED, OMP_CLAUSE_FINAL, OMP_CLAUSE_MERGEABLE)
(OMP_CLAUSE_ALIGNED, OMP_CLAUSE_DEPEND, OMP_CLAUSE_INBRANCH)
(OMP_CLAUSE_LINEAR, OMP_CLAUSE_NOTINBRANCH, OMP_CLAUSE_PROC_BIND)
(OMP_CLAUSE_SAFELEN, OMP_CLAUSE_SIMDLEN, OMP_CLAUSE_UNIFORM)
(OMP_CLAUSE_DEVICE, OMP_CLAUSE_MAP, OMP_CLAUSE_TO)
(OMP_CLAUSE_FROM, OMP_CLAUSE_NUM_TEAMS, OMP_CLAUSE_THREAD_LIMIT)
(OMP_CLAUSE_DIST_SCHEDULE): Use uint64_t.
(OMP_CLAUSE_ASYNC, OMP_CLAUSE_NUM_GANGS, OMP_CLAUSE_NUM_WORKERS)
(OMP_CLAUSE_VECTOR_LENGTH, OMP_CLAUSE_COPY, OMP_CLAUSE_COPYOUT)
(OMP_CLAUSE_CREATE, OMP_CLAUSE_PRESENT)
(OMP_CLAUSE_PRESENT_OR_COPY, OMP_CLAUSE_PRESENT_OR_COPYIN)
(OMP_CLAUSE_PRESENT_OR_COPYOUT, OMP_CLAUSE_PRESENT_OR_CREATE)
(OMP_CLAUSE_DEVICEPTR, OMP_CLAUSE_GANG, OMP_CLAUSE_WORKER)
(OMP_CLAUSE_VECTOR, OMP_CLAUSE_SEQ, OMP_CLAUSE_INDEPENDENT)
(OMP_CLAUSE_USE_DEVICE, OMP_CLAUSE_DEVICE_RESIDENT)
(OMP_CLAUSE_HOST_SELF, OMP_CLAUSE_OACC_DEVICE, OMP_CLAUSE_WAIT)
(OMP_CLAUSE_DELETE, OMP_CLAUSE_AUTO, OMP_CLAUSE_TILE): New macros.
(gfc_match_omp_clauses): Handle those.
(OACC_PARALLEL_CLAUSES, OACC_KERNELS_CLAUSES, OACC_DATA_CLAUSES)
(OACC_LOOP_CLAUSES, OACC_PARALLEL_LOOP_CLAUSES)
(OACC_KERNELS_LOOP_CLAUSES, OACC_HOST_DATA_CLAUSES)
(OACC_DECLARE_CLAUSES, OACC_UPDATE_CLAUSES)
(OACC_ENTER_DATA_CLAUSES, OACC_EXIT_DATA_CLAUSES)
(OACC_WAIT_CLAUSES): New macros.
(gfc_free_expr_list, match_oacc_expr_list, match_oacc_clause_gang)
(gfc_match_omp_map_clause, gfc_match_oacc_parallel_loop)
(gfc_match_oacc_parallel, gfc_match_oacc_kernels_loop)
(gfc_match_oacc_kernels, gfc_match_oacc_data)
(gfc_match_oacc_host_data, gfc_match_oacc_loop)
(gfc_match_oacc_declare, gfc_match_oacc_update)
(gfc_match_oacc_enter_data, gfc_match_oacc_exit_data)
(gfc_match_oacc_wait, gfc_match_oacc_cache)
(gfc_match_oacc_routine, oacc_is_loop)
(resolve_oacc_scalar_int_expr, resolve_oacc_positive_int_expr)
(check_symbol_not_pointer, check_array_not_assumed)
(resolve_oacc_data_clauses, resolve_oacc_deviceptr_clause)
(oacc_compatible_clauses, oacc_is_parallel, oacc_is_kernels)
(omp_code_to_statement, oacc_code_to_statement)
(resolve_oacc_directive_inside_omp_region)
(resolve_omp_directive_inside_oacc_region)
(resolve_oacc_nested_loops, resolve_oacc_params_in_parallel)
(resolve_oacc_loop_blocks, gfc_resolve_oacc_blocks)
(resolve_oacc_loop, resolve_oacc_cache, gfc_resolve_oacc_declare)
(gfc_resolve_oacc_directive): New functions.
* parse.c (next_free): Update for OpenACC. Move some code into...
(verify_token_free): ... this new function.
(next_fixed): Update for OpenACC. Move some code into...
(verify_token_fixed): ... this new function.
(case_executable): Add ST_OACC_UPDATE, ST_OACC_WAIT,
ST_OACC_CACHE, ST_OACC_ENTER_DATA, and ST_OACC_EXIT_DATA.
(case_exec_markers): Add ST_OACC_PARALLEL_LOOP, ST_OACC_PARALLEL,
ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA, ST_OACC_LOOP,
ST_OACC_KERNELS_LOOP.
(case_decl): Add ST_OACC_ROUTINE.
(push_state, parse_critical_block, parse_progunit): Update for
OpenACC.
(gfc_ascii_statement): Handle ST_OACC_PARALLEL_LOOP,
ST_OACC_END_PARALLEL_LOOP, ST_OACC_PARALLEL, ST_OACC_END_PARALLEL,
ST_OACC_KERNELS, ST_OACC_END_KERNELS, ST_OACC_KERNELS_LOOP,
ST_OACC_END_KERNELS_LOOP, ST_OACC_DATA, ST_OACC_END_DATA,
ST_OACC_HOST_DATA, ST_OACC_END_HOST_DATA, ST_OACC_LOOP,
ST_OACC_END_LOOP, ST_OACC_DECLARE, ST_OACC_UPDATE, ST_OACC_WAIT,
ST_OACC_CACHE, ST_OACC_ENTER_DATA, ST_OACC_EXIT_DATA,
ST_OACC_ROUTINE.
(verify_st_order, parse_spec): Handle ST_OACC_DECLARE.
(parse_executable): Handle ST_OACC_PARALLEL_LOOP,
ST_OACC_KERNELS_LOOP, ST_OACC_LOOP, ST_OACC_PARALLEL,
ST_OACC_KERNELS, ST_OACC_DATA, ST_OACC_HOST_DATA.
(decode_oacc_directive, parse_oacc_structured_block)
(parse_oacc_loop, is_oacc): New functions.
* parse.h (struct gfc_state_data): Add oacc_declare_clauses
member.
(is_oacc): New prototype.
* resolve.c (gfc_resolve_blocks, gfc_resolve_code): Handle
EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_PARALLEL,
EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS, EXEC_OACC_DATA,
EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP, EXEC_OACC_UPDATE,
EXEC_OACC_WAIT, EXEC_OACC_CACHE, EXEC_OACC_ENTER_DATA,
EXEC_OACC_EXIT_DATA.
(resolve_codes): Call gfc_resolve_oacc_declare.
* scanner.c (openacc_flag, openacc_locus): New variables.
(skip_free_comments): Update for OpenACC. Move some code into...
(skip_omp_attribute): ... this new function.
(skip_oacc_attribute): New function.
(skip_fixed_comments, gfc_next_char_literal): Update for OpenACC.
* st.c (gfc_free_statement): Handle EXEC_OACC_PARALLEL_LOOP,
EXEC_OACC_PARALLEL, EXEC_OACC_KERNELS_LOOP, EXEC_OACC_KERNELS,
EXEC_OACC_DATA, EXEC_OACC_HOST_DATA, EXEC_OACC_LOOP,
EXEC_OACC_UPDATE, EXEC_OACC_WAIT, EXEC_OACC_CACHE,
EXEC_OACC_ENTER_DATA, EXEC_OACC_EXIT_DATA.
* trans-decl.c (gfc_generate_function_code): Update for OpenACC.
* trans-openmp.c: Include "gomp-constants.h".
(gfc_omp_finish_clause, gfc_trans_omp_clauses): Use GOMP_MAP_*
instead of OMP_CLAUSE_MAP_*. Use OMP_CLAUSE_SET_MAP_KIND.
(gfc_trans_omp_clauses): Handle OMP_LIST_USE_DEVICE,
OMP_LIST_DEVICE_RESIDENT, OMP_LIST_CACHE, and OMP_MAP_FORCE_ALLOC,
OMP_MAP_FORCE_DEALLOC, OMP_MAP_FORCE_TO, OMP_MAP_FORCE_FROM,
OMP_MAP_FORCE_TOFROM, OMP_MAP_FORCE_PRESENT,
OMP_MAP_FORCE_DEVICEPTR, and gfc_omp_clauses' async, seq,
independent, wait_list, num_gangs_expr, num_workers_expr,
vector_length_expr, vector, vector_expr, worker, worker_expr,
gang, gang_expr members.
(gfc_trans_omp_do): Handle EXEC_OACC_LOOP.
(gfc_convert_expr_to_tree, gfc_trans_oacc_construct)
(gfc_trans_oacc_executable_directive)
(gfc_trans_oacc_wait_directive, gfc_trans_oacc_combined_directive)
(gfc_trans_oacc_declare, gfc_trans_oacc_directive): New functions.
* trans-stmt.c (gfc_trans_block_construct): Update for OpenACC.
* trans-stmt.h (gfc_trans_oacc_directive, gfc_trans_oacc_declare):
New prototypes.
* trans.c (tranc_code): Handle EXEC_OACC_CACHE, EXEC_OACC_WAIT,
EXEC_OACC_UPDATE, EXEC_OACC_LOOP, EXEC_OACC_HOST_DATA,
EXEC_OACC_DATA, EXEC_OACC_KERNELS, EXEC_OACC_KERNELS_LOOP,
EXEC_OACC_PARALLEL, EXEC_OACC_PARALLEL_LOOP, EXEC_OACC_ENTER_DATA,
EXEC_OACC_EXIT_DATA.
* gfortran.texi: Update for OpenACC.
* intrinsic.texi: Likewise.
* invoke.texi: Likewise.
gcc/lto/
* lto-lang.c (DEF_FUNCTION_TYPE_VAR_8, DEF_FUNCTION_TYPE_VAR_12):
New macros.
* lto.c: Include "gomp-constants.h".
gcc/testsuite/
* lib/target-supports.exp (check_effective_target_fopenacc): New
procedure.
* g++.dg/goacc-gomp/goacc-gomp.exp: New file.
* g++.dg/goacc/goacc.exp: Likewise.
* gcc.dg/goacc-gomp/goacc-gomp.exp: Likewise.
* gcc.dg/goacc/goacc.exp: Likewise.
* gfortran.dg/goacc/goacc.exp: Likewise.
* c-c++-common/cpp/openacc-define-1.c: New file.
* c-c++-common/cpp/openacc-define-2.c: Likewise.
* c-c++-common/cpp/openacc-define-3.c: Likewise.
* c-c++-common/goacc-gomp/nesting-1.c: Likewise.
* c-c++-common/goacc-gomp/nesting-fail-1.c: Likewise.
* c-c++-common/goacc/acc_on_device-2-off.c: Likewise.
* c-c++-common/goacc/acc_on_device-2.c: Likewise.
* c-c++-common/goacc/asyncwait-1.c: Likewise.
* c-c++-common/goacc/cache-1.c: Likewise.
* c-c++-common/goacc/clauses-fail.c: Likewise.
* c-c++-common/goacc/collapse-1.c: Likewise.
* c-c++-common/goacc/data-1.c: Likewise.
* c-c++-common/goacc/data-2.c: Likewise.
* c-c++-common/goacc/data-clause-duplicate-1.c: Likewise.
* c-c++-common/goacc/deviceptr-1.c: Likewise.
* c-c++-common/goacc/deviceptr-2.c: Likewise.
* c-c++-common/goacc/deviceptr-3.c: Likewise.
* c-c++-common/goacc/if-clause-1.c: Likewise.
* c-c++-common/goacc/if-clause-2.c: Likewise.
* c-c++-common/goacc/kernels-1.c: Likewise.
* c-c++-common/goacc/loop-1.c: Likewise.
* c-c++-common/goacc/loop-private-1.c: Likewise.
* c-c++-common/goacc/nesting-1.c: Likewise.
* c-c++-common/goacc/nesting-data-1.c: Likewise.
* c-c++-common/goacc/nesting-fail-1.c: Likewise.
* c-c++-common/goacc/parallel-1.c: Likewise.
* c-c++-common/goacc/pcopy.c: Likewise.
* c-c++-common/goacc/pcopyin.c: Likewise.
* c-c++-common/goacc/pcopyout.c: Likewise.
* c-c++-common/goacc/pcreate.c: Likewise.
* c-c++-common/goacc/pragma_context.c: Likewise.
* c-c++-common/goacc/present-1.c: Likewise.
* c-c++-common/goacc/reduction-1.c: Likewise.
* c-c++-common/goacc/reduction-2.c: Likewise.
* c-c++-common/goacc/reduction-3.c: Likewise.
* c-c++-common/goacc/reduction-4.c: Likewise.
* c-c++-common/goacc/sb-1.c: Likewise.
* c-c++-common/goacc/sb-2.c: Likewise.
* c-c++-common/goacc/sb-3.c: Likewise.
* c-c++-common/goacc/update-1.c: Likewise.
* gcc.dg/goacc/acc_on_device-1.c: Likewise.
* gfortran.dg/goacc/acc_on_device-1.f95: Likewise.
* gfortran.dg/goacc/acc_on_device-2-off.f95: Likewise.
* gfortran.dg/goacc/acc_on_device-2.f95: Likewise.
* gfortran.dg/goacc/assumed.f95: Likewise.
* gfortran.dg/goacc/asyncwait-1.f95: Likewise.
* gfortran.dg/goacc/asyncwait-2.f95: Likewise.
* gfortran.dg/goacc/asyncwait-3.f95: Likewise.
* gfortran.dg/goacc/asyncwait-4.f95: Likewise.
* gfortran.dg/goacc/branch.f95: Likewise.
* gfortran.dg/goacc/cache-1.f95: Likewise.
* gfortran.dg/goacc/coarray.f95: Likewise.
* gfortran.dg/goacc/continuation-free-form.f95: Likewise.
* gfortran.dg/goacc/cray.f95: Likewise.
* gfortran.dg/goacc/critical.f95: Likewise.
* gfortran.dg/goacc/data-clauses.f95: Likewise.
* gfortran.dg/goacc/data-tree.f95: Likewise.
* gfortran.dg/goacc/declare-1.f95: Likewise.
* gfortran.dg/goacc/enter-exit-data.f95: Likewise.
* gfortran.dg/goacc/fixed-1.f: Likewise.
* gfortran.dg/goacc/fixed-2.f: Likewise.
* gfortran.dg/goacc/fixed-3.f: Likewise.
* gfortran.dg/goacc/fixed-4.f: Likewise.
* gfortran.dg/goacc/host_data-tree.f95: Likewise.
* gfortran.dg/goacc/if.f95: Likewise.
* gfortran.dg/goacc/kernels-tree.f95: Likewise.
* gfortran.dg/goacc/list.f95: Likewise.
* gfortran.dg/goacc/literal.f95: Likewise.
* gfortran.dg/goacc/loop-1.f95: Likewise.
* gfortran.dg/goacc/loop-2.f95: Likewise.
* gfortran.dg/goacc/loop-3.f95: Likewise.
* gfortran.dg/goacc/loop-tree-1.f90: Likewise.
* gfortran.dg/goacc/omp.f95: Likewise.
* gfortran.dg/goacc/parallel-kernels-clauses.f95: Likewise.
* gfortran.dg/goacc/parallel-kernels-regions.f95: Likewise.
* gfortran.dg/goacc/parallel-tree.f95: Likewise.
* gfortran.dg/goacc/parameter.f95: Likewise.
* gfortran.dg/goacc/private-1.f95: Likewise.
* gfortran.dg/goacc/private-2.f95: Likewise.
* gfortran.dg/goacc/private-3.f95: Likewise.
* gfortran.dg/goacc/pure-elemental-procedures.f95: Likewise.
* gfortran.dg/goacc/reduction-2.f95: Likewise.
* gfortran.dg/goacc/reduction.f95: Likewise.
* gfortran.dg/goacc/routine-1.f90: Likewise.
* gfortran.dg/goacc/routine-2.f90: Likewise.
* gfortran.dg/goacc/sentinel-free-form.f95: Likewise.
* gfortran.dg/goacc/several-directives.f95: Likewise.
* gfortran.dg/goacc/sie.f95: Likewise.
* gfortran.dg/goacc/subarrays.f95: Likewise.
* gfortran.dg/gomp/map-1.f90: Likewise.
* gfortran.dg/openacc-define-1.f90: Likewise.
* gfortran.dg/openacc-define-2.f90: Likewise.
* gfortran.dg/openacc-define-3.f90: Likewise.
* g++.dg/gomp/block-1.C: Update for changed compiler output.
* g++.dg/gomp/block-2.C: Likewise.
* g++.dg/gomp/block-3.C: Likewise.
* g++.dg/gomp/block-5.C: Likewise.
* g++.dg/gomp/target-1.C: Likewise.
* g++.dg/gomp/target-2.C: Likewise.
* g++.dg/gomp/taskgroup-1.C: Likewise.
* g++.dg/gomp/teams-1.C: Likewise.
* gcc.dg/cilk-plus/jump-openmp.c: Likewise.
* gcc.dg/cilk-plus/jump.c: Likewise.
* gcc.dg/gomp/block-1.c: Likewise.
* gcc.dg/gomp/block-10.c: Likewise.
* gcc.dg/gomp/block-2.c: Likewise.
* gcc.dg/gomp/block-3.c: Likewise.
* gcc.dg/gomp/block-4.c: Likewise.
* gcc.dg/gomp/block-5.c: Likewise.
* gcc.dg/gomp/block-6.c: Likewise.
* gcc.dg/gomp/block-7.c: Likewise.
* gcc.dg/gomp/block-8.c: Likewise.
* gcc.dg/gomp/block-9.c: Likewise.
* gcc.dg/gomp/target-1.c: Likewise.
* gcc.dg/gomp/target-2.c: Likewise.
* gcc.dg/gomp/taskgroup-1.c: Likewise.
* gcc.dg/gomp/teams-1.c: Likewise.
include/
* gomp-constants.h: New file.
libgomp/
* Makefile.am (search_path): Add $(top_srcdir)/../include.
(libgomp_la_SOURCES): Add splay-tree.c, libgomp-plugin.c,
oacc-parallel.c, oacc-host.c, oacc-init.c, oacc-mem.c,
oacc-async.c, oacc-plugin.c, oacc-cuda.c.
[USE_FORTRAN] (libgomp_la_SOURCES): Add openacc.f90.
Include $(top_srcdir)/plugin/Makefrag.am.
(nodist_libsubinclude_HEADERS): Add openacc.h.
[USE_FORTRAN] (nodist_finclude_HEADERS): Add openacc_lib.h,
openacc.f90, openacc.mod, openacc_kinds.mod.
(omp_lib.mod): Generalize into...
(%.mod): ... this new rule.
(openacc_kinds.mod, openacc.mod): New rules.
* plugin/configfrag.ac: New file.
* configure.ac: Move plugin/offloading support into it. Include
it. Instantiate testsuite/libgomp-test-support.pt.exp.
* plugin/Makefrag.am: New file.
* testsuite/Makefile.am (OFFLOAD_TARGETS)
(OFFLOAD_ADDITIONAL_OPTIONS, OFFLOAD_ADDITIONAL_LIB_PATHS): Don't
export.
(libgomp-test-support.exp): New rule.
(all-local): Depend on it.
* Makefile.in: Regenerate.
* testsuite/Makefile.in: Regenerate.
* config.h.in: Likewise.
* configure: Likewise.
* configure.tgt: Harden shell syntax.
* env.c: Include "oacc-int.h".
(parse_acc_device_type): New function.
(gomp_debug_var, goacc_device_type, goacc_device_num): New
variables.
(initialize_env): Initialize those. Call
goacc_runtime_initialize.
* error.c (gomp_vdebug, gomp_debug, gomp_vfatal): New functions.
(gomp_fatal): Call gomp_vfatal.
* libgomp.h: Include "libgomp-plugin.h" and <stdarg.h>.
(gomp_debug_var, goacc_device_type, goacc_device_num, gomp_vdebug)
(gomp_debug, gomp_verror, gomp_vfatal, gomp_init_targets_once)
(splay_tree_node, splay_tree, splay_tree_key)
(struct target_mem_desc, struct splay_tree_key_s)
(struct gomp_memory_mapping, struct acc_dispatch_t)
(struct gomp_device_descr, gomp_acc_insert_pointer)
(gomp_acc_remove_pointer, target_mem_desc, gomp_copy_from_async)
(gomp_unmap_vars, gomp_init_device, gomp_init_tables)
(gomp_free_memmap, gomp_fini_device): New declarations.
(gomp_vdebug, gomp_debug): New macros.
Include "splay-tree.h".
* libgomp.map (OACC_2.0): New symbol version. Use for
acc_get_num_devices, acc_get_num_devices_h_, acc_set_device_type,
acc_set_device_type_h_, acc_get_device_type,
acc_get_device_type_h_, acc_set_device_num, acc_set_device_num_h_,
acc_get_device_num, acc_get_device_num_h_, acc_async_test,
acc_async_test_h_, acc_async_test_all, acc_async_test_all_h_,
acc_wait, acc_wait_h_, acc_wait_async, acc_wait_async_h_,
acc_wait_all, acc_wait_all_h_, acc_wait_all_async,
acc_wait_all_async_h_, acc_init, acc_init_h_, acc_shutdown,
acc_shutdown_h_, acc_on_device, acc_on_device_h_, acc_malloc,
acc_free, acc_copyin, acc_copyin_32_h_, acc_copyin_64_h_,
acc_copyin_array_h_, acc_present_or_copyin,
acc_present_or_copyin_32_h_, acc_present_or_copyin_64_h_,
acc_present_or_copyin_array_h_, acc_create, acc_create_32_h_,
acc_create_64_h_, acc_create_array_h_, acc_present_or_create,
acc_present_or_create_32_h_, acc_present_or_create_64_h_,
acc_present_or_create_array_h_, acc_copyout, acc_copyout_32_h_,
acc_copyout_64_h_, acc_copyout_array_h_, acc_delete,
acc_delete_32_h_, acc_delete_64_h_, acc_delete_array_h_,
acc_update_device, acc_update_device_32_h_,
acc_update_device_64_h_, acc_update_device_array_h_,
acc_update_self, acc_update_self_32_h_, acc_update_self_64_h_,
acc_update_self_array_h_, acc_map_data, acc_unmap_data,
acc_deviceptr, acc_hostptr, acc_is_present, acc_is_present_32_h_,
acc_is_present_64_h_, acc_is_present_array_h_,
acc_memcpy_to_device, acc_memcpy_from_device,
acc_get_current_cuda_device, acc_get_current_cuda_context,
acc_get_cuda_stream, acc_set_cuda_stream.
(GOACC_2.0): New symbol version. Use for GOACC_data_end,
GOACC_data_start, GOACC_enter_exit_data, GOACC_parallel,
GOACC_update, GOACC_wait, GOACC_get_thread_num,
GOACC_get_num_threads.
(GOMP_PLUGIN_1.0): New symbol version. Use for
GOMP_PLUGIN_malloc, GOMP_PLUGIN_malloc_cleared,
GOMP_PLUGIN_realloc, GOMP_PLUGIN_debug, GOMP_PLUGIN_error,
GOMP_PLUGIN_fatal, GOMP_PLUGIN_async_unmap_vars,
GOMP_PLUGIN_acc_thread.
* libgomp.texi: Update for OpenACC changes, and GOMP_DEBUG
environment variable.
* libgomp_g.h (GOACC_data_start, GOACC_data_end)
(GOACC_enter_exit_data, GOACC_parallel, GOACC_update, GOACC_wait)
(GOACC_get_num_threads, GOACC_get_thread_num): New declarations.
* splay-tree.h (splay_tree_lookup, splay_tree_insert)
(splay_tree_remove): New declarations.
(rotate_left, rotate_right, splay_tree_splay, splay_tree_insert)
(splay_tree_remove, splay_tree_lookup): Move into...
* splay-tree.c: ... this new file.
* target.c: Include "oacc-plugin.h", "oacc-int.h", <assert.h>.
(splay_tree_node, splay_tree, splay_tree_key)
(struct target_mem_desc, struct splay_tree_key_s)
(struct gomp_device_descr): Don't declare.
(num_devices_openmp): New variable.
(gomp_get_num_devices ): Use it.
(gomp_init_targets_once): New function.
(gomp_get_num_devices ): Use it.
(get_kind, gomp_copy_from_async, gomp_free_memmap)
(gomp_fini_device, gomp_register_image_for_device): New functions.
(gomp_map_vars): Add devaddrs parameter.
(gomp_update): Add mm parameter.
(gomp_init_device): Move most of it into...
(gomp_init_tables): ... this new function.
(gomp_register_images_for_device): Remove function.
(splay_compare, gomp_map_vars, gomp_unmap_vars, gomp_init_device):
Make them hidden instead of static.
(gomp_map_vars_existing, gomp_map_vars, gomp_unmap_vars)
(gomp_update, gomp_init_device, GOMP_target, GOMP_target_data)
(GOMP_target_end_data, GOMP_target_update)
(gomp_load_plugin_for_device, gomp_target_init): Update for
OpenACC changes.
* oacc-async.c: New file.
* oacc-cuda.c: Likewise.
* oacc-host.c: Likewise.
* oacc-init.c: Likewise.
* oacc-int.h: Likewise.
* oacc-mem.c: Likewise.
* oacc-parallel.c: Likewise.
* oacc-plugin.c: Likewise.
* oacc-plugin.h: Likewise.
* oacc-ptx.h: Likewise.
* openacc.f90: Likewise.
* openacc.h: Likewise.
* openacc_lib.h: Likewise.
* plugin/plugin-host.c: Likewise.
* plugin/plugin-nvptx.c: Likewise.
* libgomp-plugin.c: Likewise.
* libgomp-plugin.h: Likewise.
* libgomp_target.h: Remove file after merging content into the
former file. Update all users.
* testsuite/lib/libgomp.exp: Load libgomp-test-support.exp.
(offload_targets_s, offload_targets_s_openacc): New variables.
(check_effective_target_openacc_nvidia_accel_present)
(check_effective_target_openacc_nvidia_accel_selected): New
procedures.
(libgomp_init): Update for OpenACC changes.
* testsuite/libgomp-test-support.exp.in: New file.
* testsuite/libgomp.oacc-c++/c++.exp: Likewise.
* testsuite/libgomp.oacc-c/c.exp: Likewise.
* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
* testsuite/libgomp.oacc-c-c++-common/abort-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/abort-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/abort-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/abort-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/acc_on_device-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/asyncwait-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/cache-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/clauses-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/clauses-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/collapse-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/collapse-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/collapse-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/collapse-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/context-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/context-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/context-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/context-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-5.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-6.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-7.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/data-already-8.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/deviceptr-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/if-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-empty.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-10.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-11.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-12.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-13.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-14.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-15.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-16.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-17.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-18.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-19.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-20.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-21.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-22.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-23.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-24.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-25.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-26.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-27.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-28.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-29.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-30.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-31.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-32.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-33.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-34.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-35.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-36.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-37.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-38.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-39.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-40.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-41.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-42.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-43.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-44.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-45.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-46.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-47.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-48.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-49.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-5.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-50.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-51.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-52.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-53.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-54.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-55.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-56.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-57.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-58.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-59.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-6.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-60.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-61.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-62.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-63.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-64.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-65.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-66.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-67.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-68.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-69.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-7.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-70.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-71.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-72.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-73.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-74.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-75.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-76.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-77.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-78.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-79.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-80.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-81.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-82.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-83.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-84.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-85.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-86.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-87.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-88.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-89.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-9.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-90.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-91.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-92.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/nested-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/nested-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/offset-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/parallel-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/parallel-empty.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/pointer-align-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/present-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/present-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-3.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/reduction-initial-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/subr.h: Likewise.
* testsuite/libgomp.oacc-c-c++-common/subr.ptx: Likewise.
* testsuite/libgomp.oacc-c-c++-common/timer.h: Likewise.
* testsuite/libgomp.oacc-c-c++-common/update-1-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/update-1.c: Likewise.
* testsuite/libgomp.oacc-fortran/abort-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/abort-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f: Likewise.
* testsuite/libgomp.oacc-fortran/asyncwait-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/asyncwait-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/asyncwait-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-4.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-5.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-6.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-7.f90: Likewise.
* testsuite/libgomp.oacc-fortran/collapse-8.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-4-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-4.f90: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-1.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-3.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-4.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-5.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-6.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-7.f: Likewise.
* testsuite/libgomp.oacc-fortran/data-already-8.f: Likewise.
* testsuite/libgomp.oacc-fortran/lib-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-10.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/lib-3.f: Likewise.
* testsuite/libgomp.oacc-fortran/lib-4.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-5.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-6.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-7.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-8.f90: Likewise.
* testsuite/libgomp.oacc-fortran/map-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/openacc_version-1.f: Likewise.
* testsuite/libgomp.oacc-fortran/openacc_version-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/pointer-align-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/pset-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-4.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-5.f90: Likewise.
* testsuite/libgomp.oacc-fortran/reduction-6.f90: Likewise.
* testsuite/libgomp.oacc-fortran/routine-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/routine-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/routine-3.f90: Likewise.
* testsuite/libgomp.oacc-fortran/routine-4.f90: Likewise.
* testsuite/libgomp.oacc-fortran/subarrays-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/subarrays-2.f90: Likewise.
liboffloadmic/
* plugin/libgomp-plugin-intelmic.cpp (GOMP_OFFLOAD_get_name)
(GOMP_OFFLOAD_get_caps, GOMP_OFFLOAD_fini_device): New functions.
Co-Authored-By: Bernd Schmidt <bernds@codesourcery.com>
Co-Authored-By: Cesar Philippidis <cesar@codesourcery.com>
Co-Authored-By: Dmitry Bocharnikov <dmitry.b@samsung.com>
Co-Authored-By: Evgeny Gavrin <e.gavrin@samsung.com>
Co-Authored-By: Ilmir Usmanov <i.usmanov@samsung.com>
Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
Co-Authored-By: James Norris <jnorris@codesourcery.com>
Co-Authored-By: Julian Brown <julian@codesourcery.com>
Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
Co-Authored-By: Tobias Burnus <burnus@net-b.de>
Co-Authored-By: Tom de Vries <tom@codesourcery.com>
From-SVN: r219682
2015-01-15 21:11:12 +01:00
|
|
|
@node OpenACC
|
|
|
|
@subsection OpenACC
|
|
|
|
@cindex OpenACC
|
|
|
|
|
|
|
|
OpenACC is an application programming interface (API) that supports
|
|
|
|
offloading of code to accelerator devices. It consists of a set of
|
|
|
|
compiler directives, library routines, and environment variables that
|
|
|
|
influence run-time behavior.
|
|
|
|
|
|
|
|
GNU Fortran strives to be compatible to the
|
|
|
|
@uref{http://www.openacc.org/, OpenACC Application Programming
|
|
|
|
Interface v2.0}.
|
|
|
|
|
|
|
|
To enable the processing of the OpenACC directive @code{!$acc} in
|
|
|
|
free-form source code; the @code{c$acc}, @code{*$acc} and @code{!$acc}
|
|
|
|
directives in fixed form; the @code{!$} conditional compilation
|
|
|
|
sentinels in free form; and the @code{c$}, @code{*$} and @code{!$}
|
|
|
|
sentinels in fixed form, @command{gfortran} needs to be invoked with
|
|
|
|
the @option{-fopenacc}. This also arranges for automatic linking of
|
|
|
|
the GNU Offloading and Multi Processing Runtime Library
|
|
|
|
@ref{Top,,libgomp,libgomp,GNU Offloading and Multi Processing Runtime
|
|
|
|
Library}.
|
|
|
|
|
|
|
|
The OpenACC Fortran runtime library routines are provided both in a
|
|
|
|
form of a Fortran 90 module named @code{openacc} and in a form of a
|
|
|
|
Fortran @code{include} file named @file{openacc_lib.h}.
|
|
|
|
|
|
|
|
Note that this is an experimental feature, incomplete, and subject to
|
|
|
|
change in future versions of GCC. See
|
|
|
|
@uref{https://gcc.gnu.org/wiki/OpenACC} for more information.
|
|
|
|
|
2007-03-31 18:42:58 +02:00
|
|
|
@node Argument list functions
|
2008-02-16 15:10:12 +01:00
|
|
|
@subsection Argument list functions @code{%VAL}, @code{%REF} and @code{%LOC}
|
2007-04-29 12:49:08 +02:00
|
|
|
@cindex argument list functions
|
2008-02-16 15:10:12 +01:00
|
|
|
@cindex @code{%VAL}
|
|
|
|
@cindex @code{%REF}
|
|
|
|
@cindex @code{%LOC}
|
2007-03-31 18:42:58 +02:00
|
|
|
|
|
|
|
GNU Fortran supports argument list functions @code{%VAL}, @code{%REF}
|
|
|
|
and @code{%LOC} statements, for backward compatibility with g77.
|
|
|
|
It is recommended that these should be used only for code that is
|
|
|
|
accessing facilities outside of GNU Fortran, such as operating system
|
2010-09-24 08:39:20 +02:00
|
|
|
or windowing facilities. It is best to constrain such uses to isolated
|
2007-03-31 18:42:58 +02:00
|
|
|
portions of a program--portions that deal specifically and exclusively
|
2010-09-24 08:39:20 +02:00
|
|
|
with low-level, system-dependent facilities. Such portions might well
|
2007-03-31 18:42:58 +02:00
|
|
|
provide a portable interface for use by the program as a whole, but are
|
|
|
|
themselves not portable, and should be thoroughly tested each time they
|
|
|
|
are rebuilt using a new compiler or version of a compiler.
|
|
|
|
|
|
|
|
@code{%VAL} passes a scalar argument by value, @code{%REF} passes it by
|
|
|
|
reference and @code{%LOC} passes its memory location. Since gfortran
|
|
|
|
already passes scalar arguments by reference, @code{%REF} is in effect
|
2009-06-03 22:32:23 +02:00
|
|
|
a do-nothing. @code{%LOC} has the same effect as a Fortran pointer.
|
2007-03-31 18:42:58 +02:00
|
|
|
|
|
|
|
An example of passing an argument by value to a C subroutine foo.:
|
|
|
|
@smallexample
|
|
|
|
C
|
|
|
|
C prototype void foo_ (float x);
|
|
|
|
C
|
|
|
|
external foo
|
|
|
|
real*4 x
|
|
|
|
x = 3.14159
|
|
|
|
call foo (%VAL (x))
|
|
|
|
end
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
For details refer to the g77 manual
|
2014-05-23 22:32:04 +02:00
|
|
|
@uref{https://gcc.gnu.org/@/onlinedocs/@/gcc-3.4.6/@/g77/@/index.html#Top}.
|
2007-03-31 18:42:58 +02:00
|
|
|
|
2009-06-03 22:32:23 +02:00
|
|
|
Also, @code{c_by_val.f} and its partner @code{c_by_val.c} of the
|
|
|
|
GNU Fortran testsuite are worth a look.
|
2008-02-16 15:10:12 +01:00
|
|
|
|
2015-03-22 22:37:13 +01:00
|
|
|
@node Read/Write after EOF marker
|
|
|
|
@subsection Read/Write after EOF marker
|
|
|
|
@cindex @code{EOF}
|
|
|
|
@cindex @code{BACKSPACE}
|
|
|
|
@cindex @code{REWIND}
|
|
|
|
|
|
|
|
Some legacy codes rely on allowing @code{READ} or @code{WRITE} after the
|
|
|
|
EOF file marker in order to find the end of a file. GNU Fortran normally
|
|
|
|
rejects these codes with a run-time error message and suggests the user
|
|
|
|
consider @code{BACKSPACE} or @code{REWIND} to properly position
|
|
|
|
the file before the EOF marker. As an extension, the run-time error may
|
|
|
|
be disabled using -std=legacy.
|
2008-02-16 15:10:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
@node STRUCTURE and RECORD
|
|
|
|
@subsection @code{STRUCTURE} and @code{RECORD}
|
|
|
|
@cindex @code{STRUCTURE}
|
|
|
|
@cindex @code{RECORD}
|
|
|
|
|
2013-03-11 19:37:30 +01:00
|
|
|
Record structures are a pre-Fortran-90 vendor extension to create
|
2016-08-30 16:33:00 +02:00
|
|
|
user-defined aggregate data types. Support for record structures in GNU
|
|
|
|
Fortran can be enabled with the @option{-fdec-structure} compile flag.
|
|
|
|
If you have a choice, you should instead use Fortran 90's ``derived types'',
|
|
|
|
which have a different syntax.
|
2013-03-11 19:37:30 +01:00
|
|
|
|
|
|
|
In many cases, record structures can easily be converted to derived types.
|
|
|
|
To convert, replace @code{STRUCTURE /}@var{structure-name}@code{/}
|
|
|
|
by @code{TYPE} @var{type-name}. Additionally, replace
|
|
|
|
@code{RECORD /}@var{structure-name}@code{/} by
|
|
|
|
@code{TYPE(}@var{type-name}@code{)}. Finally, in the component access,
|
|
|
|
replace the period (@code{.}) by the percent sign (@code{%}).
|
|
|
|
|
|
|
|
Here is an example of code using the non portable record structure syntax:
|
2008-02-16 15:10:12 +01:00
|
|
|
|
|
|
|
@example
|
|
|
|
! Declaring a structure named ``item'' and containing three fields:
|
|
|
|
! an integer ID, an description string and a floating-point price.
|
|
|
|
STRUCTURE /item/
|
|
|
|
INTEGER id
|
|
|
|
CHARACTER(LEN=200) description
|
|
|
|
REAL price
|
|
|
|
END STRUCTURE
|
|
|
|
|
|
|
|
! Define two variables, an single record of type ``item''
|
|
|
|
! named ``pear'', and an array of items named ``store_catalog''
|
|
|
|
RECORD /item/ pear, store_catalog(100)
|
|
|
|
|
|
|
|
! We can directly access the fields of both variables
|
|
|
|
pear.id = 92316
|
|
|
|
pear.description = "juicy D'Anjou pear"
|
|
|
|
pear.price = 0.15
|
|
|
|
store_catalog(7).id = 7831
|
|
|
|
store_catalog(7).description = "milk bottle"
|
|
|
|
store_catalog(7).price = 1.2
|
|
|
|
|
2008-12-21 19:45:17 +01:00
|
|
|
! We can also manipulate the whole structure
|
2008-02-16 15:10:12 +01:00
|
|
|
store_catalog(12) = pear
|
|
|
|
print *, store_catalog(12)
|
|
|
|
@end example
|
|
|
|
|
|
|
|
@noindent
|
|
|
|
This code can easily be rewritten in the Fortran 90 syntax as following:
|
|
|
|
|
|
|
|
@example
|
|
|
|
! ``STRUCTURE /name/ ... END STRUCTURE'' becomes
|
|
|
|
! ``TYPE name ... END TYPE''
|
|
|
|
TYPE item
|
|
|
|
INTEGER id
|
|
|
|
CHARACTER(LEN=200) description
|
|
|
|
REAL price
|
|
|
|
END TYPE
|
|
|
|
|
|
|
|
! ``RECORD /name/ variable'' becomes ``TYPE(name) variable''
|
|
|
|
TYPE(item) pear, store_catalog(100)
|
|
|
|
|
|
|
|
! Instead of using a dot (.) to access fields of a record, the
|
|
|
|
! standard syntax uses a percent sign (%)
|
|
|
|
pear%id = 92316
|
|
|
|
pear%description = "juicy D'Anjou pear"
|
|
|
|
pear%price = 0.15
|
|
|
|
store_catalog(7)%id = 7831
|
|
|
|
store_catalog(7)%description = "milk bottle"
|
|
|
|
store_catalog(7)%price = 1.2
|
|
|
|
|
2011-11-07 23:21:54 +01:00
|
|
|
! Assignments of a whole variable do not change
|
2008-02-16 15:10:12 +01:00
|
|
|
store_catalog(12) = pear
|
|
|
|
print *, store_catalog(12)
|
|
|
|
@end example
|
|
|
|
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
@noindent
|
|
|
|
GNU Fortran implements STRUCTURES like derived types with the following
|
|
|
|
rules and exceptions:
|
|
|
|
|
|
|
|
@itemize @bullet
|
|
|
|
@item Structures act like derived types with the @code{SEQUENCE} attribute.
|
|
|
|
Otherwise they may contain no specifiers.
|
|
|
|
|
|
|
|
@item Structures may share names with other symbols. For example, the following
|
|
|
|
is invalid for derived types, but valid for structures:
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
structure /header/
|
|
|
|
! ...
|
|
|
|
end structure
|
|
|
|
record /header/ header
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
@item Structure types may be declared nested within another parent structure.
|
|
|
|
The syntax is:
|
|
|
|
@smallexample
|
|
|
|
structure /type-name/
|
|
|
|
...
|
|
|
|
structure [/<type-name>/] <field-list>
|
|
|
|
...
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
The type name may be ommitted, in which case the structure type itself is
|
|
|
|
anonymous, and other structures of the same type cannot be instantiated. The
|
|
|
|
following shows some examples:
|
|
|
|
|
|
|
|
@example
|
|
|
|
structure /appointment/
|
|
|
|
! nested structure definition: app_time is an array of two 'time'
|
|
|
|
structure /time/ app_time (2)
|
|
|
|
integer(1) hour, minute
|
|
|
|
end structure
|
|
|
|
character(10) memo
|
|
|
|
end structure
|
|
|
|
|
|
|
|
! The 'time' structure is still usable
|
|
|
|
record /time/ now
|
|
|
|
now = time(5, 30)
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
structure /appointment/
|
|
|
|
! anonymous nested structure definition
|
|
|
|
structure start, end
|
|
|
|
integer(1) hour, minute
|
|
|
|
end structure
|
|
|
|
character(10) memo
|
|
|
|
end structure
|
|
|
|
@end example
|
|
|
|
|
|
|
|
@item Structures may contain @code{UNION} blocks. For more detail see the
|
|
|
|
section on @ref{UNION and MAP}.
|
2008-02-16 15:10:12 +01:00
|
|
|
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
@item Structures support old-style initialization of components, like
|
|
|
|
those described in @ref{Old-style variable initialization}. For array
|
|
|
|
initializers, an initializer may contain a repeat specification of the form
|
|
|
|
@code{<literal-integer> * <constant-initializer>}. The value of the integer
|
|
|
|
indicates the number of times to repeat the constant initializer when expanding
|
|
|
|
the initializer list.
|
|
|
|
@end itemize
|
|
|
|
|
|
|
|
@node UNION and MAP
|
|
|
|
@subsection @code{UNION} and @code{MAP}
|
|
|
|
@cindex @code{UNION}
|
|
|
|
@cindex @code{MAP}
|
|
|
|
|
|
|
|
Unions are an old vendor extension which were commonly used with the
|
|
|
|
non-standard @ref{STRUCTURE and RECORD} extensions. Use of @code{UNION} and
|
|
|
|
@code{MAP} is automatically enabled with @option{-fdec-structure}.
|
|
|
|
|
|
|
|
A @code{UNION} declaration occurs within a structure; within the definition of
|
|
|
|
each union is a number of @code{MAP} blocks. Each @code{MAP} shares storage
|
|
|
|
with its sibling maps (in the same union), and the size of the union is the
|
|
|
|
size of the largest map within it, just as with unions in C. The major
|
|
|
|
difference is that component references do not indicate which union or map the
|
|
|
|
component is in (the compiler gets to figure that out).
|
|
|
|
|
|
|
|
Here is a small example:
|
|
|
|
@smallexample
|
|
|
|
structure /myunion/
|
|
|
|
union
|
|
|
|
map
|
2016-05-14 18:00:35 +02:00
|
|
|
character(2) w0, w1, w2
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
end map
|
|
|
|
map
|
2016-05-14 18:00:35 +02:00
|
|
|
character(6) long
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
end map
|
|
|
|
end union
|
|
|
|
end structure
|
|
|
|
|
|
|
|
record /myunion/ rec
|
2016-05-14 18:00:35 +02:00
|
|
|
! After this assignment...
|
|
|
|
rec.long = 'hello!'
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
|
|
|
|
! The following is true:
|
2016-05-14 18:00:35 +02:00
|
|
|
! rec.w0 === 'he'
|
|
|
|
! rec.w1 === 'll'
|
|
|
|
! rec.w2 === 'o!'
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
@end smallexample
|
|
|
|
|
2016-05-14 18:00:35 +02:00
|
|
|
The two maps share memory, and the size of the union is ultimately six bytes:
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
|
|
|
|
@example
|
|
|
|
0 1 2 3 4 5 6 Byte offset
|
|
|
|
-------------------------------
|
|
|
|
| | | | | | |
|
|
|
|
-------------------------------
|
|
|
|
|
|
|
|
^ W0 ^ W1 ^ W2 ^
|
|
|
|
\-------/ \-------/ \-------/
|
|
|
|
|
2016-05-14 18:00:35 +02:00
|
|
|
^ LONG ^
|
|
|
|
\---------------------------/
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
@end example
|
|
|
|
|
|
|
|
Following is an example mirroring the layout of an Intel x86_64 register:
|
|
|
|
|
|
|
|
@example
|
|
|
|
structure /reg/
|
2016-05-14 18:00:35 +02:00
|
|
|
union ! U0 ! rax
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
map
|
2016-05-14 18:00:35 +02:00
|
|
|
character(16) rx
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
end map
|
|
|
|
map
|
2016-05-14 18:00:35 +02:00
|
|
|
character(8) rh ! rah
|
|
|
|
union ! U1
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
map
|
2016-05-14 18:00:35 +02:00
|
|
|
character(8) rl ! ral
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
end map
|
|
|
|
map
|
2016-05-14 18:00:35 +02:00
|
|
|
character(8) ex ! eax
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
end map
|
|
|
|
map
|
2016-05-14 18:00:35 +02:00
|
|
|
character(4) eh ! eah
|
|
|
|
union ! U2
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
map
|
2016-05-14 18:00:35 +02:00
|
|
|
character(4) el ! eal
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
end map
|
|
|
|
map
|
2016-05-14 18:00:35 +02:00
|
|
|
character(4) x ! ax
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
end map
|
|
|
|
map
|
2016-05-14 18:00:35 +02:00
|
|
|
character(2) h ! ah
|
|
|
|
character(2) l ! al
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
end map
|
2016-05-14 18:00:35 +02:00
|
|
|
end union
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
end map
|
2016-05-14 18:00:35 +02:00
|
|
|
end union
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
end map
|
2016-05-14 18:00:35 +02:00
|
|
|
end union
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
end structure
|
|
|
|
record /reg/ a
|
|
|
|
|
|
|
|
! After this assignment...
|
2016-05-14 18:00:35 +02:00
|
|
|
a.rx = 'AAAAAAAA.BBB.C.D'
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
|
|
|
|
! The following is true:
|
2016-05-14 18:00:35 +02:00
|
|
|
a.rx === 'AAAAAAAA.BBB.C.D'
|
|
|
|
a.rh === 'AAAAAAAA'
|
|
|
|
a.rl === '.BBB.C.D'
|
|
|
|
a.ex === '.BBB.C.D'
|
|
|
|
a.eh === '.BBB'
|
|
|
|
a.el === '.C.D'
|
|
|
|
a.x === '.C.D'
|
|
|
|
a.h === '.C'
|
|
|
|
a.l === '.D'
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
@end example
|
|
|
|
|
2016-08-03 16:55:26 +02:00
|
|
|
@node Type variants for integer intrinsics
|
|
|
|
@subsection Type variants for integer intrinsics
|
|
|
|
@cindex intrinsics, integer
|
|
|
|
|
|
|
|
Similar to the D/C prefixes to real functions to specify the input/output
|
|
|
|
types, GNU Fortran offers B/I/J/K prefixes to integer functions for
|
|
|
|
compatibility with DEC programs. The types implied by each are:
|
|
|
|
|
|
|
|
@example
|
|
|
|
@code{B} - @code{INTEGER(kind=1)}
|
|
|
|
@code{I} - @code{INTEGER(kind=2)}
|
|
|
|
@code{J} - @code{INTEGER(kind=4)}
|
|
|
|
@code{K} - @code{INTEGER(kind=8)}
|
|
|
|
@end example
|
|
|
|
|
|
|
|
GNU Fortran supports these with the flag @option{-fdec-intrinsic-ints}.
|
|
|
|
Intrinsics for which prefixed versions are available and in what form are noted
|
|
|
|
in @ref{Intrinsic Procedures}. The complete list of supported intrinsics is
|
|
|
|
here:
|
|
|
|
|
|
|
|
@multitable @columnfractions .2 .2 .2 .2 .2
|
|
|
|
|
|
|
|
@headitem Intrinsic @tab B @tab I @tab J @tab K
|
|
|
|
|
|
|
|
@item @code{@ref{ABS}}
|
|
|
|
@tab @code{BABS} @tab @code{IIABS} @tab @code{JIABS} @tab @code{KIABS}
|
|
|
|
@item @code{@ref{BTEST}}
|
|
|
|
@tab @code{BBTEST} @tab @code{BITEST} @tab @code{BJTEST} @tab @code{BKTEST}
|
|
|
|
@item @code{@ref{IAND}}
|
|
|
|
@tab @code{BIAND} @tab @code{IIAND} @tab @code{JIAND} @tab @code{KIAND}
|
|
|
|
@item @code{@ref{IBCLR}}
|
|
|
|
@tab @code{BBCLR} @tab @code{IIBCLR} @tab @code{JIBCLR} @tab @code{KIBCLR}
|
|
|
|
@item @code{@ref{IBITS}}
|
|
|
|
@tab @code{BBITS} @tab @code{IIBITS} @tab @code{JIBITS} @tab @code{KIBITS}
|
|
|
|
@item @code{@ref{IBSET}}
|
|
|
|
@tab @code{BBSET} @tab @code{IIBSET} @tab @code{JIBSET} @tab @code{KIBSET}
|
|
|
|
@item @code{@ref{IEOR}}
|
|
|
|
@tab @code{BIEOR} @tab @code{IIEOR} @tab @code{JIEOR} @tab @code{KIEOR}
|
|
|
|
@item @code{@ref{IOR}}
|
|
|
|
@tab @code{BIOR} @tab @code{IIOR} @tab @code{JIOR} @tab @code{KIOR}
|
|
|
|
@item @code{@ref{ISHFT}}
|
|
|
|
@tab @code{BSHFT} @tab @code{IISHFT} @tab @code{JISHFT} @tab @code{KISHFT}
|
|
|
|
@item @code{@ref{ISHFTC}}
|
|
|
|
@tab @code{BSHFTC} @tab @code{IISHFTC} @tab @code{JISHFTC} @tab @code{KISHFTC}
|
|
|
|
@item @code{@ref{MOD}}
|
|
|
|
@tab @code{BMOD} @tab @code{IMOD} @tab @code{JMOD} @tab @code{KMOD}
|
|
|
|
@item @code{@ref{NOT}}
|
|
|
|
@tab @code{BNOT} @tab @code{INOT} @tab @code{JNOT} @tab @code{KNOT}
|
|
|
|
@item @code{@ref{REAL}}
|
|
|
|
@tab @code{--} @tab @code{FLOATI} @tab @code{FLOATJ} @tab @code{FLOATK}
|
|
|
|
@end multitable
|
|
|
|
|
lang.opt, [...]: New flag -fdec-static.
2016-09-23 Fritz Reese <fritzoreese@gmail.com>
gcc/fortran/
* lang.opt, invoke.texi, gfortran.texi: New flag -fdec-static.
* options.c (set_dec_flags): Set -fdec-static with -fdec.
* gfortran.h (symbol_attribute): New attribute automatic.
* gfortran.h (gfc_add_automatic): New prototype.
* match.h (gfc_match_automatic, gfc_match_static): New functions.
* decl.c (gfc_match_automatic, gfc_match_static): Ditto.
* symbol.c (gfc_add_automatic): Ditto.
* decl.c (match_attr_spec): Match AUTOMATIC and STATIC decls.
* parse.c (decode_specification_statement, decode_statement): Ditto.
* resolve.c (apply_default_init_local, resolve_fl_variable_derived,
resolve_symbol): Support for automatic attribute.
* symbol.c (check_conflict, gfc_copy_attr, gfc_is_var_automatic):
Ditto.
* trans-decl.c (gfc_finish_var_decl): Ditto.
gcc/testsuite/gfortran.dg/
* dec_static_1.f90, dec_static_2.f90, dec_static_3.f90,
dec_static_4.f90: New testcases.
From-SVN: r240458
2016-09-23 23:06:18 +02:00
|
|
|
@node AUTOMATIC and STATIC attributes
|
|
|
|
@subsection @code{AUTOMATIC} and @code{STATIC} attributes
|
|
|
|
@cindex variable attributes
|
|
|
|
@cindex @code{AUTOMATIC}
|
|
|
|
@cindex @code{STATIC}
|
|
|
|
|
|
|
|
With @option{-fdec-static} GNU Fortran supports the DEC extended attributes
|
|
|
|
@code{STATIC} and @code{AUTOMATIC} to provide explicit specification of entity
|
|
|
|
storage. These follow the syntax of the Fortran standard @code{SAVE} attribute.
|
|
|
|
|
|
|
|
@code{STATIC} is exactly equivalent to @code{SAVE}, and specifies that
|
|
|
|
an entity should be allocated in static memory. As an example, @code{STATIC}
|
|
|
|
local variables will retain their values across multiple calls to a function.
|
|
|
|
|
|
|
|
Entities marked @code{AUTOMATIC} will be stack automatic whenever possible.
|
|
|
|
@code{AUTOMATIC} is the default for local variables smaller than
|
|
|
|
@option{-fmax-stack-var-size}, unless @option{-fno-automatic} is given. This
|
|
|
|
attribute overrides @option{-fno-automatic}, @option{-fmax-stack-var-size}, and
|
|
|
|
blanket @code{SAVE} statements.
|
|
|
|
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
|
|
@example
|
|
|
|
subroutine f
|
|
|
|
integer, automatic :: i ! automatic variable
|
|
|
|
integer x, y ! static variables
|
|
|
|
save
|
|
|
|
...
|
|
|
|
endsubroutine
|
|
|
|
@end example
|
|
|
|
@example
|
|
|
|
subroutine f
|
|
|
|
integer a, b, c, x, y, z
|
|
|
|
static :: x
|
|
|
|
save y
|
|
|
|
automatic z, c
|
|
|
|
! a, b, c, and z are automatic
|
|
|
|
! x and y are static
|
|
|
|
endsubroutine
|
|
|
|
@end example
|
|
|
|
@example
|
|
|
|
! Compiled with -fno-automatic
|
|
|
|
subroutine f
|
|
|
|
integer a, b, c, d
|
|
|
|
automatic :: a
|
|
|
|
! a is automatic; b, c, and d are static
|
|
|
|
endsubroutine
|
|
|
|
@end example
|
|
|
|
|
New flag -fdec-math for COTAN and degree trig intrinsics.
2016-10-11 Fritz Reese <fritzoreese@gmail.com>
New flag -fdec-math for COTAN and degree trig intrinsics.
gcc/fortran/
* lang.opt: New flag -fdec-math.
* options.c (set_dec_flags): Enable with -fdec.
* invoke.texi, gfortran.texi, intrinsic.texi: Update documentation.
* intrinsics.c (add_functions, do_simplify): New intrinsics
with -fdec-math.
* gfortran.h (gfc_isym_id): New isym GFC_ISYM_COTAN.
* gfortran.h (gfc_resolve_atan2d, gfc_resolve_cotan,
gfc_resolve_trigd, gfc_resolve_atrigd): New prototypes.
* iresolve.c (resolve_trig_call, get_degrees, get_radians,
is_trig_resolved, gfc_resolve_cotan, gfc_resolve_trigd,
gfc_resolve_atrigd, gfc_resolve_atan2d): New functions.
* intrinsics.h (gfc_simplify_atan2d, gfc_simplify_atrigd,
gfc_simplify_cotan, gfc_simplify_trigd): New prototypes.
* simplify.c (simplify_trig_call, degrees_f, radians_f,
gfc_simplify_cotan, gfc_simplify_trigd, gfc_simplify_atrigd,
gfc_simplify_atan2d): New functions.
gcc/testsuite/gfortran.dg/
* dec_math.f90: New testsuite.
From-SVN: r240989
2016-10-11 13:21:07 +02:00
|
|
|
@node Extended math intrinsics
|
|
|
|
@subsection Extended math intrinsics
|
|
|
|
@cindex intrinsics, math
|
|
|
|
@cindex intrinsics, trigonometric functions
|
|
|
|
|
|
|
|
GNU Fortran supports an extended list of mathematical intrinsics with the
|
|
|
|
compile flag @option{-fdec-math} for compatability with legacy code.
|
|
|
|
These intrinsics are described fully in @ref{Intrinsic Procedures} where it is
|
|
|
|
noted that they are extensions and should be avoided whenever possible.
|
|
|
|
|
|
|
|
Specifically, @option{-fdec-math} enables the @ref{COTAN} intrinsic, and
|
|
|
|
trigonometric intrinsics which accept or produce values in degrees instead of
|
|
|
|
radians. Here is a summary of the new intrinsics:
|
|
|
|
|
|
|
|
@multitable @columnfractions .5 .5
|
|
|
|
@headitem Radians @tab Degrees
|
|
|
|
@item @code{@ref{ACOS}} @tab @code{@ref{ACOSD}}*
|
|
|
|
@item @code{@ref{ASIN}} @tab @code{@ref{ASIND}}*
|
|
|
|
@item @code{@ref{ATAN}} @tab @code{@ref{ATAND}}*
|
|
|
|
@item @code{@ref{ATAN2}} @tab @code{@ref{ATAN2D}}*
|
|
|
|
@item @code{@ref{COS}} @tab @code{@ref{COSD}}*
|
|
|
|
@item @code{@ref{COTAN}}* @tab @code{@ref{COTAND}}*
|
|
|
|
@item @code{@ref{SIN}} @tab @code{@ref{SIND}}*
|
|
|
|
@item @code{@ref{TAN}} @tab @code{@ref{TAND}}*
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
* Enabled with @option{-fdec-math}.
|
|
|
|
|
|
|
|
For advanced users, it may be important to know the implementation of these
|
|
|
|
functions. They are simply wrappers around the standard radian functions, which
|
|
|
|
have more accurate builtin versions. These functions convert their arguments
|
|
|
|
(or results) to degrees (or radians) by taking the value modulus 360 (or 2*pi)
|
|
|
|
and then multiplying it by a constant radian-to-degree (or degree-to-radian)
|
|
|
|
factor, as appropriate. The factor is computed at compile-time as 180/pi (or
|
|
|
|
pi/180).
|
|
|
|
|
2016-10-25 17:20:36 +02:00
|
|
|
@node Form feed as whitespace
|
|
|
|
@subsection Form feed as whitespace
|
|
|
|
@cindex form feed whitespace
|
|
|
|
|
|
|
|
Historically, legacy compilers allowed insertion of form feed characters ('\f',
|
|
|
|
ASCII 0xC) at the beginning of lines for formatted output to line printers,
|
|
|
|
though the Fortran standard does not mention this. GNU Fortran supports the
|
|
|
|
interpretation of form feed characters in source as whitespace for
|
|
|
|
compatibility.
|
|
|
|
|
2016-10-25 17:24:36 +02:00
|
|
|
@node TYPE as an alias for PRINT
|
|
|
|
@subsection TYPE as an alias for PRINT
|
|
|
|
@cindex type alias print
|
|
|
|
For compatibility, GNU Fortran will interpret @code{TYPE} statements as
|
|
|
|
@code{PRINT} statements with the flag @option{-fdec}. With this flag asserted,
|
|
|
|
the following two examples are equivalent:
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
TYPE *, 'hello world'
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
PRINT *, 'hello world'
|
|
|
|
@end smallexample
|
|
|
|
|
2016-10-25 17:27:39 +02:00
|
|
|
@node %LOC as an rvalue
|
|
|
|
@subsection %LOC as an rvalue
|
|
|
|
@cindex LOC
|
|
|
|
Normally @code{%LOC} is allowed only in parameter lists. However the intrinsic
|
|
|
|
function @code{LOC} does the same thing, and is usable as the right-hand-side of
|
|
|
|
assignments. For compatibility, GNU Fortran supports the use of @code{%LOC} as
|
|
|
|
an alias for the builtin @code{LOC} with @option{-std=legacy}. With this
|
|
|
|
feature enabled the following two examples are equivalent:
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
integer :: i, l
|
|
|
|
l = %loc(i)
|
|
|
|
call sub(l)
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
integer :: i
|
|
|
|
call sub(%loc(i))
|
|
|
|
@end smallexample
|
|
|
|
|
2016-10-25 17:30:51 +02:00
|
|
|
@node .XOR. operator
|
|
|
|
@subsection .XOR. operator
|
|
|
|
@cindex operators, xor
|
|
|
|
|
|
|
|
GNU Fortran supports @code{.XOR.} as a logical operator with @code{-std=legacy}
|
|
|
|
for compatibility with legacy code. @code{.XOR.} is equivalent to
|
|
|
|
@code{.NEQV.}. That is, the output is true if and only if the inputs differ.
|
|
|
|
|
2016-10-25 20:27:51 +02:00
|
|
|
@node Bitwise logical operators
|
|
|
|
@subsection Bitwise logical operators
|
|
|
|
@cindex logical, bitwise
|
|
|
|
|
|
|
|
With @option{-fdec}, GNU Fortran relaxes the type constraints on
|
|
|
|
logical operators to allow integer operands, and performs the corresponding
|
|
|
|
bitwise operation instead. This flag is for compatibility only, and should be
|
|
|
|
avoided in new code. Consider:
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
INTEGER :: i, j
|
|
|
|
i = z'33'
|
|
|
|
j = z'cc'
|
|
|
|
print *, i .AND. j
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
In this example, compiled with @option{-fdec}, GNU Fortran will
|
|
|
|
replace the @code{.AND.} operation with a call to the intrinsic
|
|
|
|
@code{@ref{IAND}} function, yielding the bitwise-and of @code{i} and @code{j}.
|
|
|
|
|
|
|
|
Note that this conversion will occur if at least one operand is of integral
|
|
|
|
type. As a result, a logical operand will be converted to an integer when the
|
|
|
|
other operand is an integer in a logical operation. In this case,
|
|
|
|
@code{.TRUE.} is converted to @code{1} and @code{.FALSE.} to @code{0}.
|
|
|
|
|
|
|
|
Here is the mapping of logical operator to bitwise intrinsic used with
|
|
|
|
@option{-fdec}:
|
|
|
|
|
|
|
|
@multitable @columnfractions .25 .25 .5
|
|
|
|
@headitem Operator @tab Intrinsic @tab Bitwise operation
|
|
|
|
@item @code{.NOT.} @tab @code{@ref{NOT}} @tab complement
|
|
|
|
@item @code{.AND.} @tab @code{@ref{IAND}} @tab intersection
|
|
|
|
@item @code{.OR.} @tab @code{@ref{IOR}} @tab union
|
|
|
|
@item @code{.NEQV.} @tab @code{@ref{IEOR}} @tab exclusive or
|
|
|
|
@item @code{.EQV.} @tab @code{@ref{NOT}(@ref{IEOR})} @tab complement of exclusive or
|
|
|
|
@end multitable
|
|
|
|
|
New I/O specifiers CARRIAGECONTROL, READONLY, SHARE with -fdec.
gcc/fortran/
* gfortran.texi: Document.
* frontend-passes.c (gfc_code_walker): Add SHARE and CARRIAGECONTROL.
* io.c (gfc_free_open, gfc_resolve_open, gfc_match_open): Ditto.
* gfortran.h (gfc_open): Add SHARE, CARRIAGECONTROL, and READONLY.
* io.c (io_tag, match_open_element): Ditto.
* ioparm.def: Ditto.
* trans-io.c (gfc_trans_open): Ditto.
* io.c (match_dec_etag, match_dec_ftag): New functions.
libgfortran/io/
* libgfortran.h (IOPARM_OPEN_HAS_READONLY, IOPARM_OPEN_HAS_SHARE,
IOPARM_OPEN_HAS_CC): New for READONLY, SHARE, and CARRIAGECONTROL.
* close.c (st_close): Support READONLY.
* io.h (st_parameter_open, unit_flags): Support SHARE, CARRIAGECONTROL,
and READONLY.
* open.c (st_open): Ditto.
* transfer.c (data_transfer_init): Ditto.
* io.h (st_parameter_dt): New member 'cc' for CARRIAGECONTROL.
* write.c (write_check_cc, write_cc): New functions for CARRIAGECONTROL.
* transfer.c (next_record_cc): Ditto.
* file_pos.c (st_endfile): Support SHARE and CARRIAGECONTROL.
* io.h (st_parameter_inquire): Ditto.
* open.c (edit_modes, new_unit): Ditto.
* inquire.c (inquire_via_unit, inquire_via_filename): Ditto.
* io.h (unit_share, unit_cc, cc_fortran, IOPARM_INQUIRE_HAS_SHARE,
IOPARM_INQUIRE_HAS_CC): New for SHARE and CARRIAGECONTROL.
* open.c (share_opt, cc_opt): Ditto.
* read.c (read_x): Support CARRIAGECONTROL.
* transfer.c (read_sf, next_record_r, next_record_w): Ditto.
* write.c (list_formatted_write_scalar, write_a): Ditto.
* unix.h (close_share): New prototype.
* unix.c (open_share, close_share): New functions to handle SHARE.
* unix.c (open_external): Handle READONLY. Call open_share.
* close.c (st_close): Call close_share.
gcc/testsuite/
* dec_io_1.f90: New test.
* dec_io_2.f90: New test.
* dec_io_3.f90: New test.
* dec_io_4.f90: New test.
* dec_io_5.f90: New test.
* dec_io_6.f90: New test.
From-SVN: r241550
2016-10-26 14:11:44 +02:00
|
|
|
@node Extended I/O specifiers
|
|
|
|
@subsection Extended I/O specifiers
|
|
|
|
@cindex @code{CARRIAGECONTROL}
|
|
|
|
@cindex @code{READONLY}
|
|
|
|
@cindex @code{SHARE}
|
|
|
|
@cindex @code{SHARED}
|
|
|
|
@cindex @code{NOSHARED}
|
|
|
|
@cindex I/O specifiers
|
|
|
|
|
|
|
|
GNU Fortran supports the additional legacy I/O specifiers
|
|
|
|
@code{CARRIAGECONTROL}, @code{READONLY}, and @code{SHARE} with the
|
|
|
|
compile flag @option{-fdec}, for compatibility.
|
|
|
|
|
|
|
|
@table @code
|
|
|
|
@item CARRIAGECONTROL
|
|
|
|
The @code{CARRIAGECONTROL} specifier allows a user to control line
|
|
|
|
termination settings between output records for an I/O unit. The specifier has
|
|
|
|
no meaning for readonly files. When @code{CARRAIGECONTROL} is specified upon
|
|
|
|
opening a unit for formatted writing, the exact @code{CARRIAGECONTROL} setting
|
|
|
|
determines what characters to write between output records. The syntax is:
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
OPEN(..., CARRIAGECONTROL=cc)
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
Where @emph{cc} is a character expression that evaluates to one of the
|
|
|
|
following values:
|
|
|
|
|
|
|
|
@multitable @columnfractions .2 .8
|
|
|
|
@item @code{'LIST'} @tab One line feed between records (default)
|
|
|
|
@item @code{'FORTRAN'} @tab Legacy interpretation of the first character (see below)
|
|
|
|
@item @code{'NONE'} @tab No separator between records
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
With @code{CARRIAGECONTROL='FORTRAN'}, when a record is written, the first
|
|
|
|
character of the input record is not written, and instead determines the output
|
|
|
|
record separator as follows:
|
|
|
|
|
|
|
|
@multitable @columnfractions .3 .3 .4
|
|
|
|
@headitem Leading character @tab Meaning @tab Output separating character(s)
|
|
|
|
@item @code{'+'} @tab Overprinting @tab Carriage return only
|
|
|
|
@item @code{'-'} @tab New line @tab Line feed and carriage return
|
|
|
|
@item @code{'0'} @tab Skip line @tab Two line feeds and carriage return
|
|
|
|
@item @code{'1'} @tab New page @tab Form feed and carriage return
|
|
|
|
@item @code{'$'} @tab Prompting @tab Line feed (no carriage return)
|
|
|
|
@item @code{CHAR(0)} @tab Overprinting (no advance) @tab None
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item READONLY
|
|
|
|
The @code{READONLY} specifier may be given upon opening a unit, and is
|
|
|
|
equivalent to specifying @code{ACTION='READ'}, except that the file may not be
|
|
|
|
deleted on close (i.e. @code{CLOSE} with @code{STATUS="DELETE"}). The syntax
|
|
|
|
is:
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
@code{OPEN(..., READONLY)}
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
@item SHARE
|
|
|
|
The @code{SHARE} specifier allows system-level locking on a unit upon opening
|
|
|
|
it for controlled access from multiple processes/threads. The @code{SHARE}
|
|
|
|
specifier has several forms:
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
OPEN(..., SHARE=sh)
|
|
|
|
OPEN(..., SHARED)
|
|
|
|
OPEN(..., NOSHARED)
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
Where @emph{sh} in the first form is a character expression that evaluates to
|
|
|
|
a value as seen in the table below. The latter two forms are aliases
|
|
|
|
for particular values of @emph{sh}:
|
|
|
|
|
|
|
|
@multitable @columnfractions .3 .3 .4
|
|
|
|
@headitem Explicit form @tab Short form @tab Meaning
|
|
|
|
@item @code{SHARE='DENYRW'} @tab @code{NOSHARED} @tab Exclusive (write) lock
|
|
|
|
@item @code{SHARE='DENYNONE'} @tab @code{SHARED} @tab Shared (read) lock
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
In general only one process may hold an exclusive (write) lock for a given file
|
|
|
|
at a time, whereas many processes may hold shared (read) locks for the same
|
|
|
|
file.
|
|
|
|
|
|
|
|
The behavior of locking may vary with your operating system. On POSIX systems,
|
|
|
|
locking is implemented with @code{fcntl}. Consult your corresponding operating
|
|
|
|
system's manual pages for further details. Locking via @code{SHARE=} is not
|
|
|
|
supported on other systems.
|
|
|
|
|
|
|
|
@end table
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
|
2016-11-03 17:00:58 +01:00
|
|
|
@node Legacy PARAMETER statements
|
|
|
|
@subsection Legacy PARAMETER statements
|
|
|
|
@cindex PARAMETER
|
|
|
|
|
|
|
|
For compatibility, GNU Fortran supports legacy PARAMETER statements without
|
|
|
|
parentheses with @option{-std=legacy}. A warning is emitted if used with
|
|
|
|
@option{-std=gnu}, and an error is acknowledged with a real Fortran standard
|
|
|
|
flag (@option{-std=f95}, etc...). These statements take the following form:
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
implicit real (E)
|
|
|
|
parameter e = 2.718282
|
|
|
|
real c
|
|
|
|
parameter c = 3.0e8
|
|
|
|
@end smallexample
|
|
|
|
|
2016-11-03 19:09:44 +01:00
|
|
|
@node Default exponents
|
|
|
|
@subsection Default exponents
|
|
|
|
@cindex exponent
|
|
|
|
|
|
|
|
For compatibility, GNU Fortran supports a default exponent of zero in real
|
|
|
|
constants with @option{-fdec}. For example, @code{9e} would be
|
|
|
|
interpreted as @code{9e0}, rather than an error.
|
|
|
|
|
2016-11-03 17:00:58 +01:00
|
|
|
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
@node Extensions not implemented in GNU Fortran
|
|
|
|
@section Extensions not implemented in GNU Fortran
|
|
|
|
@cindex extensions, not implemented
|
|
|
|
|
|
|
|
The long history of the Fortran language, its wide use and broad
|
|
|
|
userbase, the large number of different compiler vendors and the lack of
|
|
|
|
some features crucial to users in the first standards have lead to the
|
|
|
|
existence of a number of important extensions to the language. While
|
|
|
|
some of the most useful or popular extensions are supported by the GNU
|
|
|
|
Fortran compiler, not all existing extensions are supported. This section
|
|
|
|
aims at listing these extensions and offering advice on how best make
|
|
|
|
code that uses them running with the GNU Fortran compiler.
|
2008-02-16 15:10:12 +01:00
|
|
|
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
@c More can be found here:
|
|
|
|
@c -- https://gcc.gnu.org/onlinedocs/gcc-3.4.6/g77/Missing-Features.html
|
|
|
|
@c -- the list of Fortran and libgfortran bugs closed as WONTFIX:
|
|
|
|
@c http://tinyurl.com/2u4h5y
|
|
|
|
|
|
|
|
@menu
|
|
|
|
* ENCODE and DECODE statements::
|
|
|
|
* Variable FORMAT expressions::
|
|
|
|
@c * Q edit descriptor::
|
|
|
|
@c * TYPE and ACCEPT I/O Statements::
|
New I/O specifiers CARRIAGECONTROL, READONLY, SHARE with -fdec.
gcc/fortran/
* gfortran.texi: Document.
* frontend-passes.c (gfc_code_walker): Add SHARE and CARRIAGECONTROL.
* io.c (gfc_free_open, gfc_resolve_open, gfc_match_open): Ditto.
* gfortran.h (gfc_open): Add SHARE, CARRIAGECONTROL, and READONLY.
* io.c (io_tag, match_open_element): Ditto.
* ioparm.def: Ditto.
* trans-io.c (gfc_trans_open): Ditto.
* io.c (match_dec_etag, match_dec_ftag): New functions.
libgfortran/io/
* libgfortran.h (IOPARM_OPEN_HAS_READONLY, IOPARM_OPEN_HAS_SHARE,
IOPARM_OPEN_HAS_CC): New for READONLY, SHARE, and CARRIAGECONTROL.
* close.c (st_close): Support READONLY.
* io.h (st_parameter_open, unit_flags): Support SHARE, CARRIAGECONTROL,
and READONLY.
* open.c (st_open): Ditto.
* transfer.c (data_transfer_init): Ditto.
* io.h (st_parameter_dt): New member 'cc' for CARRIAGECONTROL.
* write.c (write_check_cc, write_cc): New functions for CARRIAGECONTROL.
* transfer.c (next_record_cc): Ditto.
* file_pos.c (st_endfile): Support SHARE and CARRIAGECONTROL.
* io.h (st_parameter_inquire): Ditto.
* open.c (edit_modes, new_unit): Ditto.
* inquire.c (inquire_via_unit, inquire_via_filename): Ditto.
* io.h (unit_share, unit_cc, cc_fortran, IOPARM_INQUIRE_HAS_SHARE,
IOPARM_INQUIRE_HAS_CC): New for SHARE and CARRIAGECONTROL.
* open.c (share_opt, cc_opt): Ditto.
* read.c (read_x): Support CARRIAGECONTROL.
* transfer.c (read_sf, next_record_r, next_record_w): Ditto.
* write.c (list_formatted_write_scalar, write_a): Ditto.
* unix.h (close_share): New prototype.
* unix.c (open_share, close_share): New functions to handle SHARE.
* unix.c (open_external): Handle READONLY. Call open_share.
* close.c (st_close): Call close_share.
gcc/testsuite/
* dec_io_1.f90: New test.
* dec_io_2.f90: New test.
* dec_io_3.f90: New test.
* dec_io_4.f90: New test.
* dec_io_5.f90: New test.
* dec_io_6.f90: New test.
From-SVN: r241550
2016-10-26 14:11:44 +02:00
|
|
|
@c * DEFAULTFILE, DISPOSE and RECORDTYPE I/O specifiers::
|
re PR fortran/56226 (Add support for DEC UNION and MAP extensions)
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* module.c (dt_upper_string): Rename to gfc_dt_upper_string
(dt_lower_string): Likewise.
* gfortran.h: Make new gfc_dt_upper/lower_string global.
* class.c: Use gfc_dt_upper_string.
* decl.c: Likewise.
* symbol.c: Likewise.
* resolve.c (resolve_component): New function.
(resolve_fl_derived0): Move component loop code to resolve_component.
* parse.c (check_component): New function.
(parse_derived): Move loop code to check_component.
* lang.opt, invoke.texi, options.c : New option -fdec-structure.
* libgfortran.h (bt): New basic type BT_UNION.
* gfortran.h (gfc_option): New option -fdec-structure.
(gfc_get_union_type, gfc_compare_union_types): New prototypes.
(gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New
macros.
(gfc_find_component): Change prototype.
* match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union,
gfc_match_structure_decl): New prototypes.
* parse.h (gfc_comp_struct): New macro.
* symbol.c (gfc_find_component): Search for components in nested unions
* class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp,
copy_vtab_proc_comps): Update calls to gfc_find_component.
* primary.c (gfc_convert_to_structure_constructor): Likewise.
* symbol.c (gfc_add_component): Likewise.
* resolve.c (resolve_typebound_function, resolve_typebound_subroutine,
resolve_typebound_procedure, resolve_component, resolve_fl_derived):
Likewise.
* expr.c (get_union_init, component_init): New functions.
* decl.c (match_clist_expr, match_record_decl, get_struct_decl,
gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise.
* interface.c (compare_components, gfc_compare_union_types): Likewise.
* match.c (gfc_match_member_sep): Likewise.
* parse.c (check_component, parse_union, parse_struct_map): Likewise.
* resolve.c (resolve_fl_struct): Likewise.
* symbol.c (find_union_component): Likewise.
* trans-types.c (gfc_get_union_type): Likewise.
* parse.c (parse_derived): Use new functions.
* interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise.
* expr.c (gfc_default_initializer): Likewise.
* gfortran.texi: Support for DEC structures, unions, and maps.
* gfortran.h (gfc_statement, sym_flavor): Likewise.
* check.c (gfc_check_kill_sub): Likewise.
* expr.c (gfc_copy_expr, simplify_const_ref,
gfc_has_default_initializer): Likewise.
* decl.c (build_sym, match_data_constant, add_init_expr_to_sym,
match_pointer_init, build_struct, variable_decl,
gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry,
gfc_match_end, gfc_match_derived_decl): Likewise.
* interface.c (check_interface0, check_interface1,
gfc_search_interface): Likewise.
* misc.c (gfc_basic_typename, gfc_typename): Likewise.
* module.c (add_true_name, build_tnt, bt_types, mio_typespec,
fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol,
gfc_get_module_backend_decl): Likewise.
* parse.h (gfc_compile_state): Likewise.
* parse.c (decode_specification_statement, decode_statement,
gfc_ascii_statement, verify_st_order, parse_spec): Likewise.
* primary.c (gfc_match_varspec, gfc_match_structure_constructor,
gfc_match_rvalue, match_variable): Likewise.
* resolve.c (find_arglists, resolve_structure_cons,
is_illegal_recursion, resolve_generic_f, get_declared_from_expr,
resolve_typebound_subroutine, resolve_allocate_expr,
nonscalar_typebound_assign, generate_component_assignments,
resolve_fl_variable_derived, check_defined_assignments,
resolve_component, resolve_symbol, resolve_equivalence_derived):
Likewise.
* symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived,
gfc_restore_last_undo_checkpoint, gfc_type_compatible,
gfc_find_dt_in_generic): Likewise.
* trans-decl.c (gfc_get_module_backend_decl, create_function_arglist,
gfc_create_module_variable, check_constant_initializer): Likewise.
* trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer,
gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign,
gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p):
Likewise.
* trans-io.c (transfer_namelist_element, transfer_expr,
gfc_trans_transfer): Likewise.
* trans-stmt.c (gfc_trans_deallocate): Likewise.
* trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal,
gfc_get_derived_type): Likewise.
2016-05-07 Fritz Reese <fritzoreese@gmail.com>
PR fortran/56226
* gfortran.dg/dec_structure_1.f90: New testcase.
* gfortran.dg/dec_structure_2.f90: Ditto.
* gfortran.dg/dec_structure_3.f90: Ditto.
* gfortran.dg/dec_structure_4.f90: Ditto.
* gfortran.dg/dec_structure_5.f90: Ditto.
* gfortran.dg/dec_structure_6.f90: Ditto.
* gfortran.dg/dec_structure_7.f90: Ditto.
* gfortran.dg/dec_structure_8.f90: Ditto.
* gfortran.dg/dec_structure_9.f90: Ditto.
* gfortran.dg/dec_structure_10.f90: Ditto.
* gfortran.dg/dec_structure_11.f90: Ditto.
* gfortran.dg/dec_union_1.f90: Ditto.
* gfortran.dg/dec_union_2.f90: Ditto.
* gfortran.dg/dec_union_3.f90: Ditto.
* gfortran.dg/dec_union_4.f90: Ditto.
* gfortran.dg/dec_union_5.f90: Ditto.
* gfortran.dg/dec_union_6.f90: Ditto.
* gfortran.dg/dec_union_7.f90: Ditto.
From-SVN: r235999
2016-05-08 01:16:23 +02:00
|
|
|
@c * Omitted arguments in procedure call::
|
|
|
|
* Alternate complex function syntax::
|
|
|
|
* Volatile COMMON blocks::
|
|
|
|
* OPEN( ... NAME=)::
|
|
|
|
@end menu
|
2008-02-16 15:10:12 +01:00
|
|
|
|
|
|
|
@node ENCODE and DECODE statements
|
|
|
|
@subsection @code{ENCODE} and @code{DECODE} statements
|
|
|
|
@cindex @code{ENCODE}
|
|
|
|
@cindex @code{DECODE}
|
|
|
|
|
2011-11-07 23:21:54 +01:00
|
|
|
GNU Fortran does not support the @code{ENCODE} and @code{DECODE}
|
2008-02-16 15:10:12 +01:00
|
|
|
statements. These statements are best replaced by @code{READ} and
|
|
|
|
@code{WRITE} statements involving internal files (@code{CHARACTER}
|
|
|
|
variables and arrays), which have been part of the Fortran standard since
|
2010-09-24 08:39:20 +02:00
|
|
|
Fortran 77. For example, replace a code fragment like
|
2008-02-16 15:10:12 +01:00
|
|
|
|
|
|
|
@smallexample
|
|
|
|
INTEGER*1 LINE(80)
|
|
|
|
REAL A, B, C
|
|
|
|
c ... Code that sets LINE
|
|
|
|
DECODE (80, 9000, LINE) A, B, C
|
|
|
|
9000 FORMAT (1X, 3(F10.5))
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
@noindent
|
|
|
|
with the following:
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
CHARACTER(LEN=80) LINE
|
|
|
|
REAL A, B, C
|
|
|
|
c ... Code that sets LINE
|
|
|
|
READ (UNIT=LINE, FMT=9000) A, B, C
|
|
|
|
9000 FORMAT (1X, 3(F10.5))
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
Similarly, replace a code fragment like
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
INTEGER*1 LINE(80)
|
|
|
|
REAL A, B, C
|
|
|
|
c ... Code that sets A, B and C
|
|
|
|
ENCODE (80, 9000, LINE) A, B, C
|
|
|
|
9000 FORMAT (1X, 'OUTPUT IS ', 3(F10.5))
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
@noindent
|
|
|
|
with the following:
|
|
|
|
|
|
|
|
@smallexample
|
2009-08-25 20:24:25 +02:00
|
|
|
CHARACTER(LEN=80) LINE
|
2008-02-16 15:10:12 +01:00
|
|
|
REAL A, B, C
|
|
|
|
c ... Code that sets A, B and C
|
|
|
|
WRITE (UNIT=LINE, FMT=9000) A, B, C
|
|
|
|
9000 FORMAT (1X, 'OUTPUT IS ', 3(F10.5))
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
|
2009-05-08 00:14:23 +02:00
|
|
|
@node Variable FORMAT expressions
|
|
|
|
@subsection Variable @code{FORMAT} expressions
|
|
|
|
@cindex @code{FORMAT}
|
|
|
|
|
|
|
|
A variable @code{FORMAT} expression is format statement which includes
|
2010-09-24 08:39:20 +02:00
|
|
|
angle brackets enclosing a Fortran expression: @code{FORMAT(I<N>)}. GNU
|
|
|
|
Fortran does not support this legacy extension. The effect of variable
|
2009-05-08 00:14:23 +02:00
|
|
|
format expressions can be reproduced by using the more powerful (and
|
2010-09-24 08:39:20 +02:00
|
|
|
standard) combination of internal output and string formats. For example,
|
2009-05-08 00:14:23 +02:00
|
|
|
replace a code fragment like this:
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
WRITE(6,20) INT1
|
|
|
|
20 FORMAT(I<N+1>)
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
@noindent
|
|
|
|
with the following:
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
c Variable declaration
|
2010-05-31 22:29:05 +02:00
|
|
|
CHARACTER(LEN=20) FMT
|
2009-05-08 00:14:23 +02:00
|
|
|
c
|
|
|
|
c Other code here...
|
|
|
|
c
|
|
|
|
WRITE(FMT,'("(I", I0, ")")') N+1
|
2010-05-31 22:29:05 +02:00
|
|
|
WRITE(6,FMT) INT1
|
2009-05-08 00:14:23 +02:00
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
@noindent
|
|
|
|
or with:
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
c Variable declaration
|
|
|
|
CHARACTER(LEN=20) FMT
|
|
|
|
c
|
|
|
|
c Other code here...
|
|
|
|
c
|
|
|
|
WRITE(FMT,*) N+1
|
|
|
|
WRITE(6,"(I" // ADJUSTL(FMT) // ")") INT1
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
|
2010-06-10 22:02:39 +02:00
|
|
|
@node Alternate complex function syntax
|
|
|
|
@subsection Alternate complex function syntax
|
|
|
|
@cindex Complex function
|
|
|
|
|
|
|
|
Some Fortran compilers, including @command{g77}, let the user declare
|
|
|
|
complex functions with the syntax @code{COMPLEX FUNCTION name*16()}, as
|
2010-09-24 08:39:20 +02:00
|
|
|
well as @code{COMPLEX*16 FUNCTION name()}. Both are non-standard, legacy
|
|
|
|
extensions. @command{gfortran} accepts the latter form, which is more
|
2010-06-10 22:02:39 +02:00
|
|
|
common, but not the former.
|
|
|
|
|
|
|
|
|
2014-03-26 21:39:42 +01:00
|
|
|
@node Volatile COMMON blocks
|
|
|
|
@subsection Volatile @code{COMMON} blocks
|
|
|
|
@cindex @code{VOLATILE}
|
|
|
|
@cindex @code{COMMON}
|
|
|
|
|
|
|
|
Some Fortran compilers, including @command{g77}, let the user declare
|
|
|
|
@code{COMMON} with the @code{VOLATILE} attribute. This is
|
|
|
|
invalid standard Fortran syntax and is not supported by
|
|
|
|
@command{gfortran}. Note that @command{gfortran} accepts
|
|
|
|
@code{VOLATILE} variables in @code{COMMON} blocks since revision 4.3.
|
|
|
|
|
|
|
|
|
2016-04-13 15:17:45 +02:00
|
|
|
@node OPEN( ... NAME=)
|
|
|
|
@subsection @code{OPEN( ... NAME=)}
|
|
|
|
@cindex @code{NAM}
|
|
|
|
|
|
|
|
Some Fortran compilers, including @command{g77}, let the user declare
|
|
|
|
@code{OPEN( ... NAME=)}. This is
|
|
|
|
invalid standard Fortran syntax and is not supported by
|
|
|
|
@command{gfortran}. @code{OPEN( ... NAME=)} should be replaced
|
|
|
|
with @code{OPEN( ... FILE=)}.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@c ---------------------------------------------------------------------
|
2009-06-03 22:32:23 +02:00
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
@c Mixed-Language Programming
|
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
|
|
|
|
@node Mixed-Language Programming
|
|
|
|
@chapter Mixed-Language Programming
|
|
|
|
@cindex Interoperability
|
|
|
|
@cindex Mixed-language programming
|
|
|
|
|
|
|
|
@menu
|
|
|
|
* Interoperability with C::
|
re PR fortran/34112 (Add $!DEC ATTRIBUTE support for 32bit Windows' STDCALL)
2009-06-28 Tobias Burnus <burnus@net-b.de>
Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/34112
* symbol.c (gfc_add_ext_attribute): New function.
(gfc_get_sym_tree): New argument allow_subroutine.
(gfc_get_symbol,gfc_get_ha_sym_tree,gen_cptr_param,gen_fptr_param
gen_shape_param,generate_isocbinding_symbol): Use it.
* decl.c (find_special): New argument allow_subroutine.
(add_init_expr_to_sym,add_hidden_procptr_result,attr_decl1,
match_procedure_in_type,gfc_match_final_decl): Use it.
(gfc_match_gcc_attributes): New function.
* gfortran.texi (Mixed-Language Programming): New section
"GNU Fortran Compiler Directives".
* gfortran.h (ext_attr_t): New struct.
(symbol_attributes): Use it.
(gfc_add_ext_attribute): New prototype.
(gfc_get_sym_tree): Update pototype.
* expr.c (gfc_check_pointer_assign): Check whether call
convention is the same.
* module.c (import_iso_c_binding_module, create_int_parameter,
use_iso_fortran_env_module): Update gfc_get_sym_tree call.
* scanner.c (skip_gcc_attribute): New function.
(skip_free_comments,skip_fixed_comments): Use it.
(gfc_next_char_literal): Support !GCC$ lines.
* resolve.c (check_host_association): Update
gfc_get_sym_tree call.
* match.c (gfc_match_sym_tree,gfc_match_call): Update
gfc_get_sym_tree call.
* trans-decl.c (add_attributes_to_decl): New function.
(gfc_get_symbol_decl,get_proc_pointer_decl,
gfc_get_extern_function_decl,build_function_decl: Use it.
* match.h (gfc_match_gcc_attributes): Add prototype.
* parse.c (decode_gcc_attribute): New function.
(next_free,next_fixed): Support !GCC$ lines.
* primary.c (match_actual_arg,check_for_implicit_index,
gfc_match_rvalue,gfc_match_rvalue): Update
gfc_get_sym_tree call.
2009-06-28 Tobias Burnus <burnus@net-b.de>
PR fortran/34112
* gfortran.dg/compiler-directive_1.f90: New test.
* gfortran.dg/compiler-directive_2.f: New test.
Co-Authored-By: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
From-SVN: r149036
2009-06-28 19:56:41 +02:00
|
|
|
* GNU Fortran Compiler Directives::
|
2009-06-03 22:32:23 +02:00
|
|
|
* Non-Fortran Main Program::
|
2013-04-09 12:02:35 +02:00
|
|
|
* Naming and argument-passing conventions::
|
2009-06-03 22:32:23 +02:00
|
|
|
@end menu
|
|
|
|
|
|
|
|
This chapter is about mixed-language interoperability, but also applies
|
2010-09-24 08:39:20 +02:00
|
|
|
if one links Fortran code compiled by different compilers. In most cases,
|
2009-06-03 22:32:23 +02:00
|
|
|
use of the C Binding features of the Fortran 2003 standard is sufficient,
|
|
|
|
and their use is highly recommended.
|
|
|
|
|
|
|
|
|
|
|
|
@node Interoperability with C
|
|
|
|
@section Interoperability with C
|
|
|
|
|
|
|
|
@menu
|
|
|
|
* Intrinsic Types::
|
|
|
|
* Derived Types and struct::
|
|
|
|
* Interoperable Global Variables::
|
|
|
|
* Interoperable Subroutines and Functions::
|
2010-08-10 17:40:59 +02:00
|
|
|
* Working with Pointers::
|
|
|
|
* Further Interoperability of Fortran with C::
|
2009-06-03 22:32:23 +02:00
|
|
|
@end menu
|
|
|
|
|
|
|
|
Since Fortran 2003 (ISO/IEC 1539-1:2004(E)) there is a
|
|
|
|
standardized way to generate procedure and derived-type
|
|
|
|
declarations and global variables which are interoperable with C
|
2010-09-24 08:39:20 +02:00
|
|
|
(ISO/IEC 9899:1999). The @code{bind(C)} attribute has been added
|
2009-06-03 22:32:23 +02:00
|
|
|
to inform the compiler that a symbol shall be interoperable with C;
|
2010-09-24 08:39:20 +02:00
|
|
|
also, some constraints are added. Note, however, that not
|
|
|
|
all C features have a Fortran equivalent or vice versa. For instance,
|
2009-06-03 22:32:23 +02:00
|
|
|
neither C's unsigned integers nor C's functions with variable number
|
|
|
|
of arguments have an equivalent in Fortran.
|
|
|
|
|
2009-12-16 01:54:44 +01:00
|
|
|
Note that array dimensions are reversely ordered in C and that arrays in
|
2009-12-08 09:52:28 +01:00
|
|
|
C always start with index 0 while in Fortran they start by default with
|
2010-09-24 08:39:20 +02:00
|
|
|
1. Thus, an array declaration @code{A(n,m)} in Fortran matches
|
2009-12-08 09:52:28 +01:00
|
|
|
@code{A[m][n]} in C and accessing the element @code{A(i,j)} matches
|
2010-09-24 08:39:20 +02:00
|
|
|
@code{A[j-1][i-1]}. The element following @code{A(i,j)} (C: @code{A[j-1][i-1]};
|
2009-12-08 09:52:28 +01:00
|
|
|
assuming @math{i < n}) in memory is @code{A(i+1,j)} (C: @code{A[j-1][i]}).
|
2009-06-03 22:32:23 +02:00
|
|
|
|
|
|
|
@node Intrinsic Types
|
|
|
|
@subsection Intrinsic Types
|
|
|
|
|
|
|
|
In order to ensure that exactly the same variable type and kind is used
|
|
|
|
in C and Fortran, the named constants shall be used which are defined in the
|
2010-09-24 08:39:20 +02:00
|
|
|
@code{ISO_C_BINDING} intrinsic module. That module contains named constants
|
2009-06-03 22:32:23 +02:00
|
|
|
for kind parameters and character named constants for the escape sequences
|
2010-09-24 08:39:20 +02:00
|
|
|
in C. For a list of the constants, see @ref{ISO_C_BINDING}.
|
2009-06-03 22:32:23 +02:00
|
|
|
|
2013-04-09 12:02:35 +02:00
|
|
|
For logical types, please note that the Fortran standard only guarantees
|
|
|
|
interoperability between C99's @code{_Bool} and Fortran's @code{C_Bool}-kind
|
|
|
|
logicals and C99 defines that @code{true} has the value 1 and @code{false}
|
|
|
|
the value 0. Using any other integer value with GNU Fortran's @code{LOGICAL}
|
|
|
|
(with any kind parameter) gives an undefined result. (Passing other integer
|
|
|
|
values than 0 and 1 to GCC's @code{_Bool} is also undefined, unless the
|
|
|
|
integer is explicitly or implicitly casted to @code{_Bool}.)
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-06-03 22:32:23 +02:00
|
|
|
@node Derived Types and struct
|
|
|
|
@subsection Derived Types and struct
|
|
|
|
|
|
|
|
For compatibility of derived types with @code{struct}, one needs to use
|
2010-09-24 08:39:20 +02:00
|
|
|
the @code{BIND(C)} attribute in the type declaration. For instance, the
|
2009-06-03 22:32:23 +02:00
|
|
|
following type declaration
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
USE ISO_C_BINDING
|
|
|
|
TYPE, BIND(C) :: myType
|
|
|
|
INTEGER(C_INT) :: i1, i2
|
|
|
|
INTEGER(C_SIGNED_CHAR) :: i3
|
|
|
|
REAL(C_DOUBLE) :: d1
|
|
|
|
COMPLEX(C_FLOAT_COMPLEX) :: c1
|
|
|
|
CHARACTER(KIND=C_CHAR) :: str(5)
|
|
|
|
END TYPE
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
matches the following @code{struct} declaration in C
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
struct @{
|
|
|
|
int i1, i2;
|
|
|
|
/* Note: "char" might be signed or unsigned. */
|
|
|
|
signed char i3;
|
|
|
|
double d1;
|
|
|
|
float _Complex c1;
|
|
|
|
char str[5];
|
|
|
|
@} myType;
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
Derived types with the C binding attribute shall not have the @code{sequence}
|
|
|
|
attribute, type parameters, the @code{extends} attribute, nor type-bound
|
2010-09-24 08:39:20 +02:00
|
|
|
procedures. Every component must be of interoperable type and kind and may not
|
|
|
|
have the @code{pointer} or @code{allocatable} attribute. The names of the
|
2013-02-07 12:08:20 +01:00
|
|
|
components are irrelevant for interoperability.
|
2009-06-03 22:32:23 +02:00
|
|
|
|
|
|
|
As there exist no direct Fortran equivalents, neither unions nor structs
|
|
|
|
with bit field or variable-length array members are interoperable.
|
|
|
|
|
|
|
|
@node Interoperable Global Variables
|
|
|
|
@subsection Interoperable Global Variables
|
|
|
|
|
|
|
|
Variables can be made accessible from C using the C binding attribute,
|
2010-09-24 08:39:20 +02:00
|
|
|
optionally together with specifying a binding name. Those variables
|
2009-06-03 22:32:23 +02:00
|
|
|
have to be declared in the declaration part of a @code{MODULE},
|
|
|
|
be of interoperable type, and have neither the @code{pointer} nor
|
|
|
|
the @code{allocatable} attribute.
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
MODULE m
|
|
|
|
USE myType_module
|
|
|
|
USE ISO_C_BINDING
|
|
|
|
integer(C_INT), bind(C, name="_MyProject_flags") :: global_flag
|
|
|
|
type(myType), bind(C) :: tp
|
|
|
|
END MODULE
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
Here, @code{_MyProject_flags} is the case-sensitive name of the variable
|
|
|
|
as seen from C programs while @code{global_flag} is the case-insensitive
|
2010-09-24 08:39:20 +02:00
|
|
|
name as seen from Fortran. If no binding name is specified, as for
|
2009-06-03 22:32:23 +02:00
|
|
|
@var{tp}, the C binding name is the (lowercase) Fortran binding name.
|
|
|
|
If a binding name is specified, only a single variable may be after the
|
2010-09-24 08:39:20 +02:00
|
|
|
double colon. Note of warning: You cannot use a global variable to
|
2009-06-03 22:32:23 +02:00
|
|
|
access @var{errno} of the C library as the C standard allows it to be
|
2010-09-24 08:39:20 +02:00
|
|
|
a macro. Use the @code{IERRNO} intrinsic (GNU extension) instead.
|
2009-06-03 22:32:23 +02:00
|
|
|
|
|
|
|
@node Interoperable Subroutines and Functions
|
|
|
|
@subsection Interoperable Subroutines and Functions
|
|
|
|
|
|
|
|
Subroutines and functions have to have the @code{BIND(C)} attribute to
|
2010-09-24 08:39:20 +02:00
|
|
|
be compatible with C. The dummy argument declaration is relatively
|
|
|
|
straightforward. However, one needs to be careful because C uses
|
2009-06-29 23:02:17 +02:00
|
|
|
call-by-value by default while Fortran behaves usually similar to
|
2010-09-24 08:39:20 +02:00
|
|
|
call-by-reference. Furthermore, strings and pointers are handled
|
2013-02-07 12:08:20 +01:00
|
|
|
differently. Note that in Fortran 2003 and 2008 only explicit size
|
|
|
|
and assumed-size arrays are supported but not assumed-shape or
|
|
|
|
deferred-shape (i.e. allocatable or pointer) arrays. However, those
|
|
|
|
are allowed since the Technical Specification 29113, see
|
|
|
|
@ref{Further Interoperability of Fortran with C}
|
2009-06-03 22:32:23 +02:00
|
|
|
|
|
|
|
To pass a variable by value, use the @code{VALUE} attribute.
|
2013-02-07 12:08:20 +01:00
|
|
|
Thus, the following C prototype
|
2009-06-03 22:32:23 +02:00
|
|
|
|
|
|
|
@smallexample
|
|
|
|
@code{int func(int i, int *j)}
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
matches the Fortran declaration
|
|
|
|
|
|
|
|
@smallexample
|
2009-11-19 09:57:02 +01:00
|
|
|
integer(c_int) function func(i,j)
|
|
|
|
use iso_c_binding, only: c_int
|
|
|
|
integer(c_int), VALUE :: i
|
|
|
|
integer(c_int) :: j
|
2009-06-03 22:32:23 +02:00
|
|
|
@end smallexample
|
|
|
|
|
2010-08-10 17:40:59 +02:00
|
|
|
Note that pointer arguments also frequently need the @code{VALUE} attribute,
|
|
|
|
see @ref{Working with Pointers}.
|
2009-06-03 22:32:23 +02:00
|
|
|
|
2010-09-24 08:39:20 +02:00
|
|
|
Strings are handled quite differently in C and Fortran. In C a string
|
2009-06-03 22:32:23 +02:00
|
|
|
is a @code{NUL}-terminated array of characters while in Fortran each string
|
|
|
|
has a length associated with it and is thus not terminated (by e.g.
|
2010-09-24 08:39:20 +02:00
|
|
|
@code{NUL}). For example, if one wants to use the following C function,
|
2009-06-03 22:32:23 +02:00
|
|
|
|
|
|
|
@smallexample
|
|
|
|
#include <stdio.h>
|
|
|
|
void print_C(char *string) /* equivalent: char string[] */
|
|
|
|
@{
|
|
|
|
printf("%s\n", string);
|
|
|
|
@}
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
to print ``Hello World'' from Fortran, one can call it using
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
use iso_c_binding, only: C_CHAR, C_NULL_CHAR
|
|
|
|
interface
|
|
|
|
subroutine print_c(string) bind(C, name="print_C")
|
|
|
|
use iso_c_binding, only: c_char
|
|
|
|
character(kind=c_char) :: string(*)
|
|
|
|
end subroutine print_c
|
|
|
|
end interface
|
|
|
|
call print_c(C_CHAR_"Hello World"//C_NULL_CHAR)
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
As the example shows, one needs to ensure that the
|
2010-09-24 08:39:20 +02:00
|
|
|
string is @code{NUL} terminated. Additionally, the dummy argument
|
2009-06-03 22:32:23 +02:00
|
|
|
@var{string} of @code{print_C} is a length-one assumed-size
|
2010-09-24 08:39:20 +02:00
|
|
|
array; using @code{character(len=*)} is not allowed. The example
|
2009-06-03 22:32:23 +02:00
|
|
|
above uses @code{c_char_"Hello World"} to ensure the string
|
|
|
|
literal has the right type; typically the default character
|
|
|
|
kind and @code{c_char} are the same and thus @code{"Hello World"}
|
2010-09-24 08:39:20 +02:00
|
|
|
is equivalent. However, the standard does not guarantee this.
|
2009-06-03 22:32:23 +02:00
|
|
|
|
2010-08-10 17:40:59 +02:00
|
|
|
The use of strings is now further illustrated using the C library
|
2009-06-03 22:32:23 +02:00
|
|
|
function @code{strncpy}, whose prototype is
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
char *strncpy(char *restrict s1, const char *restrict s2, size_t n);
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
The function @code{strncpy} copies at most @var{n} characters from
|
2010-09-24 08:39:20 +02:00
|
|
|
string @var{s2} to @var{s1} and returns @var{s1}. In the following
|
2009-06-03 22:32:23 +02:00
|
|
|
example, we ignore the return value:
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
use iso_c_binding
|
|
|
|
implicit none
|
|
|
|
character(len=30) :: str,str2
|
|
|
|
interface
|
|
|
|
! Ignore the return value of strncpy -> subroutine
|
|
|
|
! "restrict" is always assumed if we do not pass a pointer
|
|
|
|
subroutine strncpy(dest, src, n) bind(C)
|
|
|
|
import
|
|
|
|
character(kind=c_char), intent(out) :: dest(*)
|
|
|
|
character(kind=c_char), intent(in) :: src(*)
|
|
|
|
integer(c_size_t), value, intent(in) :: n
|
|
|
|
end subroutine strncpy
|
|
|
|
end interface
|
|
|
|
str = repeat('X',30) ! Initialize whole string with 'X'
|
|
|
|
call strncpy(str, c_char_"Hello World"//C_NULL_CHAR, &
|
|
|
|
len(c_char_"Hello World",kind=c_size_t))
|
|
|
|
print '(a)', str ! prints: "Hello WorldXXXXXXXXXXXXXXXXXXX"
|
|
|
|
end
|
|
|
|
@end smallexample
|
|
|
|
|
2010-08-10 17:40:59 +02:00
|
|
|
The intrinsic procedures are described in @ref{Intrinsic Procedures}.
|
|
|
|
|
|
|
|
@node Working with Pointers
|
|
|
|
@subsection Working with Pointers
|
|
|
|
|
|
|
|
C pointers are represented in Fortran via the special opaque derived type
|
2010-09-24 08:39:20 +02:00
|
|
|
@code{type(c_ptr)} (with private components). Thus one needs to
|
2009-06-03 22:32:23 +02:00
|
|
|
use intrinsic conversion procedures to convert from or to C pointers.
|
2013-02-07 12:08:20 +01:00
|
|
|
|
|
|
|
For some applications, using an assumed type (@code{TYPE(*)}) can be an
|
|
|
|
alternative to a C pointer; see
|
|
|
|
@ref{Further Interoperability of Fortran with C}.
|
|
|
|
|
2009-06-03 22:32:23 +02:00
|
|
|
For example,
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
use iso_c_binding
|
|
|
|
type(c_ptr) :: cptr1, cptr2
|
|
|
|
integer, target :: array(7), scalar
|
|
|
|
integer, pointer :: pa(:), ps
|
|
|
|
cptr1 = c_loc(array(1)) ! The programmer needs to ensure that the
|
|
|
|
! array is contiguous if required by the C
|
|
|
|
! procedure
|
|
|
|
cptr2 = c_loc(scalar)
|
|
|
|
call c_f_pointer(cptr2, ps)
|
|
|
|
call c_f_pointer(cptr2, pa, shape=[7])
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
When converting C to Fortran arrays, the one-dimensional @code{SHAPE} argument
|
2010-08-10 17:40:59 +02:00
|
|
|
has to be passed.
|
|
|
|
|
|
|
|
If a pointer is a dummy-argument of an interoperable procedure, it usually
|
|
|
|
has to be declared using the @code{VALUE} attribute. @code{void*}
|
|
|
|
matches @code{TYPE(C_PTR), VALUE}, while @code{TYPE(C_PTR)} alone
|
|
|
|
matches @code{void**}.
|
2009-06-03 22:32:23 +02:00
|
|
|
|
|
|
|
Procedure pointers are handled analogously to pointers; the C type is
|
|
|
|
@code{TYPE(C_FUNPTR)} and the intrinsic conversion procedures are
|
2010-08-10 17:40:59 +02:00
|
|
|
@code{C_F_PROCPOINTER} and @code{C_FUNLOC}.
|
2009-06-03 22:32:23 +02:00
|
|
|
|
2011-11-07 23:21:54 +01:00
|
|
|
Let us consider two examples of actually passing a procedure pointer from
|
2010-08-10 17:40:59 +02:00
|
|
|
C to Fortran and vice versa. Note that these examples are also very
|
2011-11-07 23:21:54 +01:00
|
|
|
similar to passing ordinary pointers between both languages. First,
|
|
|
|
consider this code in C:
|
2010-08-10 17:40:59 +02:00
|
|
|
|
|
|
|
@smallexample
|
|
|
|
/* Procedure implemented in Fortran. */
|
|
|
|
void get_values (void (*)(double));
|
|
|
|
|
|
|
|
/* Call-back routine we want called from Fortran. */
|
|
|
|
void
|
|
|
|
print_it (double x)
|
|
|
|
@{
|
|
|
|
printf ("Number is %f.\n", x);
|
|
|
|
@}
|
|
|
|
|
|
|
|
/* Call Fortran routine and pass call-back to it. */
|
|
|
|
void
|
|
|
|
foobar ()
|
|
|
|
@{
|
|
|
|
get_values (&print_it);
|
|
|
|
@}
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
A matching implementation for @code{get_values} in Fortran, that correctly
|
|
|
|
receives the procedure pointer from C and is able to call it, is given
|
|
|
|
in the following @code{MODULE}:
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
MODULE m
|
|
|
|
IMPLICIT NONE
|
|
|
|
|
|
|
|
! Define interface of call-back routine.
|
|
|
|
ABSTRACT INTERFACE
|
|
|
|
SUBROUTINE callback (x)
|
|
|
|
USE, INTRINSIC :: ISO_C_BINDING
|
|
|
|
REAL(KIND=C_DOUBLE), INTENT(IN), VALUE :: x
|
|
|
|
END SUBROUTINE callback
|
|
|
|
END INTERFACE
|
|
|
|
|
|
|
|
CONTAINS
|
|
|
|
|
|
|
|
! Define C-bound procedure.
|
|
|
|
SUBROUTINE get_values (cproc) BIND(C)
|
|
|
|
USE, INTRINSIC :: ISO_C_BINDING
|
|
|
|
TYPE(C_FUNPTR), INTENT(IN), VALUE :: cproc
|
|
|
|
|
|
|
|
PROCEDURE(callback), POINTER :: proc
|
|
|
|
|
|
|
|
! Convert C to Fortran procedure pointer.
|
|
|
|
CALL C_F_PROCPOINTER (cproc, proc)
|
|
|
|
|
|
|
|
! Call it.
|
|
|
|
CALL proc (1.0_C_DOUBLE)
|
|
|
|
CALL proc (-42.0_C_DOUBLE)
|
|
|
|
CALL proc (18.12_C_DOUBLE)
|
|
|
|
END SUBROUTINE get_values
|
|
|
|
|
|
|
|
END MODULE m
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
Next, we want to call a C routine that expects a procedure pointer argument
|
|
|
|
and pass it a Fortran procedure (which clearly must be interoperable!).
|
|
|
|
Again, the C function may be:
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
int
|
|
|
|
call_it (int (*func)(int), int arg)
|
|
|
|
@{
|
|
|
|
return func (arg);
|
|
|
|
@}
|
|
|
|
@end smallexample
|
|
|
|
|
|
|
|
It can be used as in the following Fortran code:
|
|
|
|
|
|
|
|
@smallexample
|
|
|
|
MODULE m
|
|
|
|
USE, INTRINSIC :: ISO_C_BINDING
|
|
|
|
IMPLICIT NONE
|
|
|
|
|
|
|
|
! Define interface of C function.
|
|
|
|
INTERFACE
|
|
|
|
INTEGER(KIND=C_INT) FUNCTION call_it (func, arg) BIND(C)
|
|
|
|
USE, INTRINSIC :: ISO_C_BINDING
|
|
|
|
TYPE(C_FUNPTR), INTENT(IN), VALUE :: func
|
|
|
|
INTEGER(KIND=C_INT), INTENT(IN), VALUE :: arg
|
|
|
|
END FUNCTION call_it
|
|
|
|
END INTERFACE
|
|
|
|
|
|
|
|
CONTAINS
|
|
|
|
|
|
|
|
! Define procedure passed to C function.
|
|
|
|
! It must be interoperable!
|
|
|
|
INTEGER(KIND=C_INT) FUNCTION double_it (arg) BIND(C)
|
|
|
|
INTEGER(KIND=C_INT), INTENT(IN), VALUE :: arg
|
|
|
|
double_it = arg + arg
|
|
|
|
END FUNCTION double_it
|
|
|
|
|
|
|
|
! Call C function.
|
|
|
|
SUBROUTINE foobar ()
|
|
|
|
TYPE(C_FUNPTR) :: cproc
|
|
|
|
INTEGER(KIND=C_INT) :: i
|
|
|
|
|
|
|
|
! Get C procedure pointer.
|
|
|
|
cproc = C_FUNLOC (double_it)
|
|
|
|
|
|
|
|
! Use it.
|
|
|
|
DO i = 1_C_INT, 10_C_INT
|
|
|
|
PRINT *, call_it (cproc, i)
|
|
|
|
END DO
|
|
|
|
END SUBROUTINE foobar
|
|
|
|
|
|
|
|
END MODULE m
|
|
|
|
@end smallexample
|
2009-06-03 22:32:23 +02:00
|
|
|
|
|
|
|
@node Further Interoperability of Fortran with C
|
|
|
|
@subsection Further Interoperability of Fortran with C
|
|
|
|
|
2013-02-07 12:08:20 +01:00
|
|
|
The Technical Specification ISO/IEC TS 29113:2012 on further
|
|
|
|
interoperability of Fortran with C extends the interoperability support
|
|
|
|
of Fortran 2003 and Fortran 2008. Besides removing some restrictions
|
|
|
|
and constraints, it adds assumed-type (@code{TYPE(*)}) and assumed-rank
|
|
|
|
(@code{dimension}) variables and allows for interoperability of
|
|
|
|
assumed-shape, assumed-rank and deferred-shape arrays, including
|
|
|
|
allocatables and pointers.
|
|
|
|
|
|
|
|
Note: Currently, GNU Fortran does not support the array descriptor
|
|
|
|
(dope vector) as specified in the Technical Specification, but uses
|
|
|
|
an array descriptor with different fields. The Chasm Language
|
2009-06-03 22:32:23 +02:00
|
|
|
Interoperability Tools, @url{http://chasm-interop.sourceforge.net/},
|
2013-02-07 12:08:20 +01:00
|
|
|
provide an interface to GNU Fortran's array descriptor.
|
|
|
|
|
|
|
|
The Technical Specification adds the following new features, which
|
|
|
|
are supported by GNU Fortran:
|
2009-06-03 22:32:23 +02:00
|
|
|
|
2013-02-07 12:08:20 +01:00
|
|
|
@itemize @bullet
|
2009-06-03 22:32:23 +02:00
|
|
|
|
2013-02-07 12:08:20 +01:00
|
|
|
@item The @code{ASYNCHRONOUS} attribute has been clarified and
|
|
|
|
extended to allow its use with asynchronous communication in
|
|
|
|
user-provided libraries such as in implementations of the
|
|
|
|
Message Passing Interface specification.
|
|
|
|
|
|
|
|
@item Many constraints have been relaxed, in particular for
|
|
|
|
the @code{C_LOC} and @code{C_F_POINTER} intrinsics.
|
|
|
|
|
|
|
|
@item The @code{OPTIONAL} attribute is now allowed for dummy
|
|
|
|
arguments; an absent argument matches a @code{NULL} pointer.
|
|
|
|
|
|
|
|
@item Assumed types (@code{TYPE(*)}) have been added, which may
|
|
|
|
only be used for dummy arguments. They are unlimited polymorphic
|
|
|
|
but contrary to @code{CLASS(*)} they do not contain any type
|
|
|
|
information, similar to C's @code{void *} pointers. Expressions
|
|
|
|
of any type and kind can be passed; thus, it can be used as
|
|
|
|
replacement for @code{TYPE(C_PTR)}, avoiding the use of
|
|
|
|
@code{C_LOC} in the caller.
|
|
|
|
|
|
|
|
Note, however, that @code{TYPE(*)} only accepts scalar arguments,
|
|
|
|
unless the @code{DIMENSION} is explicitly specified. As
|
|
|
|
@code{DIMENSION(*)} only supports array (including array elements) but
|
|
|
|
no scalars, it is not a full replacement for @code{C_LOC}. On the
|
|
|
|
other hand, assumed-type assumed-rank dummy arguments
|
|
|
|
(@code{TYPE(*), DIMENSION(..)}) allow for both scalars and arrays, but
|
|
|
|
require special code on the callee side to handle the array descriptor.
|
|
|
|
|
2013-11-06 08:04:12 +01:00
|
|
|
@item Assumed-rank arrays (@code{DIMENSION(..)}) as dummy argument
|
2013-02-07 12:08:20 +01:00
|
|
|
allow that scalars and arrays of any rank can be passed as actual
|
|
|
|
argument. As the Technical Specification does not provide for direct
|
|
|
|
means to operate with them, they have to be used either from the C side
|
|
|
|
or be converted using @code{C_LOC} and @code{C_F_POINTER} to scalars
|
|
|
|
or arrays of a specific rank. The rank can be determined using the
|
|
|
|
@code{RANK} intrinisic.
|
|
|
|
@end itemize
|
|
|
|
|
|
|
|
|
|
|
|
Currently unimplemented:
|
|
|
|
|
|
|
|
@itemize @bullet
|
|
|
|
|
|
|
|
@item GNU Fortran always uses an array descriptor, which does not
|
|
|
|
match the one of the Technical Specification. The
|
|
|
|
@code{ISO_Fortran_binding.h} header file and the C functions it
|
|
|
|
specifies are not available.
|
|
|
|
|
|
|
|
@item Using assumed-shape, assumed-rank and deferred-shape arrays in
|
|
|
|
@code{BIND(C)} procedures is not fully supported. In particular,
|
|
|
|
C interoperable strings of other length than one are not supported
|
|
|
|
as this requires the new array descriptor.
|
|
|
|
@end itemize
|
re PR fortran/34112 (Add $!DEC ATTRIBUTE support for 32bit Windows' STDCALL)
2009-06-28 Tobias Burnus <burnus@net-b.de>
Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/34112
* symbol.c (gfc_add_ext_attribute): New function.
(gfc_get_sym_tree): New argument allow_subroutine.
(gfc_get_symbol,gfc_get_ha_sym_tree,gen_cptr_param,gen_fptr_param
gen_shape_param,generate_isocbinding_symbol): Use it.
* decl.c (find_special): New argument allow_subroutine.
(add_init_expr_to_sym,add_hidden_procptr_result,attr_decl1,
match_procedure_in_type,gfc_match_final_decl): Use it.
(gfc_match_gcc_attributes): New function.
* gfortran.texi (Mixed-Language Programming): New section
"GNU Fortran Compiler Directives".
* gfortran.h (ext_attr_t): New struct.
(symbol_attributes): Use it.
(gfc_add_ext_attribute): New prototype.
(gfc_get_sym_tree): Update pototype.
* expr.c (gfc_check_pointer_assign): Check whether call
convention is the same.
* module.c (import_iso_c_binding_module, create_int_parameter,
use_iso_fortran_env_module): Update gfc_get_sym_tree call.
* scanner.c (skip_gcc_attribute): New function.
(skip_free_comments,skip_fixed_comments): Use it.
(gfc_next_char_literal): Support !GCC$ lines.
* resolve.c (check_host_association): Update
gfc_get_sym_tree call.
* match.c (gfc_match_sym_tree,gfc_match_call): Update
gfc_get_sym_tree call.
* trans-decl.c (add_attributes_to_decl): New function.
(gfc_get_symbol_decl,get_proc_pointer_decl,
gfc_get_extern_function_decl,build_function_decl: Use it.
* match.h (gfc_match_gcc_attributes): Add prototype.
* parse.c (decode_gcc_attribute): New function.
(next_free,next_fixed): Support !GCC$ lines.
* primary.c (match_actual_arg,check_for_implicit_index,
gfc_match_rvalue,gfc_match_rvalue): Update
gfc_get_sym_tree call.
2009-06-28 Tobias Burnus <burnus@net-b.de>
PR fortran/34112
* gfortran.dg/compiler-directive_1.f90: New test.
* gfortran.dg/compiler-directive_2.f: New test.
Co-Authored-By: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
From-SVN: r149036
2009-06-28 19:56:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
@node GNU Fortran Compiler Directives
|
|
|
|
@section GNU Fortran Compiler Directives
|
|
|
|
|
2011-07-21 23:09:46 +02:00
|
|
|
The Fortran standard describes how a conforming program shall
|
2010-09-24 08:39:20 +02:00
|
|
|
behave; however, the exact implementation is not standardized. In order
|
re PR fortran/34112 (Add $!DEC ATTRIBUTE support for 32bit Windows' STDCALL)
2009-06-28 Tobias Burnus <burnus@net-b.de>
Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/34112
* symbol.c (gfc_add_ext_attribute): New function.
(gfc_get_sym_tree): New argument allow_subroutine.
(gfc_get_symbol,gfc_get_ha_sym_tree,gen_cptr_param,gen_fptr_param
gen_shape_param,generate_isocbinding_symbol): Use it.
* decl.c (find_special): New argument allow_subroutine.
(add_init_expr_to_sym,add_hidden_procptr_result,attr_decl1,
match_procedure_in_type,gfc_match_final_decl): Use it.
(gfc_match_gcc_attributes): New function.
* gfortran.texi (Mixed-Language Programming): New section
"GNU Fortran Compiler Directives".
* gfortran.h (ext_attr_t): New struct.
(symbol_attributes): Use it.
(gfc_add_ext_attribute): New prototype.
(gfc_get_sym_tree): Update pototype.
* expr.c (gfc_check_pointer_assign): Check whether call
convention is the same.
* module.c (import_iso_c_binding_module, create_int_parameter,
use_iso_fortran_env_module): Update gfc_get_sym_tree call.
* scanner.c (skip_gcc_attribute): New function.
(skip_free_comments,skip_fixed_comments): Use it.
(gfc_next_char_literal): Support !GCC$ lines.
* resolve.c (check_host_association): Update
gfc_get_sym_tree call.
* match.c (gfc_match_sym_tree,gfc_match_call): Update
gfc_get_sym_tree call.
* trans-decl.c (add_attributes_to_decl): New function.
(gfc_get_symbol_decl,get_proc_pointer_decl,
gfc_get_extern_function_decl,build_function_decl: Use it.
* match.h (gfc_match_gcc_attributes): Add prototype.
* parse.c (decode_gcc_attribute): New function.
(next_free,next_fixed): Support !GCC$ lines.
* primary.c (match_actual_arg,check_for_implicit_index,
gfc_match_rvalue,gfc_match_rvalue): Update
gfc_get_sym_tree call.
2009-06-28 Tobias Burnus <burnus@net-b.de>
PR fortran/34112
* gfortran.dg/compiler-directive_1.f90: New test.
* gfortran.dg/compiler-directive_2.f: New test.
Co-Authored-By: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
From-SVN: r149036
2009-06-28 19:56:41 +02:00
|
|
|
to allow the user to choose specific implementation details, compiler
|
|
|
|
directives can be used to set attributes of variables and procedures
|
2010-09-24 08:39:20 +02:00
|
|
|
which are not part of the standard. Whether a given attribute is
|
re PR fortran/34112 (Add $!DEC ATTRIBUTE support for 32bit Windows' STDCALL)
2009-06-28 Tobias Burnus <burnus@net-b.de>
Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/34112
* symbol.c (gfc_add_ext_attribute): New function.
(gfc_get_sym_tree): New argument allow_subroutine.
(gfc_get_symbol,gfc_get_ha_sym_tree,gen_cptr_param,gen_fptr_param
gen_shape_param,generate_isocbinding_symbol): Use it.
* decl.c (find_special): New argument allow_subroutine.
(add_init_expr_to_sym,add_hidden_procptr_result,attr_decl1,
match_procedure_in_type,gfc_match_final_decl): Use it.
(gfc_match_gcc_attributes): New function.
* gfortran.texi (Mixed-Language Programming): New section
"GNU Fortran Compiler Directives".
* gfortran.h (ext_attr_t): New struct.
(symbol_attributes): Use it.
(gfc_add_ext_attribute): New prototype.
(gfc_get_sym_tree): Update pototype.
* expr.c (gfc_check_pointer_assign): Check whether call
convention is the same.
* module.c (import_iso_c_binding_module, create_int_parameter,
use_iso_fortran_env_module): Update gfc_get_sym_tree call.
* scanner.c (skip_gcc_attribute): New function.
(skip_free_comments,skip_fixed_comments): Use it.
(gfc_next_char_literal): Support !GCC$ lines.
* resolve.c (check_host_association): Update
gfc_get_sym_tree call.
* match.c (gfc_match_sym_tree,gfc_match_call): Update
gfc_get_sym_tree call.
* trans-decl.c (add_attributes_to_decl): New function.
(gfc_get_symbol_decl,get_proc_pointer_decl,
gfc_get_extern_function_decl,build_function_decl: Use it.
* match.h (gfc_match_gcc_attributes): Add prototype.
* parse.c (decode_gcc_attribute): New function.
(next_free,next_fixed): Support !GCC$ lines.
* primary.c (match_actual_arg,check_for_implicit_index,
gfc_match_rvalue,gfc_match_rvalue): Update
gfc_get_sym_tree call.
2009-06-28 Tobias Burnus <burnus@net-b.de>
PR fortran/34112
* gfortran.dg/compiler-directive_1.f90: New test.
* gfortran.dg/compiler-directive_2.f: New test.
Co-Authored-By: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
From-SVN: r149036
2009-06-28 19:56:41 +02:00
|
|
|
supported and its exact effects depend on both the operating system and
|
|
|
|
on the processor; see
|
|
|
|
@ref{Top,,C Extensions,gcc,Using the GNU Compiler Collection (GCC)}
|
|
|
|
for details.
|
|
|
|
|
|
|
|
For procedures and procedure pointers, the following attributes can
|
|
|
|
be used to change the calling convention:
|
|
|
|
|
|
|
|
@itemize
|
|
|
|
@item @code{CDECL} -- standard C calling convention
|
|
|
|
@item @code{STDCALL} -- convention where the called procedure pops the stack
|
|
|
|
@item @code{FASTCALL} -- part of the arguments are passed via registers
|
|
|
|
instead using the stack
|
|
|
|
@end itemize
|
|
|
|
|
|
|
|
Besides changing the calling convention, the attributes also influence
|
|
|
|
the decoration of the symbol name, e.g., by a leading underscore or by
|
2010-09-24 08:39:20 +02:00
|
|
|
a trailing at-sign followed by the number of bytes on the stack. When
|
re PR fortran/34112 (Add $!DEC ATTRIBUTE support for 32bit Windows' STDCALL)
2009-06-28 Tobias Burnus <burnus@net-b.de>
Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/34112
* symbol.c (gfc_add_ext_attribute): New function.
(gfc_get_sym_tree): New argument allow_subroutine.
(gfc_get_symbol,gfc_get_ha_sym_tree,gen_cptr_param,gen_fptr_param
gen_shape_param,generate_isocbinding_symbol): Use it.
* decl.c (find_special): New argument allow_subroutine.
(add_init_expr_to_sym,add_hidden_procptr_result,attr_decl1,
match_procedure_in_type,gfc_match_final_decl): Use it.
(gfc_match_gcc_attributes): New function.
* gfortran.texi (Mixed-Language Programming): New section
"GNU Fortran Compiler Directives".
* gfortran.h (ext_attr_t): New struct.
(symbol_attributes): Use it.
(gfc_add_ext_attribute): New prototype.
(gfc_get_sym_tree): Update pototype.
* expr.c (gfc_check_pointer_assign): Check whether call
convention is the same.
* module.c (import_iso_c_binding_module, create_int_parameter,
use_iso_fortran_env_module): Update gfc_get_sym_tree call.
* scanner.c (skip_gcc_attribute): New function.
(skip_free_comments,skip_fixed_comments): Use it.
(gfc_next_char_literal): Support !GCC$ lines.
* resolve.c (check_host_association): Update
gfc_get_sym_tree call.
* match.c (gfc_match_sym_tree,gfc_match_call): Update
gfc_get_sym_tree call.
* trans-decl.c (add_attributes_to_decl): New function.
(gfc_get_symbol_decl,get_proc_pointer_decl,
gfc_get_extern_function_decl,build_function_decl: Use it.
* match.h (gfc_match_gcc_attributes): Add prototype.
* parse.c (decode_gcc_attribute): New function.
(next_free,next_fixed): Support !GCC$ lines.
* primary.c (match_actual_arg,check_for_implicit_index,
gfc_match_rvalue,gfc_match_rvalue): Update
gfc_get_sym_tree call.
2009-06-28 Tobias Burnus <burnus@net-b.de>
PR fortran/34112
* gfortran.dg/compiler-directive_1.f90: New test.
* gfortran.dg/compiler-directive_2.f: New test.
Co-Authored-By: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
From-SVN: r149036
2009-06-28 19:56:41 +02:00
|
|
|
assigning a procedure to a procedure pointer, both should use the same
|
|
|
|
calling convention.
|
|
|
|
|
|
|
|
On some systems, procedures and global variables (module variables and
|
|
|
|
@code{COMMON} blocks) need special handling to be accessible when they
|
2010-09-24 08:39:20 +02:00
|
|
|
are in a shared library. The following attributes are available:
|
re PR fortran/34112 (Add $!DEC ATTRIBUTE support for 32bit Windows' STDCALL)
2009-06-28 Tobias Burnus <burnus@net-b.de>
Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/34112
* symbol.c (gfc_add_ext_attribute): New function.
(gfc_get_sym_tree): New argument allow_subroutine.
(gfc_get_symbol,gfc_get_ha_sym_tree,gen_cptr_param,gen_fptr_param
gen_shape_param,generate_isocbinding_symbol): Use it.
* decl.c (find_special): New argument allow_subroutine.
(add_init_expr_to_sym,add_hidden_procptr_result,attr_decl1,
match_procedure_in_type,gfc_match_final_decl): Use it.
(gfc_match_gcc_attributes): New function.
* gfortran.texi (Mixed-Language Programming): New section
"GNU Fortran Compiler Directives".
* gfortran.h (ext_attr_t): New struct.
(symbol_attributes): Use it.
(gfc_add_ext_attribute): New prototype.
(gfc_get_sym_tree): Update pototype.
* expr.c (gfc_check_pointer_assign): Check whether call
convention is the same.
* module.c (import_iso_c_binding_module, create_int_parameter,
use_iso_fortran_env_module): Update gfc_get_sym_tree call.
* scanner.c (skip_gcc_attribute): New function.
(skip_free_comments,skip_fixed_comments): Use it.
(gfc_next_char_literal): Support !GCC$ lines.
* resolve.c (check_host_association): Update
gfc_get_sym_tree call.
* match.c (gfc_match_sym_tree,gfc_match_call): Update
gfc_get_sym_tree call.
* trans-decl.c (add_attributes_to_decl): New function.
(gfc_get_symbol_decl,get_proc_pointer_decl,
gfc_get_extern_function_decl,build_function_decl: Use it.
* match.h (gfc_match_gcc_attributes): Add prototype.
* parse.c (decode_gcc_attribute): New function.
(next_free,next_fixed): Support !GCC$ lines.
* primary.c (match_actual_arg,check_for_implicit_index,
gfc_match_rvalue,gfc_match_rvalue): Update
gfc_get_sym_tree call.
2009-06-28 Tobias Burnus <burnus@net-b.de>
PR fortran/34112
* gfortran.dg/compiler-directive_1.f90: New test.
* gfortran.dg/compiler-directive_2.f: New test.
Co-Authored-By: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
From-SVN: r149036
2009-06-28 19:56:41 +02:00
|
|
|
|
|
|
|
@itemize
|
|
|
|
@item @code{DLLEXPORT} -- provide a global pointer to a pointer in the DLL
|
gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
gcc/fortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
(_gfortran_caf_register): Update for locking/critical.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* resolve.c (resolve_critical): New.
(gfc_resolve_code): Call it.
* trans-decl.c (gfor_fndecl_caf_critical,
gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
(gfc_build_builtin_function_decls): Remove critical,
assign locking declarations.
(generate_coarray_sym_init): Handle locking and
critical variables.
* trans-stmt.c (gfc_trans_critical): Add calls to
lock/unlock libcaf functions.
* trans.h (gfc_coarray_type): Update locking, add
critical enum values.
(gfor_fndecl_caf_critical, gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
libgfortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* caf/libcaf.h (caf_register_t): Update for critical.
(_gfortran_caf_critical, _gfortran_caf_end_critical): Remove.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* caf/single.c (_gfortran_caf_register): Handle locking
variables.
(_gfortran_caf_sendget): Re-name args for consistency.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
From-SVN: r213979
2014-08-14 20:39:15 +02:00
|
|
|
@item @code{DLLIMPORT} -- reference the function or variable using a
|
|
|
|
global pointer
|
re PR fortran/34112 (Add $!DEC ATTRIBUTE support for 32bit Windows' STDCALL)
2009-06-28 Tobias Burnus <burnus@net-b.de>
Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/34112
* symbol.c (gfc_add_ext_attribute): New function.
(gfc_get_sym_tree): New argument allow_subroutine.
(gfc_get_symbol,gfc_get_ha_sym_tree,gen_cptr_param,gen_fptr_param
gen_shape_param,generate_isocbinding_symbol): Use it.
* decl.c (find_special): New argument allow_subroutine.
(add_init_expr_to_sym,add_hidden_procptr_result,attr_decl1,
match_procedure_in_type,gfc_match_final_decl): Use it.
(gfc_match_gcc_attributes): New function.
* gfortran.texi (Mixed-Language Programming): New section
"GNU Fortran Compiler Directives".
* gfortran.h (ext_attr_t): New struct.
(symbol_attributes): Use it.
(gfc_add_ext_attribute): New prototype.
(gfc_get_sym_tree): Update pototype.
* expr.c (gfc_check_pointer_assign): Check whether call
convention is the same.
* module.c (import_iso_c_binding_module, create_int_parameter,
use_iso_fortran_env_module): Update gfc_get_sym_tree call.
* scanner.c (skip_gcc_attribute): New function.
(skip_free_comments,skip_fixed_comments): Use it.
(gfc_next_char_literal): Support !GCC$ lines.
* resolve.c (check_host_association): Update
gfc_get_sym_tree call.
* match.c (gfc_match_sym_tree,gfc_match_call): Update
gfc_get_sym_tree call.
* trans-decl.c (add_attributes_to_decl): New function.
(gfc_get_symbol_decl,get_proc_pointer_decl,
gfc_get_extern_function_decl,build_function_decl: Use it.
* match.h (gfc_match_gcc_attributes): Add prototype.
* parse.c (decode_gcc_attribute): New function.
(next_free,next_fixed): Support !GCC$ lines.
* primary.c (match_actual_arg,check_for_implicit_index,
gfc_match_rvalue,gfc_match_rvalue): Update
gfc_get_sym_tree call.
2009-06-28 Tobias Burnus <burnus@net-b.de>
PR fortran/34112
* gfortran.dg/compiler-directive_1.f90: New test.
* gfortran.dg/compiler-directive_2.f: New test.
Co-Authored-By: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
From-SVN: r149036
2009-06-28 19:56:41 +02:00
|
|
|
@end itemize
|
|
|
|
|
2013-04-16 22:54:21 +02:00
|
|
|
For dummy arguments, the @code{NO_ARG_CHECK} attribute can be used; in
|
|
|
|
other compilers, it is also known as @code{IGNORE_TKR}. For dummy arguments
|
|
|
|
with this attribute actual arguments of any type and kind (similar to
|
|
|
|
@code{TYPE(*)}), scalars and arrays of any rank (no equivalent
|
|
|
|
in Fortran standard) are accepted. As with @code{TYPE(*)}, the argument
|
|
|
|
is unlimited polymorphic and no type information is available.
|
2013-05-21 19:27:04 +02:00
|
|
|
Additionally, the argument may only be passed to dummy arguments
|
|
|
|
with the @code{NO_ARG_CHECK} attribute and as argument to the
|
|
|
|
@code{PRESENT} intrinsic function and to @code{C_LOC} of the
|
|
|
|
@code{ISO_C_BINDING} module.
|
2013-04-16 22:54:21 +02:00
|
|
|
|
|
|
|
Variables with @code{NO_ARG_CHECK} attribute shall be of assumed-type
|
2013-05-21 19:27:04 +02:00
|
|
|
(@code{TYPE(*)}; recommended) or of type @code{INTEGER}, @code{LOGICAL},
|
|
|
|
@code{REAL} or @code{COMPLEX}. They shall not have the @code{ALLOCATE},
|
|
|
|
@code{CODIMENSION}, @code{INTENT(OUT)}, @code{POINTER} or @code{VALUE}
|
|
|
|
attribute; furthermore, they shall be either scalar or of assumed-size
|
|
|
|
(@code{dimension(*)}). As @code{TYPE(*)}, the @code{NO_ARG_CHECK} attribute
|
|
|
|
requires an explicit interface.
|
2013-04-16 22:54:21 +02:00
|
|
|
|
|
|
|
@itemize
|
|
|
|
@item @code{NO_ARG_CHECK} -- disable the type, kind and rank checking
|
|
|
|
@end itemize
|
|
|
|
|
|
|
|
|
re PR fortran/34112 (Add $!DEC ATTRIBUTE support for 32bit Windows' STDCALL)
2009-06-28 Tobias Burnus <burnus@net-b.de>
Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/34112
* symbol.c (gfc_add_ext_attribute): New function.
(gfc_get_sym_tree): New argument allow_subroutine.
(gfc_get_symbol,gfc_get_ha_sym_tree,gen_cptr_param,gen_fptr_param
gen_shape_param,generate_isocbinding_symbol): Use it.
* decl.c (find_special): New argument allow_subroutine.
(add_init_expr_to_sym,add_hidden_procptr_result,attr_decl1,
match_procedure_in_type,gfc_match_final_decl): Use it.
(gfc_match_gcc_attributes): New function.
* gfortran.texi (Mixed-Language Programming): New section
"GNU Fortran Compiler Directives".
* gfortran.h (ext_attr_t): New struct.
(symbol_attributes): Use it.
(gfc_add_ext_attribute): New prototype.
(gfc_get_sym_tree): Update pototype.
* expr.c (gfc_check_pointer_assign): Check whether call
convention is the same.
* module.c (import_iso_c_binding_module, create_int_parameter,
use_iso_fortran_env_module): Update gfc_get_sym_tree call.
* scanner.c (skip_gcc_attribute): New function.
(skip_free_comments,skip_fixed_comments): Use it.
(gfc_next_char_literal): Support !GCC$ lines.
* resolve.c (check_host_association): Update
gfc_get_sym_tree call.
* match.c (gfc_match_sym_tree,gfc_match_call): Update
gfc_get_sym_tree call.
* trans-decl.c (add_attributes_to_decl): New function.
(gfc_get_symbol_decl,get_proc_pointer_decl,
gfc_get_extern_function_decl,build_function_decl: Use it.
* match.h (gfc_match_gcc_attributes): Add prototype.
* parse.c (decode_gcc_attribute): New function.
(next_free,next_fixed): Support !GCC$ lines.
* primary.c (match_actual_arg,check_for_implicit_index,
gfc_match_rvalue,gfc_match_rvalue): Update
gfc_get_sym_tree call.
2009-06-28 Tobias Burnus <burnus@net-b.de>
PR fortran/34112
* gfortran.dg/compiler-directive_1.f90: New test.
* gfortran.dg/compiler-directive_2.f: New test.
Co-Authored-By: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
From-SVN: r149036
2009-06-28 19:56:41 +02:00
|
|
|
The attributes are specified using the syntax
|
|
|
|
|
|
|
|
@code{!GCC$ ATTRIBUTES} @var{attribute-list} @code{::} @var{variable-list}
|
|
|
|
|
|
|
|
where in free-form source code only whitespace is allowed before @code{!GCC$}
|
|
|
|
and in fixed-form source code @code{!GCC$}, @code{cGCC$} or @code{*GCC$} shall
|
|
|
|
start in the first column.
|
|
|
|
|
|
|
|
For procedures, the compiler directives shall be placed into the body
|
|
|
|
of the procedure; for variables and procedure pointers, they shall be in
|
|
|
|
the same declaration part as the variable or procedure pointer.
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-06-03 22:32:23 +02:00
|
|
|
@node Non-Fortran Main Program
|
|
|
|
@section Non-Fortran Main Program
|
|
|
|
|
|
|
|
@menu
|
|
|
|
* _gfortran_set_args:: Save command-line arguments
|
|
|
|
* _gfortran_set_options:: Set library option flags
|
|
|
|
* _gfortran_set_convert:: Set endian conversion
|
|
|
|
* _gfortran_set_record_marker:: Set length of record markers
|
2009-12-08 09:52:28 +01:00
|
|
|
* _gfortran_set_fpe:: Set when a Floating Point Exception should be raised
|
2013-02-21 10:23:31 +01:00
|
|
|
* _gfortran_set_max_subrecord_length:: Set subrecord length
|
2009-06-03 22:32:23 +02:00
|
|
|
@end menu
|
|
|
|
|
|
|
|
Even if you are doing mixed-language programming, it is very
|
|
|
|
likely that you do not need to know or use the information in this
|
2010-09-24 08:39:20 +02:00
|
|
|
section. Since it is about the internal structure of GNU Fortran,
|
2009-06-03 22:32:23 +02:00
|
|
|
it may also change in GCC minor releases.
|
|
|
|
|
|
|
|
When you compile a @code{PROGRAM} with GNU Fortran, a function
|
|
|
|
with the name @code{main} (in the symbol table of the object file)
|
|
|
|
is generated, which initializes the libgfortran library and then
|
|
|
|
calls the actual program which uses the name @code{MAIN__}, for
|
2010-09-24 08:39:20 +02:00
|
|
|
historic reasons. If you link GNU Fortran compiled procedures
|
2009-06-03 22:32:23 +02:00
|
|
|
to, e.g., a C or C++ program or to a Fortran program compiled by
|
|
|
|
a different compiler, the libgfortran library is not initialized
|
|
|
|
and thus a few intrinsic procedures do not work properly, e.g.
|
|
|
|
those for obtaining the command-line arguments.
|
|
|
|
|
|
|
|
Therefore, if your @code{PROGRAM} is not compiled with
|
|
|
|
GNU Fortran and the GNU Fortran compiled procedures require
|
|
|
|
intrinsics relying on the library initialization, you need to
|
2010-09-24 08:39:20 +02:00
|
|
|
initialize the library yourself. Using the default options,
|
2009-06-03 22:32:23 +02:00
|
|
|
gfortran calls @code{_gfortran_set_args} and
|
2010-09-24 08:39:20 +02:00
|
|
|
@code{_gfortran_set_options}. The initialization of the former
|
2009-06-03 22:32:23 +02:00
|
|
|
is needed if the called procedures access the command line
|
|
|
|
(and for backtracing); the latter sets some flags based on the
|
2011-05-14 12:24:18 +02:00
|
|
|
standard chosen or to enable backtracing. In typical programs,
|
2009-06-03 22:32:23 +02:00
|
|
|
it is not necessary to call any initialization function.
|
|
|
|
|
|
|
|
If your @code{PROGRAM} is compiled with GNU Fortran, you shall
|
2010-09-24 08:39:20 +02:00
|
|
|
not call any of the following functions. The libgfortran
|
2009-06-03 22:32:23 +02:00
|
|
|
initialization functions are shown in C syntax but using C
|
|
|
|
bindings they are also accessible from Fortran.
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_set_args
|
|
|
|
@subsection @code{_gfortran_set_args} --- Save command-line arguments
|
|
|
|
@fnindex _gfortran_set_args
|
|
|
|
@cindex libgfortran initialization, set_args
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
@code{_gfortran_set_args} saves the command-line arguments; this
|
|
|
|
initialization is required if any of the command-line intrinsics
|
2010-09-24 08:39:20 +02:00
|
|
|
is called. Additionally, it shall be called if backtracing is
|
2009-06-03 22:32:23 +02:00
|
|
|
enabled (see @code{_gfortran_set_options}).
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_set_args (int argc, char *argv[])}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{argc} @tab number of command line argument strings
|
|
|
|
@item @var{argv} @tab the command-line argument strings; argv[0]
|
|
|
|
is the pathname of the executable itself.
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{Example}:
|
|
|
|
@smallexample
|
|
|
|
int main (int argc, char *argv[])
|
|
|
|
@{
|
|
|
|
/* Initialize libgfortran. */
|
|
|
|
_gfortran_set_args (argc, argv);
|
|
|
|
return 0;
|
|
|
|
@}
|
|
|
|
@end smallexample
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_set_options
|
|
|
|
@subsection @code{_gfortran_set_options} --- Set library option flags
|
|
|
|
@fnindex _gfortran_set_options
|
|
|
|
@cindex libgfortran initialization, set_options
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
@code{_gfortran_set_options} sets several flags related to the Fortran
|
2011-05-14 12:20:56 +02:00
|
|
|
standard to be used, whether backtracing should be enabled
|
2010-09-24 08:39:20 +02:00
|
|
|
and whether range checks should be performed. The syntax allows for
|
2009-06-03 22:32:23 +02:00
|
|
|
upward compatibility since the number of passed flags is specified; for
|
2010-09-24 08:39:20 +02:00
|
|
|
non-passed flags, the default value is used. See also
|
|
|
|
@pxref{Code Gen Options}. Please note that not all flags are actually
|
2009-06-03 22:32:23 +02:00
|
|
|
used.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_set_options (int num, int options[])}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{num} @tab number of options passed
|
|
|
|
@item @var{argv} @tab The list of flag values
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{option flag list}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{option}[0] @tab Allowed standard; can give run-time errors
|
|
|
|
if e.g. an input-output edit descriptor is invalid in a given standard.
|
|
|
|
Possible values are (bitwise or-ed) @code{GFC_STD_F77} (1),
|
|
|
|
@code{GFC_STD_F95_OBS} (2), @code{GFC_STD_F95_DEL} (4), @code{GFC_STD_F95}
|
|
|
|
(8), @code{GFC_STD_F2003} (16), @code{GFC_STD_GNU} (32),
|
gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
gcc/fortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
(_gfortran_caf_register): Update for locking/critical.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* resolve.c (resolve_critical): New.
(gfc_resolve_code): Call it.
* trans-decl.c (gfor_fndecl_caf_critical,
gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
(gfc_build_builtin_function_decls): Remove critical,
assign locking declarations.
(generate_coarray_sym_init): Handle locking and
critical variables.
* trans-stmt.c (gfc_trans_critical): Add calls to
lock/unlock libcaf functions.
* trans.h (gfc_coarray_type): Update locking, add
critical enum values.
(gfor_fndecl_caf_critical, gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
libgfortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* caf/libcaf.h (caf_register_t): Update for critical.
(_gfortran_caf_critical, _gfortran_caf_end_critical): Remove.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* caf/single.c (_gfortran_caf_register): Handle locking
variables.
(_gfortran_caf_sendget): Re-name args for consistency.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
From-SVN: r213979
2014-08-14 20:39:15 +02:00
|
|
|
@code{GFC_STD_LEGACY} (64), @code{GFC_STD_F2008} (128),
|
2011-10-15 10:34:36 +02:00
|
|
|
@code{GFC_STD_F2008_OBS} (256) and GFC_STD_F2008_TS (512). Default:
|
2011-05-16 22:37:30 +02:00
|
|
|
@code{GFC_STD_F95_OBS | GFC_STD_F95_DEL | GFC_STD_F95 | GFC_STD_F2003
|
2011-10-15 10:34:36 +02:00
|
|
|
| GFC_STD_F2008 | GFC_STD_F2008_TS | GFC_STD_F2008_OBS | GFC_STD_F77
|
2011-05-16 22:37:30 +02:00
|
|
|
| GFC_STD_GNU | GFC_STD_LEGACY}.
|
2009-06-03 22:32:23 +02:00
|
|
|
@item @var{option}[1] @tab Standard-warning flag; prints a warning to
|
2010-09-24 08:39:20 +02:00
|
|
|
standard error. Default: @code{GFC_STD_F95_DEL | GFC_STD_LEGACY}.
|
2009-06-03 22:32:23 +02:00
|
|
|
@item @var{option}[2] @tab If non zero, enable pedantic checking.
|
|
|
|
Default: off.
|
2011-05-14 12:20:56 +02:00
|
|
|
@item @var{option}[3] @tab Unused.
|
2009-06-03 22:32:23 +02:00
|
|
|
@item @var{option}[4] @tab If non zero, enable backtracing on run-time
|
2013-06-17 09:48:21 +02:00
|
|
|
errors. Default: off. (Default in the compiler: on.)
|
2009-06-03 22:32:23 +02:00
|
|
|
Note: Installs a signal handler and requires command-line
|
|
|
|
initialization using @code{_gfortran_set_args}.
|
|
|
|
@item @var{option}[5] @tab If non zero, supports signed zeros.
|
|
|
|
Default: enabled.
|
2010-09-24 08:39:20 +02:00
|
|
|
@item @var{option}[6] @tab Enables run-time checking. Possible values
|
2009-06-03 22:32:23 +02:00
|
|
|
are (bitwise or-ed): GFC_RTCHECK_BOUNDS (1), GFC_RTCHECK_ARRAY_TEMPS (2),
|
2009-06-29 23:02:17 +02:00
|
|
|
GFC_RTCHECK_RECURSION (4), GFC_RTCHECK_DO (16), GFC_RTCHECK_POINTER (32).
|
2009-06-03 22:32:23 +02:00
|
|
|
Default: disabled.
|
2013-06-17 09:48:21 +02:00
|
|
|
@item @var{option}[7] @tab Unused.
|
|
|
|
@item @var{option}[8] @tab Show a warning when invoking @code{STOP} and
|
|
|
|
@code{ERROR STOP} if a floating-point exception occurred. Possible values
|
|
|
|
are (bitwise or-ed) @code{GFC_FPE_INVALID} (1), @code{GFC_FPE_DENORMAL} (2),
|
|
|
|
@code{GFC_FPE_ZERO} (4), @code{GFC_FPE_OVERFLOW} (8),
|
|
|
|
@code{GFC_FPE_UNDERFLOW} (16), @code{GFC_FPE_INEXACT} (32). Default: None (0).
|
|
|
|
(Default in the compiler: @code{GFC_FPE_INVALID | GFC_FPE_DENORMAL |
|
|
|
|
GFC_FPE_ZERO | GFC_FPE_OVERFLOW | GFC_FPE_UNDERFLOW}.)
|
2009-06-03 22:32:23 +02:00
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{Example}:
|
|
|
|
@smallexample
|
2013-06-17 09:48:21 +02:00
|
|
|
/* Use gfortran 4.9 default options. */
|
|
|
|
static int options[] = @{68, 511, 0, 0, 1, 1, 0, 0, 31@};
|
|
|
|
_gfortran_set_options (9, &options);
|
2009-06-03 22:32:23 +02:00
|
|
|
@end smallexample
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_set_convert
|
|
|
|
@subsection @code{_gfortran_set_convert} --- Set endian conversion
|
|
|
|
@fnindex _gfortran_set_convert
|
|
|
|
@cindex libgfortran initialization, set_convert
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
@code{_gfortran_set_convert} set the representation of data for
|
|
|
|
unformatted files.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_set_convert (int conv)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{conv} @tab Endian conversion, possible values:
|
|
|
|
GFC_CONVERT_NATIVE (0, default), GFC_CONVERT_SWAP (1),
|
|
|
|
GFC_CONVERT_BIG (2), GFC_CONVERT_LITTLE (3).
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{Example}:
|
|
|
|
@smallexample
|
|
|
|
int main (int argc, char *argv[])
|
|
|
|
@{
|
|
|
|
/* Initialize libgfortran. */
|
|
|
|
_gfortran_set_args (argc, argv);
|
|
|
|
_gfortran_set_convert (1);
|
|
|
|
return 0;
|
|
|
|
@}
|
|
|
|
@end smallexample
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_set_record_marker
|
|
|
|
@subsection @code{_gfortran_set_record_marker} --- Set length of record markers
|
|
|
|
@fnindex _gfortran_set_record_marker
|
|
|
|
@cindex libgfortran initialization, set_record_marker
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
2009-12-08 09:52:28 +01:00
|
|
|
@code{_gfortran_set_record_marker} sets the length of record markers
|
2009-06-03 22:32:23 +02:00
|
|
|
for unformatted files.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_set_record_marker (int val)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{val} @tab Length of the record marker; valid values
|
2010-09-24 08:39:20 +02:00
|
|
|
are 4 and 8. Default is 4.
|
2009-06-03 22:32:23 +02:00
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{Example}:
|
|
|
|
@smallexample
|
|
|
|
int main (int argc, char *argv[])
|
|
|
|
@{
|
|
|
|
/* Initialize libgfortran. */
|
|
|
|
_gfortran_set_args (argc, argv);
|
|
|
|
_gfortran_set_record_marker (8);
|
|
|
|
return 0;
|
|
|
|
@}
|
|
|
|
@end smallexample
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
2009-12-08 09:52:28 +01:00
|
|
|
@node _gfortran_set_fpe
|
2011-05-20 14:55:45 +02:00
|
|
|
@subsection @code{_gfortran_set_fpe} --- Enable floating point exception traps
|
2009-12-08 09:52:28 +01:00
|
|
|
@fnindex _gfortran_set_fpe
|
|
|
|
@cindex libgfortran initialization, set_fpe
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
2011-05-20 14:55:45 +02:00
|
|
|
@code{_gfortran_set_fpe} enables floating point exception traps for
|
|
|
|
the specified exceptions. On most systems, this will result in a
|
|
|
|
SIGFPE signal being sent and the program being aborted.
|
2009-12-08 09:52:28 +01:00
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_set_fpe (int val)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
2010-09-24 08:39:20 +02:00
|
|
|
@item @var{option}[0] @tab IEEE exceptions. Possible values are
|
2009-12-08 09:52:28 +01:00
|
|
|
(bitwise or-ed) zero (0, default) no trapping,
|
|
|
|
@code{GFC_FPE_INVALID} (1), @code{GFC_FPE_DENORMAL} (2),
|
|
|
|
@code{GFC_FPE_ZERO} (4), @code{GFC_FPE_OVERFLOW} (8),
|
2011-05-20 14:55:45 +02:00
|
|
|
@code{GFC_FPE_UNDERFLOW} (16), and @code{GFC_FPE_INEXACT} (32).
|
2009-12-08 09:52:28 +01:00
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{Example}:
|
|
|
|
@smallexample
|
|
|
|
int main (int argc, char *argv[])
|
|
|
|
@{
|
|
|
|
/* Initialize libgfortran. */
|
|
|
|
_gfortran_set_args (argc, argv);
|
|
|
|
/* FPE for invalid operations such as SQRT(-1.0). */
|
|
|
|
_gfortran_set_fpe (1);
|
|
|
|
return 0;
|
|
|
|
@}
|
|
|
|
@end smallexample
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
2009-06-03 22:32:23 +02:00
|
|
|
@node _gfortran_set_max_subrecord_length
|
|
|
|
@subsection @code{_gfortran_set_max_subrecord_length} --- Set subrecord length
|
|
|
|
@fnindex _gfortran_set_max_subrecord_length
|
|
|
|
@cindex libgfortran initialization, set_max_subrecord_length
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
@code{_gfortran_set_max_subrecord_length} set the maximum length
|
2010-09-24 08:39:20 +02:00
|
|
|
for a subrecord. This option only makes sense for testing and
|
2009-06-03 22:32:23 +02:00
|
|
|
debugging of unformatted I/O.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_set_max_subrecord_length (int val)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{val} @tab the maximum length for a subrecord;
|
|
|
|
the maximum permitted value is 2147483639, which is also
|
|
|
|
the default.
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{Example}:
|
|
|
|
@smallexample
|
|
|
|
int main (int argc, char *argv[])
|
|
|
|
@{
|
|
|
|
/* Initialize libgfortran. */
|
|
|
|
_gfortran_set_args (argc, argv);
|
|
|
|
_gfortran_set_max_subrecord_length (8);
|
|
|
|
return 0;
|
|
|
|
@}
|
|
|
|
@end smallexample
|
|
|
|
@end table
|
|
|
|
|
2009-05-08 00:14:23 +02:00
|
|
|
|
2013-04-09 12:02:35 +02:00
|
|
|
@node Naming and argument-passing conventions
|
|
|
|
@section Naming and argument-passing conventions
|
|
|
|
|
|
|
|
This section gives an overview about the naming convention of procedures
|
|
|
|
and global variables and about the argument passing conventions used by
|
|
|
|
GNU Fortran. If a C binding has been specified, the naming convention
|
|
|
|
and some of the argument-passing conventions change. If possible,
|
|
|
|
mixed-language and mixed-compiler projects should use the better defined
|
|
|
|
C binding for interoperability. See @pxref{Interoperability with C}.
|
|
|
|
|
|
|
|
@menu
|
|
|
|
* Naming conventions::
|
|
|
|
* Argument passing conventions::
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
|
|
|
|
@node Naming conventions
|
|
|
|
@subsection Naming conventions
|
|
|
|
|
|
|
|
According the Fortran standard, valid Fortran names consist of a letter
|
|
|
|
between @code{A} to @code{Z}, @code{a} to @code{z}, digits @code{0},
|
|
|
|
@code{1} to @code{9} and underscores (@code{_}) with the restriction
|
|
|
|
that names may only start with a letter. As vendor extension, the
|
|
|
|
dollar sign (@code{$}) is additionally permitted with the option
|
|
|
|
@option{-fdollar-ok}, but not as first character and only if the
|
|
|
|
target system supports it.
|
|
|
|
|
|
|
|
By default, the procedure name is the lower-cased Fortran name with an
|
|
|
|
appended underscore (@code{_}); using @option{-fno-underscoring} no
|
|
|
|
underscore is appended while @code{-fsecond-underscore} appends two
|
|
|
|
underscores. Depending on the target system and the calling convention,
|
|
|
|
the procedure might be additionally dressed; for instance, on 32bit
|
|
|
|
Windows with @code{stdcall}, an at-sign @code{@@} followed by an integer
|
|
|
|
number is appended. For the changing the calling convention, see
|
|
|
|
@pxref{GNU Fortran Compiler Directives}.
|
|
|
|
|
|
|
|
For common blocks, the same convention is used, i.e. by default an
|
|
|
|
underscore is appended to the lower-cased Fortran name. Blank commons
|
|
|
|
have the name @code{__BLNK__}.
|
|
|
|
|
|
|
|
For procedures and variables declared in the specification space of a
|
|
|
|
module, the name is formed by @code{__}, followed by the lower-cased
|
|
|
|
module name, @code{_MOD_}, and the lower-cased Fortran name. Note that
|
|
|
|
no underscore is appended.
|
|
|
|
|
|
|
|
|
|
|
|
@node Argument passing conventions
|
|
|
|
@subsection Argument passing conventions
|
|
|
|
|
|
|
|
Subroutines do not return a value (matching C99's @code{void}) while
|
|
|
|
functions either return a value as specified in the platform ABI or
|
|
|
|
the result variable is passed as hidden argument to the function and
|
|
|
|
no result is returned. A hidden result variable is used when the
|
|
|
|
result variable is an array or of type @code{CHARACTER}.
|
|
|
|
|
|
|
|
Arguments are passed according to the platform ABI. In particular,
|
|
|
|
complex arguments might not be compatible to a struct with two real
|
|
|
|
components for the real and imaginary part. The argument passing
|
|
|
|
matches the one of C99's @code{_Complex}. Functions with scalar
|
|
|
|
complex result variables return their value and do not use a
|
|
|
|
by-reference argument. Note that with the @option{-ff2c} option,
|
|
|
|
the argument passing is modified and no longer completely matches
|
|
|
|
the platform ABI. Some other Fortran compilers use @code{f2c}
|
|
|
|
semantic by default; this might cause problems with
|
gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
gcc/fortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
(_gfortran_caf_register): Update for locking/critical.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* resolve.c (resolve_critical): New.
(gfc_resolve_code): Call it.
* trans-decl.c (gfor_fndecl_caf_critical,
gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
(gfc_build_builtin_function_decls): Remove critical,
assign locking declarations.
(generate_coarray_sym_init): Handle locking and
critical variables.
* trans-stmt.c (gfc_trans_critical): Add calls to
lock/unlock libcaf functions.
* trans.h (gfc_coarray_type): Update locking, add
critical enum values.
(gfor_fndecl_caf_critical, gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
libgfortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* caf/libcaf.h (caf_register_t): Update for critical.
(_gfortran_caf_critical, _gfortran_caf_end_critical): Remove.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* caf/single.c (_gfortran_caf_register): Handle locking
variables.
(_gfortran_caf_sendget): Re-name args for consistency.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
From-SVN: r213979
2014-08-14 20:39:15 +02:00
|
|
|
interoperablility.
|
2013-04-09 12:02:35 +02:00
|
|
|
|
|
|
|
GNU Fortran passes most arguments by reference, i.e. by passing a
|
|
|
|
pointer to the data. Note that the compiler might use a temporary
|
|
|
|
variable into which the actual argument has been copied, if required
|
|
|
|
semantically (copy-in/copy-out).
|
|
|
|
|
|
|
|
For arguments with @code{ALLOCATABLE} and @code{POINTER}
|
|
|
|
attribute (including procedure pointers), a pointer to the pointer
|
|
|
|
is passed such that the pointer address can be modified in the
|
|
|
|
procedure.
|
|
|
|
|
|
|
|
For dummy arguments with the @code{VALUE} attribute: Scalar arguments
|
|
|
|
of the type @code{INTEGER}, @code{LOGICAL}, @code{REAL} and
|
|
|
|
@code{COMPLEX} are passed by value according to the platform ABI.
|
|
|
|
(As vendor extension and not recommended, using @code{%VAL()} in the
|
|
|
|
call to a procedure has the same effect.) For @code{TYPE(C_PTR)} and
|
|
|
|
procedure pointers, the pointer itself is passed such that it can be
|
|
|
|
modified without affecting the caller.
|
|
|
|
@c FIXME: Document how VALUE is handled for CHARACTER, TYPE,
|
|
|
|
@c CLASS and arrays, i.e. whether the copy-in is done in the caller
|
|
|
|
@c or in the callee.
|
|
|
|
|
|
|
|
For Boolean (@code{LOGICAL}) arguments, please note that GCC expects
|
|
|
|
only the integer value 0 and 1. If a GNU Fortran @code{LOGICAL}
|
|
|
|
variable contains another integer value, the result is undefined.
|
|
|
|
As some other Fortran compilers use @math{-1} for @code{.TRUE.},
|
|
|
|
extra care has to be taken -- such as passing the value as
|
|
|
|
@code{INTEGER}. (The same value restriction also applies to other
|
|
|
|
front ends of GCC, e.g. to GCC's C99 compiler for @code{_Bool}
|
|
|
|
or GCC's Ada compiler for @code{Boolean}.)
|
|
|
|
|
|
|
|
For arguments of @code{CHARACTER} type, the character length is passed
|
|
|
|
as hidden argument. For deferred-length strings, the value is passed
|
|
|
|
by reference, otherwise by value. The character length has the type
|
|
|
|
@code{INTEGER(kind=4)}. Note with C binding, @code{CHARACTER(len=1)}
|
|
|
|
result variables are returned according to the platform ABI and no
|
|
|
|
hidden length argument is used for dummy arguments; with @code{VALUE},
|
|
|
|
those variables are passed by value.
|
|
|
|
|
|
|
|
For @code{OPTIONAL} dummy arguments, an absent argument is denoted
|
|
|
|
by a NULL pointer, except for scalar dummy arguments of type
|
|
|
|
@code{INTEGER}, @code{LOGICAL}, @code{REAL} and @code{COMPLEX}
|
|
|
|
which have the @code{VALUE} attribute. For those, a hidden Boolean
|
|
|
|
argument (@code{logical(kind=C_bool),value}) is used to indicate
|
|
|
|
whether the argument is present.
|
|
|
|
|
|
|
|
Arguments which are assumed-shape, assumed-rank or deferred-rank
|
|
|
|
arrays or, with @option{-fcoarray=lib}, allocatable scalar coarrays use
|
|
|
|
an array descriptor. All other arrays pass the address of the
|
|
|
|
first element of the array. With @option{-fcoarray=lib}, the token
|
|
|
|
and the offset belonging to nonallocatable coarrays dummy arguments
|
|
|
|
are passed as hidden argument along the character length hidden
|
|
|
|
arguments. The token is an oparque pointer identifying the coarray
|
|
|
|
and the offset is a passed-by-value integer of kind @code{C_PTRDIFF_T},
|
|
|
|
denoting the byte offset between the base address of the coarray and
|
|
|
|
the passed scalar or first element of the passed array.
|
|
|
|
|
|
|
|
The arguments are passed in the following order
|
|
|
|
@itemize @bullet
|
|
|
|
@item Result variable, when the function result is passed by reference
|
|
|
|
@item Character length of the function result, if it is a of type
|
|
|
|
@code{CHARACTER} and no C binding is used
|
|
|
|
@item The arguments in the order in which they appear in the Fortran
|
|
|
|
declaration
|
|
|
|
@item The the present status for optional arguments with value attribute,
|
|
|
|
which are internally passed by value
|
|
|
|
@item The character length and/or coarray token and offset for the first
|
|
|
|
argument which is a @code{CHARACTER} or a nonallocatable coarray dummy
|
|
|
|
argument, followed by the hidden arguments of the next dummy argument
|
|
|
|
of such a type
|
|
|
|
@end itemize
|
|
|
|
|
|
|
|
|
2014-08-14 20:35:01 +02:00
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
@c Coarray Programming
|
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
|
|
|
|
@node Coarray Programming
|
|
|
|
@chapter Coarray Programming
|
|
|
|
@cindex Coarrays
|
|
|
|
|
|
|
|
@menu
|
|
|
|
* Type and enum ABI Documentation::
|
|
|
|
* Function ABI Documentation::
|
|
|
|
@end menu
|
|
|
|
|
|
|
|
|
|
|
|
@node Type and enum ABI Documentation
|
|
|
|
@section Type and enum ABI Documentation
|
|
|
|
|
|
|
|
@menu
|
|
|
|
* caf_token_t::
|
|
|
|
* caf_register_t::
|
2016-11-30 14:27:49 +01:00
|
|
|
* caf_deregister_t::
|
2016-09-19 15:45:40 +02:00
|
|
|
* caf_reference_t::
|
2014-08-14 20:35:01 +02:00
|
|
|
@end menu
|
|
|
|
|
|
|
|
@node caf_token_t
|
|
|
|
@subsection @code{caf_token_t}
|
|
|
|
|
|
|
|
Typedef of type @code{void *} on the compiler side. Can be any data
|
|
|
|
type on the library side.
|
|
|
|
|
|
|
|
@node caf_register_t
|
|
|
|
@subsection @code{caf_register_t}
|
|
|
|
|
|
|
|
Indicates which kind of coarray variable should be registered.
|
|
|
|
|
|
|
|
@verbatim
|
|
|
|
typedef enum caf_register_t {
|
|
|
|
CAF_REGTYPE_COARRAY_STATIC,
|
|
|
|
CAF_REGTYPE_COARRAY_ALLOC,
|
|
|
|
CAF_REGTYPE_LOCK_STATIC,
|
gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
gcc/fortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
(_gfortran_caf_register): Update for locking/critical.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* resolve.c (resolve_critical): New.
(gfc_resolve_code): Call it.
* trans-decl.c (gfor_fndecl_caf_critical,
gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
(gfc_build_builtin_function_decls): Remove critical,
assign locking declarations.
(generate_coarray_sym_init): Handle locking and
critical variables.
* trans-stmt.c (gfc_trans_critical): Add calls to
lock/unlock libcaf functions.
* trans.h (gfc_coarray_type): Update locking, add
critical enum values.
(gfor_fndecl_caf_critical, gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
libgfortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* caf/libcaf.h (caf_register_t): Update for critical.
(_gfortran_caf_critical, _gfortran_caf_end_critical): Remove.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* caf/single.c (_gfortran_caf_register): Handle locking
variables.
(_gfortran_caf_sendget): Re-name args for consistency.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
From-SVN: r213979
2014-08-14 20:39:15 +02:00
|
|
|
CAF_REGTYPE_LOCK_ALLOC,
|
check.c (gfc_check_event_query): New function.
2015-12-02 Tobias Burnus <burnus@net-b.de>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* check.c (gfc_check_event_query): New function.
* dump-parse-tree.c (show_code_node): Handle EXEC_EVENT_POST,
EXEC_EVENT_WAIT.
* expr.c (gfc_check_vardef_context): New check for event variables
definition.
* gfortran.h (gfc_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(gfc_isym_id): GFC_ISYM_EVENT_QUERY.
(struct symbol_attribute): New field.
(gfc_exec_op): Add EXEC_EVENT_POST and EXEC_EVENT_WAIT.
* gfortran.texi: Document about new events functions and minor
changes.
* interface.c (compare_parameter): New check.
(gfc_procedure_use): New check for explicit procedure interface.
(add_subroutines): Add event_query.
* intrinsic.h (gfc_check_event_query,gfc_resolve_event_query):
New prototypes.
* iresolve.c (gfc_resolve_event_query): New function.
* iso-fortran-env.def (event_type): New type.
* match.c (event_statement,gfc_match_event_post,gfc_match_event_wait):
New functions.
(gfc_match_name): New event post and event wait.
* match.h (gfc_match_event_post,gfc_match_event_wait):
New prototypes.
* module.c (ab_attribute): Add AB_EVENT_COMP.
(attr_bits): Likewise.
(mio_symbol_attribute): Handle event_comp attribute.
* parse.c (decode_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(next_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(gfc_ascii_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(parse_derived): Check for event_type components.
* resolve.c (resolve_allocate_expr): Check for event variable def.
(resolve_lock_unlock): Renamed to resolve_lock_unlock_event. It
includes logic for locks and events.
(gfc_resolve_code): Call it.
(gfc_resolve_symbol): New check for event variable to be a corray.
* st.c (gfc_free_statement): Handle new EXEC_EVENT_POST and
EXEC_EVENT_WAIT.
* trans-decl.c (gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
gfor_fndecl_caf_event_query): New global variables.
(generate_coarray_sym_init): Checking for event_type.
(gfc_conv_procedure_call): Check for C bind attribute.
* trans-intrinsic.c (conv_intrinsic_event_query): New function.
(conv_intrinsic_move_alloc): Call it.
* trans-stmt.c (gfc_trans_lock_unlock): Passing address
of actual argument.
(gfc_trans_sync): Likewise.
(gfc_trans_event_post_wait): New function.
* trans-stmt.h (gfc_trans_event_post_wait): New prototype.
* trans-types.c (gfc_get_derived_type): Integer_kind as event_type.
* trans.c (gfc_allocate_using_lib): New argument and logic for events.
(gfc_allocate_allocatable): Passing new argument.
(trans_code): Handle EXEC_EVENT_POST, EXEC_EVENT_WAIT.
* trans.h (gfc_coarray_type): New elements.
(gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
gfor_fndecl_caf_event_query): Declare them.
2015-12-02 Tobias Burnus <burnus@net-b.de>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* gfortran.dg/coarray/event_1.f90: New.
* gfortran.dg/coarray/event_2.f90: New.
Co-Authored-By: Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
From-SVN: r231208
2015-12-02 22:59:05 +01:00
|
|
|
CAF_REGTYPE_CRITICAL,
|
|
|
|
CAF_REGTYPE_EVENT_STATIC,
|
2016-11-30 14:27:49 +01:00
|
|
|
CAF_REGTYPE_EVENT_ALLOC,
|
|
|
|
CAF_REGTYPE_COARRAY_ALLOC_REGISTER_ONLY,
|
|
|
|
CAF_REGTYPE_COARRAY_ALLOC_ALLOCATE_ONLY
|
2014-08-14 20:35:01 +02:00
|
|
|
}
|
|
|
|
caf_register_t;
|
|
|
|
@end verbatim
|
|
|
|
|
2016-11-30 14:27:49 +01:00
|
|
|
The values @code{CAF_REGTYPE_COARRAY_ALLOC_REGISTER_ONLY} and
|
|
|
|
@code{CAF_REGTYPE_COARRAY_ALLOC_ALLOCATE_ONLY} are for allocatable components
|
|
|
|
in derived type coarrays only. The first one sets up the token without
|
|
|
|
allocating memory for allocatable component. The latter one only allocates the
|
|
|
|
memory for an allocatable component in a derived type coarray. The token
|
|
|
|
needs to be setup previously by the REGISTER_ONLY. This allows to have
|
|
|
|
allocatable components un-allocated on some images. The status whether an
|
|
|
|
allocatable component is allocated on a remote image can be queried by
|
|
|
|
@code{_caf_is_present} which used internally by the @code{ALLOCATED}
|
|
|
|
intrinsic.
|
|
|
|
|
|
|
|
@node caf_deregister_t
|
|
|
|
@subsection @code{caf_deregister_t}
|
|
|
|
|
|
|
|
@verbatim
|
|
|
|
typedef enum caf_deregister_t {
|
|
|
|
CAF_DEREGTYPE_COARRAY_DEREGISTER,
|
|
|
|
CAF_DEREGTYPE_COARRAY_DEALLOCATE_ONLY
|
|
|
|
}
|
|
|
|
caf_deregister_t;
|
|
|
|
@end verbatim
|
|
|
|
|
|
|
|
Allows to specifiy the type of deregistration of a coarray object. The
|
|
|
|
@code{CAF_DEREGTYPE_COARRAY_DEALLOCATE_ONLY} flag is only allowed for
|
|
|
|
allocatable components in derived type coarrays.
|
|
|
|
|
2016-09-19 15:45:40 +02:00
|
|
|
@node caf_reference_t
|
|
|
|
@subsection @code{caf_reference_t}
|
|
|
|
|
|
|
|
The structure used for implementing arbitrary reference chains.
|
|
|
|
A @code{CAF_REFERENCE_T} allows to specify a component reference or any kind
|
|
|
|
of array reference of any rank supported by gfortran. For array references all
|
|
|
|
kinds as known by the compiler/Fortran standard are supported indicated by
|
|
|
|
a @code{MODE}.
|
|
|
|
|
|
|
|
@verbatim
|
|
|
|
typedef enum caf_ref_type_t {
|
|
|
|
/* Reference a component of a derived type, either regular one or an
|
|
|
|
allocatable or pointer type. For regular ones idx in caf_reference_t is
|
|
|
|
set to -1. */
|
|
|
|
CAF_REF_COMPONENT,
|
|
|
|
/* Reference an allocatable array. */
|
|
|
|
CAF_REF_ARRAY,
|
|
|
|
/* Reference a non-allocatable/non-pointer array. I.e., the coarray object
|
|
|
|
has no array descriptor associated and the addressing is done
|
|
|
|
completely using the ref. */
|
|
|
|
CAF_REF_STATIC_ARRAY
|
|
|
|
} caf_ref_type_t;
|
|
|
|
@end verbatim
|
|
|
|
|
|
|
|
@verbatim
|
|
|
|
typedef enum caf_array_ref_t {
|
|
|
|
/* No array ref. This terminates the array ref. */
|
|
|
|
CAF_ARR_REF_NONE = 0,
|
|
|
|
/* Reference array elements given by a vector. Only for this mode
|
|
|
|
caf_reference_t.u.a.dim[i].v is valid. */
|
|
|
|
CAF_ARR_REF_VECTOR,
|
|
|
|
/* A full array ref (:). */
|
|
|
|
CAF_ARR_REF_FULL,
|
|
|
|
/* Reference a range on elements given by start, end and stride. */
|
|
|
|
CAF_ARR_REF_RANGE,
|
|
|
|
/* Only a single item is referenced given in the start member. */
|
|
|
|
CAF_ARR_REF_SINGLE,
|
|
|
|
/* An array ref of the kind (i:), where i is an arbitrary valid index in the
|
|
|
|
array. The index i is given in the start member. */
|
|
|
|
CAF_ARR_REF_OPEN_END,
|
|
|
|
/* An array ref of the kind (:i), where the lower bound of the array ref
|
|
|
|
is given by the remote side. The index i is given in the end member. */
|
|
|
|
CAF_ARR_REF_OPEN_START
|
|
|
|
} caf_array_ref_t;
|
|
|
|
@end verbatim
|
|
|
|
|
|
|
|
@verbatim
|
|
|
|
/* References to remote components of a derived type. */
|
|
|
|
typedef struct caf_reference_t {
|
|
|
|
/* A pointer to the next ref or NULL. */
|
|
|
|
struct caf_reference_t *next;
|
|
|
|
/* The type of the reference. */
|
|
|
|
/* caf_ref_type_t, replaced by int to allow specification in fortran FE. */
|
|
|
|
int type;
|
|
|
|
/* The size of an item referenced in bytes. I.e. in an array ref this is
|
|
|
|
the factor to advance the array pointer with to get to the next item.
|
|
|
|
For component refs this gives just the size of the element referenced. */
|
|
|
|
size_t item_size;
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
/* The offset (in bytes) of the component in the derived type.
|
|
|
|
Unused for allocatable or pointer components. */
|
|
|
|
ptrdiff_t offset;
|
|
|
|
/* The offset (in bytes) to the caf_token associated with this
|
|
|
|
component. NULL, when not allocatable/pointer ref. */
|
|
|
|
ptrdiff_t caf_token_offset;
|
|
|
|
} c;
|
|
|
|
struct {
|
|
|
|
/* The mode of the array ref. See CAF_ARR_REF_*. */
|
|
|
|
/* caf_array_ref_t, replaced by unsigend char to allow specification in
|
|
|
|
fortran FE. */
|
|
|
|
unsigned char mode[GFC_MAX_DIMENSIONS];
|
|
|
|
/* The type of a static array. Unset for array's with descriptors. */
|
|
|
|
int static_array_type;
|
|
|
|
/* Subscript refs (s) or vector refs (v). */
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
/* The start and end boundary of the ref and the stride. */
|
|
|
|
index_type start, end, stride;
|
|
|
|
} s;
|
|
|
|
struct {
|
|
|
|
/* nvec entries of kind giving the elements to reference. */
|
|
|
|
void *vector;
|
|
|
|
/* The number of entries in vector. */
|
|
|
|
size_t nvec;
|
|
|
|
/* The integer kind used for the elements in vector. */
|
|
|
|
int kind;
|
|
|
|
} v;
|
|
|
|
} dim[GFC_MAX_DIMENSIONS];
|
|
|
|
} a;
|
|
|
|
} u;
|
|
|
|
} caf_reference_t;
|
|
|
|
@end verbatim
|
|
|
|
|
|
|
|
The references make up a single linked list of reference operations. The
|
|
|
|
@code{NEXT} member links to the next reference or NULL to indicate the end of
|
|
|
|
the chain. Component and array refs can be arbitrarly mixed as long as they
|
|
|
|
comply to the Fortran standard.
|
|
|
|
|
|
|
|
@emph{NOTES}
|
|
|
|
The member @code{STATIC_ARRAY_TYPE} is used only when the @code{TYPE} is
|
|
|
|
@code{CAF_REF_STATIC_ARRAY}. The member gives the type of the data referenced.
|
|
|
|
Because no array descriptor is available for a descriptor-less array and
|
|
|
|
type conversion still needs to take place the type is transported here.
|
|
|
|
|
|
|
|
At the moment @code{CAF_ARR_REF_VECTOR} is not implemented in the front end for
|
|
|
|
descriptor-less arrays. The library caf_single has untested support for it.
|
|
|
|
|
2014-08-14 20:35:01 +02:00
|
|
|
|
|
|
|
@node Function ABI Documentation
|
|
|
|
@section Function ABI Documentation
|
|
|
|
|
|
|
|
@menu
|
|
|
|
* _gfortran_caf_init:: Initialiation function
|
|
|
|
* _gfortran_caf_finish:: Finalization function
|
|
|
|
* _gfortran_caf_this_image:: Querying the image number
|
|
|
|
* _gfortran_caf_num_images:: Querying the maximal number of images
|
|
|
|
* _gfortran_caf_register:: Registering coarrays
|
|
|
|
* _gfortran_caf_deregister:: Deregistering coarrays
|
2016-11-30 14:27:49 +01:00
|
|
|
* _gfortran_caf_is_present:: Query whether an allocatable component in a derived type coarray is allocated
|
2014-08-14 20:35:01 +02:00
|
|
|
* _gfortran_caf_send:: Sending data from a local image to a remote image
|
|
|
|
* _gfortran_caf_get:: Getting data from a remote image
|
|
|
|
* _gfortran_caf_sendget:: Sending data between remote images
|
2016-09-19 15:45:40 +02:00
|
|
|
* _gfortran_caf_send_by_ref:: Sending data from a local image to a remote image using enhanced references
|
|
|
|
* _gfortran_caf_get_by_ref:: Getting data from a remote image using enhanced references
|
|
|
|
* _gfortran_caf_sendget_by_ref:: Sending data between remote images using enhanced references
|
gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
gcc/fortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
(_gfortran_caf_register): Update for locking/critical.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* resolve.c (resolve_critical): New.
(gfc_resolve_code): Call it.
* trans-decl.c (gfor_fndecl_caf_critical,
gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
(gfc_build_builtin_function_decls): Remove critical,
assign locking declarations.
(generate_coarray_sym_init): Handle locking and
critical variables.
* trans-stmt.c (gfc_trans_critical): Add calls to
lock/unlock libcaf functions.
* trans.h (gfc_coarray_type): Update locking, add
critical enum values.
(gfor_fndecl_caf_critical, gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
libgfortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* caf/libcaf.h (caf_register_t): Update for critical.
(_gfortran_caf_critical, _gfortran_caf_end_critical): Remove.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* caf/single.c (_gfortran_caf_register): Handle locking
variables.
(_gfortran_caf_sendget): Re-name args for consistency.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
From-SVN: r213979
2014-08-14 20:39:15 +02:00
|
|
|
* _gfortran_caf_lock:: Locking a lock variable
|
|
|
|
* _gfortran_caf_unlock:: Unlocking a lock variable
|
check.c (gfc_check_event_query): New function.
2015-12-02 Tobias Burnus <burnus@net-b.de>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* check.c (gfc_check_event_query): New function.
* dump-parse-tree.c (show_code_node): Handle EXEC_EVENT_POST,
EXEC_EVENT_WAIT.
* expr.c (gfc_check_vardef_context): New check for event variables
definition.
* gfortran.h (gfc_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(gfc_isym_id): GFC_ISYM_EVENT_QUERY.
(struct symbol_attribute): New field.
(gfc_exec_op): Add EXEC_EVENT_POST and EXEC_EVENT_WAIT.
* gfortran.texi: Document about new events functions and minor
changes.
* interface.c (compare_parameter): New check.
(gfc_procedure_use): New check for explicit procedure interface.
(add_subroutines): Add event_query.
* intrinsic.h (gfc_check_event_query,gfc_resolve_event_query):
New prototypes.
* iresolve.c (gfc_resolve_event_query): New function.
* iso-fortran-env.def (event_type): New type.
* match.c (event_statement,gfc_match_event_post,gfc_match_event_wait):
New functions.
(gfc_match_name): New event post and event wait.
* match.h (gfc_match_event_post,gfc_match_event_wait):
New prototypes.
* module.c (ab_attribute): Add AB_EVENT_COMP.
(attr_bits): Likewise.
(mio_symbol_attribute): Handle event_comp attribute.
* parse.c (decode_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(next_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(gfc_ascii_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(parse_derived): Check for event_type components.
* resolve.c (resolve_allocate_expr): Check for event variable def.
(resolve_lock_unlock): Renamed to resolve_lock_unlock_event. It
includes logic for locks and events.
(gfc_resolve_code): Call it.
(gfc_resolve_symbol): New check for event variable to be a corray.
* st.c (gfc_free_statement): Handle new EXEC_EVENT_POST and
EXEC_EVENT_WAIT.
* trans-decl.c (gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
gfor_fndecl_caf_event_query): New global variables.
(generate_coarray_sym_init): Checking for event_type.
(gfc_conv_procedure_call): Check for C bind attribute.
* trans-intrinsic.c (conv_intrinsic_event_query): New function.
(conv_intrinsic_move_alloc): Call it.
* trans-stmt.c (gfc_trans_lock_unlock): Passing address
of actual argument.
(gfc_trans_sync): Likewise.
(gfc_trans_event_post_wait): New function.
* trans-stmt.h (gfc_trans_event_post_wait): New prototype.
* trans-types.c (gfc_get_derived_type): Integer_kind as event_type.
* trans.c (gfc_allocate_using_lib): New argument and logic for events.
(gfc_allocate_allocatable): Passing new argument.
(trans_code): Handle EXEC_EVENT_POST, EXEC_EVENT_WAIT.
* trans.h (gfc_coarray_type): New elements.
(gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
gfor_fndecl_caf_event_query): Declare them.
2015-12-02 Tobias Burnus <burnus@net-b.de>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* gfortran.dg/coarray/event_1.f90: New.
* gfortran.dg/coarray/event_2.f90: New.
Co-Authored-By: Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
From-SVN: r231208
2015-12-02 22:59:05 +01:00
|
|
|
* _gfortran_caf_event_post:: Post an event
|
|
|
|
* _gfortran_caf_event_wait:: Wait that an event occurred
|
|
|
|
* _gfortran_caf_event_query:: Query event count
|
2015-03-21 09:31:17 +01:00
|
|
|
* _gfortran_caf_sync_all:: All-image barrier
|
|
|
|
* _gfortran_caf_sync_images:: Barrier for selected images
|
|
|
|
* _gfortran_caf_sync_memory:: Wait for completion of segment-memory operations
|
|
|
|
* _gfortran_caf_error_stop:: Error termination with exit code
|
|
|
|
* _gfortran_caf_error_stop_str:: Error termination with string
|
|
|
|
* _gfortran_caf_atomic_define:: Atomic variable assignment
|
|
|
|
* _gfortran_caf_atomic_ref:: Atomic variable reference
|
|
|
|
* _gfortran_caf_atomic_cas:: Atomic compare and swap
|
|
|
|
* _gfortran_caf_atomic_op:: Atomic operation
|
2014-10-24 22:52:41 +02:00
|
|
|
* _gfortran_caf_co_broadcast:: Sending data to all images
|
|
|
|
* _gfortran_caf_co_max:: Collective maximum reduction
|
|
|
|
* _gfortran_caf_co_min:: Collective minimum reduction
|
|
|
|
* _gfortran_caf_co_sum:: Collective summing reduction
|
|
|
|
* _gfortran_caf_co_reduce:: Generic collective reduction
|
2014-08-14 20:35:01 +02:00
|
|
|
@end menu
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_caf_init
|
|
|
|
@subsection @code{_gfortran_caf_init} --- Initialiation function
|
|
|
|
@cindex Coarray, _gfortran_caf_init
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
This function is called at startup of the program before the Fortran main
|
|
|
|
program, if the latter has been compiled with @option{-fcoarray=lib}.
|
|
|
|
It takes as arguments the command-line arguments of the program. It is
|
|
|
|
permitted to pass to @code{NULL} pointers as argument; if non-@code{NULL},
|
|
|
|
the library is permitted to modify the arguments.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_init (int *argc, char ***argv)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{argc} @tab intent(inout) An integer pointer with the number of
|
|
|
|
arguments passed to the program or @code{NULL}.
|
|
|
|
@item @var{argv} @tab intent(inout) A pointer to an array of strings with the
|
|
|
|
command-line arguments or @code{NULL}.
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{NOTES}
|
|
|
|
The function is modelled after the initialization function of the Message
|
|
|
|
Passing Interface (MPI) specification. Due to the way coarray registration
|
|
|
|
works, it might not be the first call to the libaray. If the main program is
|
|
|
|
not written in Fortran and only a library uses coarrays, it can happen that
|
|
|
|
this function is never called. Therefore, it is recommended that the library
|
|
|
|
does not rely on the passed arguments and whether the call has been done.
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_caf_finish
|
|
|
|
@subsection @code{_gfortran_caf_finish} --- Finalization function
|
|
|
|
@cindex Coarray, _gfortran_caf_finish
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
This function is called at the end of the Fortran main program, if it has
|
|
|
|
been compiled with the @option{-fcoarray=lib} option.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_finish (void)}
|
|
|
|
|
|
|
|
@item @emph{NOTES}
|
|
|
|
For non-Fortran programs, it is recommended to call the function at the end
|
|
|
|
of the main program. To ensure that the shutdown is also performed for
|
|
|
|
programs where this function is not explicitly invoked, for instance
|
|
|
|
non-Fortran programs or calls to the system's exit() function, the library
|
|
|
|
can use a destructor function. Note that programs can also be terminated
|
|
|
|
using the STOP and ERROR STOP statements; those use different library calls.
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_caf_this_image
|
|
|
|
@subsection @code{_gfortran_caf_this_image} --- Querying the image number
|
|
|
|
@cindex Coarray, _gfortran_caf_this_image
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
This function returns the current image number, which is a positive number.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{int _gfortran_caf_this_image (int distance)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{distance} @tab As specified for the @code{this_image} intrinsic
|
|
|
|
in TS18508. Shall be a nonnegative number.
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{NOTES}
|
|
|
|
If the Fortran intrinsic @code{this_image} is invoked without an argument, which
|
|
|
|
is the only permitted form in Fortran 2008, GCC passes @code{0} as
|
|
|
|
first argument.
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_caf_num_images
|
|
|
|
@subsection @code{_gfortran_caf_num_images} --- Querying the maximal number of images
|
|
|
|
@cindex Coarray, _gfortran_caf_num_images
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
This function returns the number of images in the current team, if
|
|
|
|
@var{distance} is 0 or the number of images in the parent team at the specified
|
|
|
|
distance. If failed is -1, the function returns the number of all images at
|
|
|
|
the specified distance; if it is 0, the function returns the number of
|
|
|
|
nonfailed images, and if it is 1, it returns the number of failed images.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{int _gfortran_caf_num_images(int distance, int failed)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{distance} @tab the distance from this image to the ancestor.
|
|
|
|
Shall be positive.
|
|
|
|
@item @var{failed} @tab shall be -1, 0, or 1
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{NOTES}
|
|
|
|
This function follows TS18508. If the num_image intrinsic has no arguments,
|
|
|
|
the the compiler passes @code{distance=0} and @code{failed=-1} to the function.
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_caf_register
|
|
|
|
@subsection @code{_gfortran_caf_register} --- Registering coarrays
|
2016-09-19 15:45:40 +02:00
|
|
|
@cindex Coarray, _gfortran_caf_register
|
2014-08-14 20:35:01 +02:00
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
2016-09-19 15:45:40 +02:00
|
|
|
Registers memory for a coarray and creates a token to identify the coarray. The
|
|
|
|
routine is called for both coarrays with @code{SAVE} attribute and using an
|
|
|
|
explicit @code{ALLOCATE} statement. If an error occurs and @var{STAT} is a
|
2014-08-14 20:35:01 +02:00
|
|
|
@code{NULL} pointer, the function shall abort with printing an error message
|
|
|
|
and starting the error termination. If no error occurs and @var{STAT} is
|
2016-09-19 15:45:40 +02:00
|
|
|
present, it shall be set to zero. Otherwise, it shall be set to a positive
|
2014-08-14 20:35:01 +02:00
|
|
|
value and, if not-@code{NULL}, @var{ERRMSG} shall be set to a string describing
|
2016-09-19 15:45:40 +02:00
|
|
|
the failure. The routine shall register the memory provided in the
|
|
|
|
@code{DATA}-component of the array descriptor @var{DESC}, when that component
|
|
|
|
is non-@code{NULL}, else it shall allocate sufficient memory and provide a
|
|
|
|
pointer to it in the @code{DATA}-component of @var{DESC}. The array descriptor
|
|
|
|
has rank zero, when a scalar object is to be registered and the array
|
|
|
|
descriptor may be invalid after the call to @code{_gfortran_caf_register}.
|
|
|
|
When an array is to be allocated the descriptor persists.
|
2014-08-14 20:35:01 +02:00
|
|
|
|
gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
gcc/fortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
(_gfortran_caf_register): Update for locking/critical.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* resolve.c (resolve_critical): New.
(gfc_resolve_code): Call it.
* trans-decl.c (gfor_fndecl_caf_critical,
gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
(gfc_build_builtin_function_decls): Remove critical,
assign locking declarations.
(generate_coarray_sym_init): Handle locking and
critical variables.
* trans-stmt.c (gfc_trans_critical): Add calls to
lock/unlock libcaf functions.
* trans.h (gfc_coarray_type): Update locking, add
critical enum values.
(gfor_fndecl_caf_critical, gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
libgfortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* caf/libcaf.h (caf_register_t): Update for critical.
(_gfortran_caf_critical, _gfortran_caf_end_critical): Remove.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* caf/single.c (_gfortran_caf_register): Handle locking
variables.
(_gfortran_caf_sendget): Re-name args for consistency.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
From-SVN: r213979
2014-08-14 20:39:15 +02:00
|
|
|
For @code{CAF_REGTYPE_COARRAY_STATIC} and @code{CAF_REGTYPE_COARRAY_ALLOC},
|
|
|
|
the passed size is the byte size requested. For @code{CAF_REGTYPE_LOCK_STATIC},
|
|
|
|
@code{CAF_REGTYPE_LOCK_ALLOC} and @code{CAF_REGTYPE_CRITICAL} it is the array
|
|
|
|
size or one for a scalar.
|
|
|
|
|
|
|
|
|
2014-08-14 20:35:01 +02:00
|
|
|
@item @emph{Syntax}:
|
2016-09-19 15:45:40 +02:00
|
|
|
@code{void caf_register (size_t size, caf_register_t type, caf_token_t *token,
|
|
|
|
gfc_descriptor_t *desc, int *stat, char *errmsg, int errmsg_len)}
|
2014-08-14 20:35:01 +02:00
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
gcc/fortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
(_gfortran_caf_register): Update for locking/critical.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* resolve.c (resolve_critical): New.
(gfc_resolve_code): Call it.
* trans-decl.c (gfor_fndecl_caf_critical,
gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
(gfc_build_builtin_function_decls): Remove critical,
assign locking declarations.
(generate_coarray_sym_init): Handle locking and
critical variables.
* trans-stmt.c (gfc_trans_critical): Add calls to
lock/unlock libcaf functions.
* trans.h (gfc_coarray_type): Update locking, add
critical enum values.
(gfor_fndecl_caf_critical, gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
libgfortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* caf/libcaf.h (caf_register_t): Update for critical.
(_gfortran_caf_critical, _gfortran_caf_end_critical): Remove.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* caf/single.c (_gfortran_caf_register): Handle locking
variables.
(_gfortran_caf_sendget): Re-name args for consistency.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
From-SVN: r213979
2014-08-14 20:39:15 +02:00
|
|
|
@item @var{size} @tab For normal coarrays, the byte size of the coarray to be
|
check.c (gfc_check_event_query): New function.
2015-12-02 Tobias Burnus <burnus@net-b.de>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* check.c (gfc_check_event_query): New function.
* dump-parse-tree.c (show_code_node): Handle EXEC_EVENT_POST,
EXEC_EVENT_WAIT.
* expr.c (gfc_check_vardef_context): New check for event variables
definition.
* gfortran.h (gfc_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(gfc_isym_id): GFC_ISYM_EVENT_QUERY.
(struct symbol_attribute): New field.
(gfc_exec_op): Add EXEC_EVENT_POST and EXEC_EVENT_WAIT.
* gfortran.texi: Document about new events functions and minor
changes.
* interface.c (compare_parameter): New check.
(gfc_procedure_use): New check for explicit procedure interface.
(add_subroutines): Add event_query.
* intrinsic.h (gfc_check_event_query,gfc_resolve_event_query):
New prototypes.
* iresolve.c (gfc_resolve_event_query): New function.
* iso-fortran-env.def (event_type): New type.
* match.c (event_statement,gfc_match_event_post,gfc_match_event_wait):
New functions.
(gfc_match_name): New event post and event wait.
* match.h (gfc_match_event_post,gfc_match_event_wait):
New prototypes.
* module.c (ab_attribute): Add AB_EVENT_COMP.
(attr_bits): Likewise.
(mio_symbol_attribute): Handle event_comp attribute.
* parse.c (decode_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(next_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(gfc_ascii_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(parse_derived): Check for event_type components.
* resolve.c (resolve_allocate_expr): Check for event variable def.
(resolve_lock_unlock): Renamed to resolve_lock_unlock_event. It
includes logic for locks and events.
(gfc_resolve_code): Call it.
(gfc_resolve_symbol): New check for event variable to be a corray.
* st.c (gfc_free_statement): Handle new EXEC_EVENT_POST and
EXEC_EVENT_WAIT.
* trans-decl.c (gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
gfor_fndecl_caf_event_query): New global variables.
(generate_coarray_sym_init): Checking for event_type.
(gfc_conv_procedure_call): Check for C bind attribute.
* trans-intrinsic.c (conv_intrinsic_event_query): New function.
(conv_intrinsic_move_alloc): Call it.
* trans-stmt.c (gfc_trans_lock_unlock): Passing address
of actual argument.
(gfc_trans_sync): Likewise.
(gfc_trans_event_post_wait): New function.
* trans-stmt.h (gfc_trans_event_post_wait): New prototype.
* trans-types.c (gfc_get_derived_type): Integer_kind as event_type.
* trans.c (gfc_allocate_using_lib): New argument and logic for events.
(gfc_allocate_allocatable): Passing new argument.
(trans_code): Handle EXEC_EVENT_POST, EXEC_EVENT_WAIT.
* trans.h (gfc_coarray_type): New elements.
(gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
gfor_fndecl_caf_event_query): Declare them.
2015-12-02 Tobias Burnus <burnus@net-b.de>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* gfortran.dg/coarray/event_1.f90: New.
* gfortran.dg/coarray/event_2.f90: New.
Co-Authored-By: Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
From-SVN: r231208
2015-12-02 22:59:05 +01:00
|
|
|
allocated; for lock types and event types, the number of elements.
|
2014-08-14 20:35:01 +02:00
|
|
|
@item @var{type} @tab one of the caf_register_t types.
|
|
|
|
@item @var{token} @tab intent(out) An opaque pointer identifying the coarray.
|
2016-09-19 15:45:40 +02:00
|
|
|
@item @var{desc} @tab intent(inout) The (pseudo) array descriptor.
|
gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
gcc/fortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
(_gfortran_caf_register): Update for locking/critical.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* resolve.c (resolve_critical): New.
(gfc_resolve_code): Call it.
* trans-decl.c (gfor_fndecl_caf_critical,
gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
(gfc_build_builtin_function_decls): Remove critical,
assign locking declarations.
(generate_coarray_sym_init): Handle locking and
critical variables.
* trans-stmt.c (gfc_trans_critical): Add calls to
lock/unlock libcaf functions.
* trans.h (gfc_coarray_type): Update locking, add
critical enum values.
(gfor_fndecl_caf_critical, gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
libgfortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* caf/libcaf.h (caf_register_t): Update for critical.
(_gfortran_caf_critical, _gfortran_caf_end_critical): Remove.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* caf/single.c (_gfortran_caf_register): Handle locking
variables.
(_gfortran_caf_sendget): Re-name args for consistency.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
From-SVN: r213979
2014-08-14 20:39:15 +02:00
|
|
|
@item @var{stat} @tab intent(out) For allocatable coarrays, stores the STAT=;
|
|
|
|
may be NULL
|
|
|
|
@item @var{errmsg} @tab intent(out) When an error occurs, this will be set to
|
|
|
|
an error message; may be NULL
|
2014-08-14 20:35:01 +02:00
|
|
|
@item @var{errmsg_len} @tab the buffer size of errmsg.
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{NOTES}
|
|
|
|
Nonalloatable coarrays have to be registered prior use from remote images.
|
|
|
|
In order to guarantee this, they have to be registered before the main
|
|
|
|
program. This can be achieved by creating constructor functions. That is what
|
|
|
|
GCC does such that also nonallocatable coarrays the memory is allocated and no
|
|
|
|
static memory is used. The token permits to identify the coarray; to the
|
|
|
|
processor, the token is a nonaliasing pointer. The library can, for instance,
|
|
|
|
store the base address of the coarray in the token, some handle or a more
|
2016-09-19 15:45:40 +02:00
|
|
|
complicated struct. The library may also store the array descriptor
|
|
|
|
@var{DESC} when its rank is non-zero.
|
gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
gcc/fortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
(_gfortran_caf_register): Update for locking/critical.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* resolve.c (resolve_critical): New.
(gfc_resolve_code): Call it.
* trans-decl.c (gfor_fndecl_caf_critical,
gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
(gfc_build_builtin_function_decls): Remove critical,
assign locking declarations.
(generate_coarray_sym_init): Handle locking and
critical variables.
* trans-stmt.c (gfc_trans_critical): Add calls to
lock/unlock libcaf functions.
* trans.h (gfc_coarray_type): Update locking, add
critical enum values.
(gfor_fndecl_caf_critical, gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
libgfortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* caf/libcaf.h (caf_register_t): Update for critical.
(_gfortran_caf_critical, _gfortran_caf_end_critical): Remove.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* caf/single.c (_gfortran_caf_register): Handle locking
variables.
(_gfortran_caf_sendget): Re-name args for consistency.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
From-SVN: r213979
2014-08-14 20:39:15 +02:00
|
|
|
|
2016-09-19 15:45:40 +02:00
|
|
|
For lock types, the value shall only used for checking the allocation
|
gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
gcc/fortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
(_gfortran_caf_register): Update for locking/critical.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* resolve.c (resolve_critical): New.
(gfc_resolve_code): Call it.
* trans-decl.c (gfor_fndecl_caf_critical,
gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
(gfc_build_builtin_function_decls): Remove critical,
assign locking declarations.
(generate_coarray_sym_init): Handle locking and
critical variables.
* trans-stmt.c (gfc_trans_critical): Add calls to
lock/unlock libcaf functions.
* trans.h (gfc_coarray_type): Update locking, add
critical enum values.
(gfor_fndecl_caf_critical, gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
libgfortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* caf/libcaf.h (caf_register_t): Update for critical.
(_gfortran_caf_critical, _gfortran_caf_end_critical): Remove.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* caf/single.c (_gfortran_caf_register): Handle locking
variables.
(_gfortran_caf_sendget): Re-name args for consistency.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
From-SVN: r213979
2014-08-14 20:39:15 +02:00
|
|
|
status. Note that for critical blocks, the locking is only required on one
|
2016-09-19 15:45:40 +02:00
|
|
|
image; in the locking statement, the processor shall always pass an
|
gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
gcc/fortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
(_gfortran_caf_register): Update for locking/critical.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* resolve.c (resolve_critical): New.
(gfc_resolve_code): Call it.
* trans-decl.c (gfor_fndecl_caf_critical,
gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
(gfc_build_builtin_function_decls): Remove critical,
assign locking declarations.
(generate_coarray_sym_init): Handle locking and
critical variables.
* trans-stmt.c (gfc_trans_critical): Add calls to
lock/unlock libcaf functions.
* trans.h (gfc_coarray_type): Update locking, add
critical enum values.
(gfor_fndecl_caf_critical, gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
libgfortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* caf/libcaf.h (caf_register_t): Update for critical.
(_gfortran_caf_critical, _gfortran_caf_end_critical): Remove.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* caf/single.c (_gfortran_caf_register): Handle locking
variables.
(_gfortran_caf_sendget): Re-name args for consistency.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
From-SVN: r213979
2014-08-14 20:39:15 +02:00
|
|
|
image index of one for critical-block lock variables
|
check.c (gfc_check_event_query): New function.
2015-12-02 Tobias Burnus <burnus@net-b.de>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* check.c (gfc_check_event_query): New function.
* dump-parse-tree.c (show_code_node): Handle EXEC_EVENT_POST,
EXEC_EVENT_WAIT.
* expr.c (gfc_check_vardef_context): New check for event variables
definition.
* gfortran.h (gfc_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(gfc_isym_id): GFC_ISYM_EVENT_QUERY.
(struct symbol_attribute): New field.
(gfc_exec_op): Add EXEC_EVENT_POST and EXEC_EVENT_WAIT.
* gfortran.texi: Document about new events functions and minor
changes.
* interface.c (compare_parameter): New check.
(gfc_procedure_use): New check for explicit procedure interface.
(add_subroutines): Add event_query.
* intrinsic.h (gfc_check_event_query,gfc_resolve_event_query):
New prototypes.
* iresolve.c (gfc_resolve_event_query): New function.
* iso-fortran-env.def (event_type): New type.
* match.c (event_statement,gfc_match_event_post,gfc_match_event_wait):
New functions.
(gfc_match_name): New event post and event wait.
* match.h (gfc_match_event_post,gfc_match_event_wait):
New prototypes.
* module.c (ab_attribute): Add AB_EVENT_COMP.
(attr_bits): Likewise.
(mio_symbol_attribute): Handle event_comp attribute.
* parse.c (decode_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(next_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(gfc_ascii_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(parse_derived): Check for event_type components.
* resolve.c (resolve_allocate_expr): Check for event variable def.
(resolve_lock_unlock): Renamed to resolve_lock_unlock_event. It
includes logic for locks and events.
(gfc_resolve_code): Call it.
(gfc_resolve_symbol): New check for event variable to be a corray.
* st.c (gfc_free_statement): Handle new EXEC_EVENT_POST and
EXEC_EVENT_WAIT.
* trans-decl.c (gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
gfor_fndecl_caf_event_query): New global variables.
(generate_coarray_sym_init): Checking for event_type.
(gfc_conv_procedure_call): Check for C bind attribute.
* trans-intrinsic.c (conv_intrinsic_event_query): New function.
(conv_intrinsic_move_alloc): Call it.
* trans-stmt.c (gfc_trans_lock_unlock): Passing address
of actual argument.
(gfc_trans_sync): Likewise.
(gfc_trans_event_post_wait): New function.
* trans-stmt.h (gfc_trans_event_post_wait): New prototype.
* trans-types.c (gfc_get_derived_type): Integer_kind as event_type.
* trans.c (gfc_allocate_using_lib): New argument and logic for events.
(gfc_allocate_allocatable): Passing new argument.
(trans_code): Handle EXEC_EVENT_POST, EXEC_EVENT_WAIT.
* trans.h (gfc_coarray_type): New elements.
(gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
gfor_fndecl_caf_event_query): Declare them.
2015-12-02 Tobias Burnus <burnus@net-b.de>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* gfortran.dg/coarray/event_1.f90: New.
* gfortran.dg/coarray/event_2.f90: New.
Co-Authored-By: Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
From-SVN: r231208
2015-12-02 22:59:05 +01:00
|
|
|
(@code{CAF_REGTYPE_CRITICAL}). For lock types and critical-block variables,
|
|
|
|
the initial value shall be unlocked (or, respecitively, not in critical
|
|
|
|
section) such as the value false; for event types, the initial state should
|
|
|
|
be no event, e.g. zero.
|
2014-08-14 20:35:01 +02:00
|
|
|
@end table
|
|
|
|
|
2016-11-30 14:27:49 +01:00
|
|
|
|
2014-08-14 20:35:01 +02:00
|
|
|
@node _gfortran_caf_deregister
|
|
|
|
@subsection @code{_gfortran_caf_deregister} --- Deregistering coarrays
|
|
|
|
@cindex Coarray, _gfortran_caf_deregister
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Called to free the memory of a coarray; the processor calls this function for
|
|
|
|
automatic and explicit deallocation. In case of an error, this function shall
|
2016-09-19 15:45:40 +02:00
|
|
|
fail with an error message, unless the @var{STAT} variable is not null. The
|
|
|
|
library is only expected to free memory it allocated itself during a call to
|
|
|
|
@code{_gfortran_caf_register}.
|
2014-08-14 20:35:01 +02:00
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
2016-11-30 14:27:49 +01:00
|
|
|
@code{void caf_deregister (caf_token_t *token, caf_deregister_t type,
|
|
|
|
int *stat, char *errmsg, int errmsg_len)}
|
2014-08-14 20:35:01 +02:00
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
2016-09-19 15:45:40 +02:00
|
|
|
@item @var{token} @tab the token to free.
|
2016-11-30 14:27:49 +01:00
|
|
|
@item @var{type} @tab the type of action to take for the coarray. A
|
|
|
|
@code{CAF_DEREGTYPE_COARRAY_DEALLOCATE_ONLY} is allowed only for allocatable
|
|
|
|
components of derived type coarrays. The action only deallocates the local
|
|
|
|
memory without deleting the token.
|
check.c (gfc_check_event_query): New function.
2015-12-02 Tobias Burnus <burnus@net-b.de>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* check.c (gfc_check_event_query): New function.
* dump-parse-tree.c (show_code_node): Handle EXEC_EVENT_POST,
EXEC_EVENT_WAIT.
* expr.c (gfc_check_vardef_context): New check for event variables
definition.
* gfortran.h (gfc_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(gfc_isym_id): GFC_ISYM_EVENT_QUERY.
(struct symbol_attribute): New field.
(gfc_exec_op): Add EXEC_EVENT_POST and EXEC_EVENT_WAIT.
* gfortran.texi: Document about new events functions and minor
changes.
* interface.c (compare_parameter): New check.
(gfc_procedure_use): New check for explicit procedure interface.
(add_subroutines): Add event_query.
* intrinsic.h (gfc_check_event_query,gfc_resolve_event_query):
New prototypes.
* iresolve.c (gfc_resolve_event_query): New function.
* iso-fortran-env.def (event_type): New type.
* match.c (event_statement,gfc_match_event_post,gfc_match_event_wait):
New functions.
(gfc_match_name): New event post and event wait.
* match.h (gfc_match_event_post,gfc_match_event_wait):
New prototypes.
* module.c (ab_attribute): Add AB_EVENT_COMP.
(attr_bits): Likewise.
(mio_symbol_attribute): Handle event_comp attribute.
* parse.c (decode_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(next_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(gfc_ascii_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(parse_derived): Check for event_type components.
* resolve.c (resolve_allocate_expr): Check for event variable def.
(resolve_lock_unlock): Renamed to resolve_lock_unlock_event. It
includes logic for locks and events.
(gfc_resolve_code): Call it.
(gfc_resolve_symbol): New check for event variable to be a corray.
* st.c (gfc_free_statement): Handle new EXEC_EVENT_POST and
EXEC_EVENT_WAIT.
* trans-decl.c (gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
gfor_fndecl_caf_event_query): New global variables.
(generate_coarray_sym_init): Checking for event_type.
(gfc_conv_procedure_call): Check for C bind attribute.
* trans-intrinsic.c (conv_intrinsic_event_query): New function.
(conv_intrinsic_move_alloc): Call it.
* trans-stmt.c (gfc_trans_lock_unlock): Passing address
of actual argument.
(gfc_trans_sync): Likewise.
(gfc_trans_event_post_wait): New function.
* trans-stmt.h (gfc_trans_event_post_wait): New prototype.
* trans-types.c (gfc_get_derived_type): Integer_kind as event_type.
* trans.c (gfc_allocate_using_lib): New argument and logic for events.
(gfc_allocate_allocatable): Passing new argument.
(trans_code): Handle EXEC_EVENT_POST, EXEC_EVENT_WAIT.
* trans.h (gfc_coarray_type): New elements.
(gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
gfor_fndecl_caf_event_query): Declare them.
2015-12-02 Tobias Burnus <burnus@net-b.de>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* gfortran.dg/coarray/event_1.f90: New.
* gfortran.dg/coarray/event_2.f90: New.
Co-Authored-By: Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
From-SVN: r231208
2015-12-02 22:59:05 +01:00
|
|
|
@item @var{stat} @tab intent(out) Stores the STAT=; may be NULL
|
gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
gcc/fortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
(_gfortran_caf_register): Update for locking/critical.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* resolve.c (resolve_critical): New.
(gfc_resolve_code): Call it.
* trans-decl.c (gfor_fndecl_caf_critical,
gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
(gfc_build_builtin_function_decls): Remove critical,
assign locking declarations.
(generate_coarray_sym_init): Handle locking and
critical variables.
* trans-stmt.c (gfc_trans_critical): Add calls to
lock/unlock libcaf functions.
* trans.h (gfc_coarray_type): Update locking, add
critical enum values.
(gfor_fndecl_caf_critical, gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
libgfortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* caf/libcaf.h (caf_register_t): Update for critical.
(_gfortran_caf_critical, _gfortran_caf_end_critical): Remove.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* caf/single.c (_gfortran_caf_register): Handle locking
variables.
(_gfortran_caf_sendget): Re-name args for consistency.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
From-SVN: r213979
2014-08-14 20:39:15 +02:00
|
|
|
@item @var{errmsg} @tab intent(out) When an error occurs, this will be set
|
|
|
|
to an error message; may be NULL
|
2014-08-14 20:35:01 +02:00
|
|
|
@item @var{errmsg_len} @tab the buffer size of errmsg.
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{NOTES}
|
|
|
|
For nonalloatable coarrays this function is never called. If a cleanup is
|
|
|
|
required, it has to be handled via the finish, stop and error stop functions,
|
|
|
|
and via destructors.
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
2016-11-30 14:27:49 +01:00
|
|
|
@node _gfortran_caf_is_present
|
|
|
|
@subsection @code{_gfortran_caf_is_present} --- Query whether an allocatable component in a derived type coarray is allocated
|
|
|
|
@cindex Coarray, _gfortran_caf_is_present
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Used to query the coarray library whether an allocatable component in a derived
|
|
|
|
type coarray is allocated on a remote image.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_is_present (caf_token_t token, int image_index,
|
|
|
|
gfc_reference_t *ref)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{token} @tab An opaque pointer identifying the coarray.
|
|
|
|
@item @var{image_index} @tab The ID of the remote image; must be a positive
|
|
|
|
number.
|
|
|
|
@item @var{ref} @tab A chain of references to address the allocatable component
|
|
|
|
in the derived type coarray. The object reffed needs to be a scalar or a full
|
|
|
|
array ref, respectively.
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@end table
|
|
|
|
|
2014-08-14 20:35:01 +02:00
|
|
|
@node _gfortran_caf_send
|
|
|
|
@subsection @code{_gfortran_caf_send} --- Sending data from a local image to a remote image
|
|
|
|
@cindex Coarray, _gfortran_caf_send
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Called to send a scalar, an array section or whole array from a local
|
|
|
|
to a remote image identified by the image_index.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_send (caf_token_t token, size_t offset,
|
|
|
|
int image_index, gfc_descriptor_t *dest, caf_vector_t *dst_vector,
|
2014-08-31 08:32:06 +02:00
|
|
|
gfc_descriptor_t *src, int dst_kind, int src_kind, bool may_require_tmp)}
|
2014-08-14 20:35:01 +02:00
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{token} @tab intent(in) An opaque pointer identifying the coarray.
|
|
|
|
@item @var{offset} @tab By which amount of bytes the actual data is shifted
|
|
|
|
compared to the base address of the coarray.
|
|
|
|
@item @var{image_index} @tab The ID of the remote image; must be a positive
|
|
|
|
number.
|
|
|
|
@item @var{dest} @tab intent(in) Array descriptor for the remote image for the
|
|
|
|
bounds and the size. The base_addr shall not be accessed.
|
2016-07-22 11:46:54 +02:00
|
|
|
@item @var{dst_vector} @tab intent(in) If not NULL, it contains the vector
|
2014-08-14 20:35:01 +02:00
|
|
|
subscript of the destination array; the values are relative to the dimension
|
|
|
|
triplet of the dest argument.
|
|
|
|
@item @var{src} @tab intent(in) Array descriptor of the local array to be
|
|
|
|
transferred to the remote image
|
|
|
|
@item @var{dst_kind} @tab Kind of the destination argument
|
|
|
|
@item @var{src_kind} @tab Kind of the source argument
|
2014-08-31 08:32:06 +02:00
|
|
|
@item @var{may_require_tmp} @tab The variable is false it is known at compile
|
|
|
|
time that the @var{dest} and @var{src} either cannot overlap or overlap (fully
|
|
|
|
or partially) such that walking @var{src} and @var{dest} in element wise
|
|
|
|
element order (honoring the stride value) will not lead to wrong results.
|
|
|
|
Otherwise, the value is true.
|
2014-08-14 20:35:01 +02:00
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{NOTES}
|
|
|
|
It is permitted to have image_id equal the current image; the memory of the
|
|
|
|
send-to and the send-from might (partially) overlap in that case. The
|
2014-08-31 08:32:06 +02:00
|
|
|
implementation has to take care that it handles this case, e.g. using
|
|
|
|
@code{memmove} which handles (partially) overlapping memory. If
|
|
|
|
@var{may_require_tmp} is true, the library might additionally create a
|
|
|
|
temporary variable, unless additional checks show that this is not required
|
|
|
|
(e.g. because walking backward is possible or because both arrays are
|
|
|
|
contiguous and @code{memmove} takes care of overlap issues).
|
|
|
|
|
|
|
|
Note that the assignment of a scalar to an array is permitted. In addition,
|
|
|
|
the library has to handle numeric-type conversion and for strings, padding
|
|
|
|
and different character kinds.
|
2014-08-14 20:35:01 +02:00
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_caf_get
|
|
|
|
@subsection @code{_gfortran_caf_get} --- Getting data from a remote image
|
|
|
|
@cindex Coarray, _gfortran_caf_get
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Called to get an array section or whole array from a a remote,
|
|
|
|
image identified by the image_index.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
2016-07-22 11:46:54 +02:00
|
|
|
@code{void _gfortran_caf_get (caf_token_t token, size_t offset,
|
2014-08-14 20:35:01 +02:00
|
|
|
int image_index, gfc_descriptor_t *src, caf_vector_t *src_vector,
|
2014-08-31 08:32:06 +02:00
|
|
|
gfc_descriptor_t *dest, int src_kind, int dst_kind, bool may_require_tmp)}
|
2014-08-14 20:35:01 +02:00
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{token} @tab intent(in) An opaque pointer identifying the coarray.
|
|
|
|
@item @var{offset} @tab By which amount of bytes the actual data is shifted
|
|
|
|
compared to the base address of the coarray.
|
|
|
|
@item @var{image_index} @tab The ID of the remote image; must be a positive
|
|
|
|
number.
|
2016-07-22 11:46:54 +02:00
|
|
|
@item @var{dest} @tab intent(out) Array descriptor of the local array to store
|
|
|
|
the data transferred from the remote image
|
2014-08-14 20:35:01 +02:00
|
|
|
@item @var{src} @tab intent(in) Array descriptor for the remote image for the
|
|
|
|
bounds and the size. The base_addr shall not be accessed.
|
2016-07-22 11:46:54 +02:00
|
|
|
@item @var{src_vector} @tab intent(in) If not NULL, it contains the vector
|
|
|
|
subscript of the source array; the values are relative to the dimension
|
|
|
|
triplet of the src argument.
|
2014-08-14 20:35:01 +02:00
|
|
|
@item @var{dst_kind} @tab Kind of the destination argument
|
|
|
|
@item @var{src_kind} @tab Kind of the source argument
|
2014-08-31 08:32:06 +02:00
|
|
|
@item @var{may_require_tmp} @tab The variable is false it is known at compile
|
|
|
|
time that the @var{dest} and @var{src} either cannot overlap or overlap (fully
|
|
|
|
or partially) such that walking @var{src} and @var{dest} in element wise
|
|
|
|
element order (honoring the stride value) will not lead to wrong results.
|
|
|
|
Otherwise, the value is true.
|
2014-08-14 20:35:01 +02:00
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{NOTES}
|
|
|
|
It is permitted to have image_id equal the current image; the memory of the
|
|
|
|
send-to and the send-from might (partially) overlap in that case. The
|
2014-08-31 08:32:06 +02:00
|
|
|
implementation has to take care that it handles this case, e.g. using
|
|
|
|
@code{memmove} which handles (partially) overlapping memory. If
|
|
|
|
@var{may_require_tmp} is true, the library might additionally create a
|
|
|
|
temporary variable, unless additional checks show that this is not required
|
|
|
|
(e.g. because walking backward is possible or because both arrays are
|
|
|
|
contiguous and @code{memmove} takes care of overlap issues).
|
|
|
|
|
|
|
|
Note that the library has to handle numeric-type conversion and for strings,
|
|
|
|
padding and different character kinds.
|
2014-08-14 20:35:01 +02:00
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_caf_sendget
|
|
|
|
@subsection @code{_gfortran_caf_sendget} --- Sending data between remote images
|
|
|
|
@cindex Coarray, _gfortran_caf_sendget
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Called to send a scalar, an array section or whole array from a remote image
|
|
|
|
identified by the src_image_index to a remote image identified by the
|
|
|
|
dst_image_index.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_sendget (caf_token_t dst_token, size_t dst_offset,
|
|
|
|
int dst_image_index, gfc_descriptor_t *dest, caf_vector_t *dst_vector,
|
|
|
|
caf_token_t src_token, size_t src_offset, int src_image_index,
|
2014-08-31 08:32:06 +02:00
|
|
|
gfc_descriptor_t *src, caf_vector_t *src_vector, int dst_kind, int src_kind,
|
|
|
|
bool may_require_tmp)}
|
2014-08-14 20:35:01 +02:00
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{dst_token} @tab intent(in) An opaque pointer identifying the
|
|
|
|
destination coarray.
|
|
|
|
@item @var{dst_offset} @tab By which amount of bytes the actual data is
|
|
|
|
shifted compared to the base address of the destination coarray.
|
|
|
|
@item @var{dst_image_index} @tab The ID of the destination remote image; must
|
|
|
|
be a positive number.
|
2014-08-31 08:32:06 +02:00
|
|
|
@item @var{dest} @tab intent(in) Array descriptor for the destination
|
2014-08-14 20:35:01 +02:00
|
|
|
remote image for the bounds and the size. The base_addr shall not be accessed.
|
|
|
|
@item @var{dst_vector} @tab intent(int) If not NULL, it contains the vector
|
|
|
|
subscript of the destination array; the values are relative to the dimension
|
|
|
|
triplet of the dest argument.
|
|
|
|
@item @var{src_token} @tab An opaque pointer identifying the source coarray.
|
|
|
|
@item @var{src_offset} @tab By which amount of bytes the actual data is shifted
|
|
|
|
compared to the base address of the source coarray.
|
|
|
|
@item @var{src_image_index} @tab The ID of the source remote image; must be a
|
|
|
|
positive number.
|
2014-08-31 08:32:06 +02:00
|
|
|
@item @var{src} @tab intent(in) Array descriptor of the local array to be
|
2014-08-14 20:35:01 +02:00
|
|
|
transferred to the remote image.
|
|
|
|
@item @var{src_vector} @tab intent(in) Array descriptor of the local array to
|
|
|
|
be transferred to the remote image
|
|
|
|
@item @var{dst_kind} @tab Kind of the destination argument
|
|
|
|
@item @var{src_kind} @tab Kind of the source argument
|
2014-08-31 08:32:06 +02:00
|
|
|
@item @var{may_require_tmp} @tab The variable is false it is known at compile
|
|
|
|
time that the @var{dest} and @var{src} either cannot overlap or overlap (fully
|
|
|
|
or partially) such that walking @var{src} and @var{dest} in element wise
|
|
|
|
element order (honoring the stride value) will not lead to wrong results.
|
|
|
|
Otherwise, the value is true.
|
2014-08-14 20:35:01 +02:00
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{NOTES}
|
2014-08-31 08:32:06 +02:00
|
|
|
It is permitted to have image_ids equal; the memory of the send-to and the
|
|
|
|
send-from might (partially) overlap in that case. The implementation has to
|
|
|
|
take care that it handles this case, e.g. using @code{memmove} which handles
|
|
|
|
(partially) overlapping memory. If @var{may_require_tmp} is true, the library
|
|
|
|
might additionally create a temporary variable, unless additional checks show
|
|
|
|
that this is not required (e.g. because walking backward is possible or because
|
|
|
|
both arrays are contiguous and @code{memmove} takes care of overlap issues).
|
|
|
|
|
|
|
|
Note that the assignment of a scalar to an array is permitted. In addition,
|
|
|
|
the library has to handle numeric-type conversion and for strings, padding and
|
|
|
|
different character kinds.
|
2014-08-14 20:35:01 +02:00
|
|
|
@end table
|
|
|
|
|
2016-09-19 15:45:40 +02:00
|
|
|
@node _gfortran_caf_send_by_ref
|
|
|
|
@subsection @code{_gfortran_caf_send_by_ref} --- Sending data from a local image to a remote image with enhanced referencing options
|
|
|
|
@cindex Coarray, _gfortran_caf_send_by_ref
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Called to send a scalar, an array section or whole array from a local to a
|
|
|
|
remote image identified by the image_index.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_send_by_ref (caf_token_t token, int image_index,
|
|
|
|
gfc_descriptor_t *src, caf_reference_t *refs, int dst_kind, int src_kind,
|
|
|
|
bool may_require_tmp, bool dst_reallocatable, int *stat)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{token} @tab intent(in) An opaque pointer identifying the coarray.
|
|
|
|
@item @var{image_index} @tab The ID of the remote image; must be a positive
|
|
|
|
number.
|
|
|
|
@item @var{src} @tab intent(in) Array descriptor of the local array to be
|
|
|
|
transferred to the remote image
|
|
|
|
@item @var{refs} @tab intent(in) the references on the remote array to store
|
|
|
|
the data given by src. Guaranteed to have at least one entry.
|
|
|
|
@item @var{dst_kind} @tab Kind of the destination argument
|
|
|
|
@item @var{src_kind} @tab Kind of the source argument
|
|
|
|
@item @var{may_require_tmp} @tab The variable is false it is known at compile
|
|
|
|
time that the @var{dest} and @var{src} either cannot overlap or overlap (fully
|
|
|
|
or partially) such that walking @var{src} and @var{dest} in element wise
|
|
|
|
element order (honoring the stride value) will not lead to wrong results.
|
|
|
|
Otherwise, the value is true.
|
|
|
|
@item @var{dst_reallocatable} @tab set when the destination is of allocatable
|
|
|
|
or pointer type and the refs will allow reallocation, i.e., the ref is a full
|
|
|
|
array or component ref.
|
|
|
|
@item @var{stat} @tab intent(out) when non-@code{NULL} give the result of the
|
|
|
|
operation, i.e., zero on success and non-zero on error. When @code{NULL} and
|
|
|
|
error occurs, then an error message is printed and the program is terminated.
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{NOTES}
|
|
|
|
It is permitted to have image_id equal the current image; the memory of the
|
|
|
|
send-to and the send-from might (partially) overlap in that case. The
|
|
|
|
implementation has to take care that it handles this case, e.g. using
|
|
|
|
@code{memmove} which handles (partially) overlapping memory. If
|
|
|
|
@var{may_require_tmp} is true, the library might additionally create a
|
|
|
|
temporary variable, unless additional checks show that this is not required
|
|
|
|
(e.g. because walking backward is possible or because both arrays are
|
|
|
|
contiguous and @code{memmove} takes care of overlap issues).
|
|
|
|
|
|
|
|
Note that the assignment of a scalar to an array is permitted. In addition,
|
|
|
|
the library has to handle numeric-type conversion and for strings, padding
|
|
|
|
and different character kinds.
|
|
|
|
|
|
|
|
Because of the more complicated references possible some operations may be
|
|
|
|
unsupported by certain libraries. The library is expected to issue a precise
|
|
|
|
error message why the operation is not permitted.
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_caf_get_by_ref
|
|
|
|
@subsection @code{_gfortran_caf_get_by_ref} --- Getting data from a remote image using enhanced references
|
|
|
|
@cindex Coarray, _gfortran_caf_get_by_ref
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Called to get a scalar, an array section or whole array from a a remote image
|
|
|
|
identified by the image_index.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_get_by_ref (caf_token_t token, int image_index,
|
|
|
|
caf_reference_t *refs, gfc_descriptor_t *dst, int dst_kind, int src_kind,
|
|
|
|
bool may_require_tmp, bool dst_reallocatable, int *stat)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{token} @tab intent(in) An opaque pointer identifying the coarray.
|
|
|
|
@item @var{image_index} @tab The ID of the remote image; must be a positive
|
|
|
|
number.
|
|
|
|
@item @var{refs} @tab intent(in) the references to apply to the remote structure
|
|
|
|
to get the data.
|
|
|
|
@item @var{dst} @tab intent(in) Array descriptor of the local array to store
|
|
|
|
the data transferred from the remote image. May be reallocated where needed
|
|
|
|
and when @var{DST_REALLOCATABLE} allows it.
|
|
|
|
@item @var{dst_kind} @tab Kind of the destination argument
|
|
|
|
@item @var{src_kind} @tab Kind of the source argument
|
|
|
|
@item @var{may_require_tmp} @tab The variable is false it is known at compile
|
|
|
|
time that the @var{dest} and @var{src} either cannot overlap or overlap (fully
|
|
|
|
or partially) such that walking @var{src} and @var{dest} in element wise
|
|
|
|
element order (honoring the stride value) will not lead to wrong results.
|
|
|
|
Otherwise, the value is true.
|
|
|
|
@item @var{dst_reallocatable} @tab set when @var{DST} is of allocatable
|
|
|
|
or pointer type and its refs allow reallocation, i.e., the full array or a
|
|
|
|
component is referenced.
|
|
|
|
@item @var{stat} @tab intent(out) when non-@code{NULL} give the result of the
|
|
|
|
operation, i.e., zero on success and non-zero on error. When @code{NULL} and
|
|
|
|
error occurs, then an error message is printed and the program is terminated.
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{NOTES}
|
|
|
|
It is permitted to have image_id equal the current image; the memory of the
|
|
|
|
send-to and the send-from might (partially) overlap in that case. The
|
|
|
|
implementation has to take care that it handles this case, e.g. using
|
|
|
|
@code{memmove} which handles (partially) overlapping memory. If
|
|
|
|
@var{may_require_tmp} is true, the library might additionally create a
|
|
|
|
temporary variable, unless additional checks show that this is not required
|
|
|
|
(e.g. because walking backward is possible or because both arrays are
|
|
|
|
contiguous and @code{memmove} takes care of overlap issues).
|
|
|
|
|
|
|
|
Note that the library has to handle numeric-type conversion and for strings,
|
|
|
|
padding and different character kinds.
|
|
|
|
|
|
|
|
Because of the more complicated references possible some operations may be
|
|
|
|
unsupported by certain libraries. The library is expected to issue a precise
|
|
|
|
error message why the operation is not permitted.
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_caf_sendget_by_ref
|
|
|
|
@subsection @code{_gfortran_caf_sendget_by_ref} --- Sending data between remote images using enhanced references on both sides
|
|
|
|
@cindex Coarray, _gfortran_caf_sendget_by_ref
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Called to send a scalar, an array section or whole array from a remote image
|
|
|
|
identified by the src_image_index to a remote image identified by the
|
|
|
|
dst_image_index.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_sendget_by_ref (caf_token_t dst_token,
|
|
|
|
int dst_image_index, caf_reference_t *dst_refs,
|
|
|
|
caf_token_t src_token, int src_image_index, caf_reference_t *src_refs,
|
|
|
|
int dst_kind, int src_kind, bool may_require_tmp, int *dst_stat, int *src_stat)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{dst_token} @tab intent(in) An opaque pointer identifying the
|
|
|
|
destination coarray.
|
|
|
|
@item @var{dst_image_index} @tab The ID of the destination remote image; must
|
|
|
|
be a positive number.
|
|
|
|
@item @var{dst_refs} @tab intent(in) the references on the remote array to store
|
|
|
|
the data given by src. Guaranteed to have at least one entry.
|
|
|
|
@item @var{src_token} @tab An opaque pointer identifying the source coarray.
|
|
|
|
@item @var{src_image_index} @tab The ID of the source remote image; must be a
|
|
|
|
positive number.
|
|
|
|
@item @var{src_refs} @tab intent(in) the references to apply to the remote
|
|
|
|
structure to get the data.
|
|
|
|
@item @var{dst_kind} @tab Kind of the destination argument
|
|
|
|
@item @var{src_kind} @tab Kind of the source argument
|
|
|
|
@item @var{may_require_tmp} @tab The variable is false it is known at compile
|
|
|
|
time that the @var{dest} and @var{src} either cannot overlap or overlap (fully
|
|
|
|
or partially) such that walking @var{src} and @var{dest} in element wise
|
|
|
|
element order (honoring the stride value) will not lead to wrong results.
|
|
|
|
Otherwise, the value is true.
|
|
|
|
@item @var{dst_stat} @tab intent(out) when non-@code{NULL} give the result of
|
|
|
|
the send-operation, i.e., zero on success and non-zero on error. When
|
|
|
|
@code{NULL} and an error occurs, then an error message is printed and the
|
|
|
|
program is terminated.
|
|
|
|
@item @var{src_stat} @tab intent(out) when non-@code{NULL} give the result of
|
|
|
|
the get-operation, i.e., zero on success and non-zero on error. When
|
|
|
|
@code{NULL} and an error occurs, then an error message is printed and the
|
|
|
|
program is terminated.
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{NOTES}
|
|
|
|
It is permitted to have image_ids equal; the memory of the send-to and the
|
|
|
|
send-from might (partially) overlap in that case. The implementation has to
|
|
|
|
take care that it handles this case, e.g. using @code{memmove} which handles
|
|
|
|
(partially) overlapping memory. If @var{may_require_tmp} is true, the library
|
|
|
|
might additionally create a temporary variable, unless additional checks show
|
|
|
|
that this is not required (e.g. because walking backward is possible or because
|
|
|
|
both arrays are contiguous and @code{memmove} takes care of overlap issues).
|
|
|
|
|
|
|
|
Note that the assignment of a scalar to an array is permitted. In addition,
|
|
|
|
the library has to handle numeric-type conversion and for strings, padding and
|
|
|
|
different character kinds.
|
|
|
|
|
|
|
|
Because of the more complicated references possible some operations may be
|
|
|
|
unsupported by certain libraries. The library is expected to issue a precise
|
|
|
|
error message why the operation is not permitted.
|
|
|
|
@end table
|
|
|
|
|
2014-08-14 20:35:01 +02:00
|
|
|
|
gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
gcc/fortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
(_gfortran_caf_register): Update for locking/critical.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* resolve.c (resolve_critical): New.
(gfc_resolve_code): Call it.
* trans-decl.c (gfor_fndecl_caf_critical,
gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
(gfc_build_builtin_function_decls): Remove critical,
assign locking declarations.
(generate_coarray_sym_init): Handle locking and
critical variables.
* trans-stmt.c (gfc_trans_critical): Add calls to
lock/unlock libcaf functions.
* trans.h (gfc_coarray_type): Update locking, add
critical enum values.
(gfor_fndecl_caf_critical, gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
libgfortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* caf/libcaf.h (caf_register_t): Update for critical.
(_gfortran_caf_critical, _gfortran_caf_end_critical): Remove.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* caf/single.c (_gfortran_caf_register): Handle locking
variables.
(_gfortran_caf_sendget): Re-name args for consistency.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
From-SVN: r213979
2014-08-14 20:39:15 +02:00
|
|
|
@node _gfortran_caf_lock
|
|
|
|
@subsection @code{_gfortran_caf_lock} --- Locking a lock variable
|
|
|
|
@cindex Coarray, _gfortran_caf_lock
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Acquire a lock on the given image on a scalar locking variable or for the
|
|
|
|
given array element for an array-valued variable. If the @var{aquired_lock}
|
|
|
|
is @code{NULL}, the function return after having obtained the lock. If it is
|
|
|
|
nonnull, the result is is assigned the value true (one) when the lock could be
|
|
|
|
obtained and false (zero) otherwise. Locking a lock variable which has already
|
|
|
|
been locked by the same image is an error.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_lock (caf_token_t token, size_t index, int image_index,
|
|
|
|
int *aquired_lock, int *stat, char *errmsg, int errmsg_len)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{token} @tab intent(in) An opaque pointer identifying the coarray.
|
|
|
|
@item @var{index} @tab Array index; first array index is 0. For scalars, it is
|
|
|
|
always 0.
|
|
|
|
@item @var{image_index} @tab The ID of the remote image; must be a positive
|
|
|
|
number.
|
|
|
|
@item @var{aquired_lock} @tab intent(out) If not NULL, it returns whether lock
|
|
|
|
could be obtained
|
check.c (gfc_check_event_query): New function.
2015-12-02 Tobias Burnus <burnus@net-b.de>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* check.c (gfc_check_event_query): New function.
* dump-parse-tree.c (show_code_node): Handle EXEC_EVENT_POST,
EXEC_EVENT_WAIT.
* expr.c (gfc_check_vardef_context): New check for event variables
definition.
* gfortran.h (gfc_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(gfc_isym_id): GFC_ISYM_EVENT_QUERY.
(struct symbol_attribute): New field.
(gfc_exec_op): Add EXEC_EVENT_POST and EXEC_EVENT_WAIT.
* gfortran.texi: Document about new events functions and minor
changes.
* interface.c (compare_parameter): New check.
(gfc_procedure_use): New check for explicit procedure interface.
(add_subroutines): Add event_query.
* intrinsic.h (gfc_check_event_query,gfc_resolve_event_query):
New prototypes.
* iresolve.c (gfc_resolve_event_query): New function.
* iso-fortran-env.def (event_type): New type.
* match.c (event_statement,gfc_match_event_post,gfc_match_event_wait):
New functions.
(gfc_match_name): New event post and event wait.
* match.h (gfc_match_event_post,gfc_match_event_wait):
New prototypes.
* module.c (ab_attribute): Add AB_EVENT_COMP.
(attr_bits): Likewise.
(mio_symbol_attribute): Handle event_comp attribute.
* parse.c (decode_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(next_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(gfc_ascii_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(parse_derived): Check for event_type components.
* resolve.c (resolve_allocate_expr): Check for event variable def.
(resolve_lock_unlock): Renamed to resolve_lock_unlock_event. It
includes logic for locks and events.
(gfc_resolve_code): Call it.
(gfc_resolve_symbol): New check for event variable to be a corray.
* st.c (gfc_free_statement): Handle new EXEC_EVENT_POST and
EXEC_EVENT_WAIT.
* trans-decl.c (gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
gfor_fndecl_caf_event_query): New global variables.
(generate_coarray_sym_init): Checking for event_type.
(gfc_conv_procedure_call): Check for C bind attribute.
* trans-intrinsic.c (conv_intrinsic_event_query): New function.
(conv_intrinsic_move_alloc): Call it.
* trans-stmt.c (gfc_trans_lock_unlock): Passing address
of actual argument.
(gfc_trans_sync): Likewise.
(gfc_trans_event_post_wait): New function.
* trans-stmt.h (gfc_trans_event_post_wait): New prototype.
* trans-types.c (gfc_get_derived_type): Integer_kind as event_type.
* trans.c (gfc_allocate_using_lib): New argument and logic for events.
(gfc_allocate_allocatable): Passing new argument.
(trans_code): Handle EXEC_EVENT_POST, EXEC_EVENT_WAIT.
* trans.h (gfc_coarray_type): New elements.
(gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
gfor_fndecl_caf_event_query): Declare them.
2015-12-02 Tobias Burnus <burnus@net-b.de>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* gfortran.dg/coarray/event_1.f90: New.
* gfortran.dg/coarray/event_2.f90: New.
Co-Authored-By: Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
From-SVN: r231208
2015-12-02 22:59:05 +01:00
|
|
|
@item @var{stat} @tab intent(out) Stores the STAT=; may be NULL
|
gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
gcc/fortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
(_gfortran_caf_register): Update for locking/critical.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* resolve.c (resolve_critical): New.
(gfc_resolve_code): Call it.
* trans-decl.c (gfor_fndecl_caf_critical,
gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
(gfc_build_builtin_function_decls): Remove critical,
assign locking declarations.
(generate_coarray_sym_init): Handle locking and
critical variables.
* trans-stmt.c (gfc_trans_critical): Add calls to
lock/unlock libcaf functions.
* trans.h (gfc_coarray_type): Update locking, add
critical enum values.
(gfor_fndecl_caf_critical, gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
libgfortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* caf/libcaf.h (caf_register_t): Update for critical.
(_gfortran_caf_critical, _gfortran_caf_end_critical): Remove.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* caf/single.c (_gfortran_caf_register): Handle locking
variables.
(_gfortran_caf_sendget): Re-name args for consistency.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
From-SVN: r213979
2014-08-14 20:39:15 +02:00
|
|
|
@item @var{errmsg} @tab intent(out) When an error occurs, this will be set to
|
|
|
|
an error message; may be NULL
|
|
|
|
@item @var{errmsg_len} @tab the buffer size of errmsg.
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{NOTES}
|
|
|
|
This function is also called for critical blocks; for those, the array index
|
|
|
|
is always zero and the image index is one. Libraries are permitted to use other
|
|
|
|
images for critical-block locking variables.
|
|
|
|
@end table
|
|
|
|
|
|
|
|
@node _gfortran_caf_unlock
|
|
|
|
@subsection @code{_gfortran_caf_lock} --- Unlocking a lock variable
|
|
|
|
@cindex Coarray, _gfortran_caf_unlock
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Release a lock on the given image on a scalar locking variable or for the
|
|
|
|
given array element for an array-valued variable. Unlocking a lock variable
|
|
|
|
which is unlocked or has been locked by a different image is an error.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_unlock (caf_token_t token, size_t index, int image_index,
|
|
|
|
int *stat, char *errmsg, int errmsg_len)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{token} @tab intent(in) An opaque pointer identifying the coarray.
|
|
|
|
@item @var{index} @tab Array index; first array index is 0. For scalars, it is
|
|
|
|
always 0.
|
|
|
|
@item @var{image_index} @tab The ID of the remote image; must be a positive
|
|
|
|
number.
|
|
|
|
@item @var{stat} @tab intent(out) For allocatable coarrays, stores the STAT=;
|
|
|
|
may be NULL
|
|
|
|
@item @var{errmsg} @tab intent(out) When an error occurs, this will be set to
|
|
|
|
an error message; may be NULL
|
|
|
|
@item @var{errmsg_len} @tab the buffer size of errmsg.
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{NOTES}
|
|
|
|
This function is also called for critical block; for those, the array index
|
|
|
|
is always zero and the image index is one. Libraries are permitted to use other
|
|
|
|
images for critical-block locking variables.
|
|
|
|
@end table
|
2014-08-14 20:35:01 +02:00
|
|
|
|
check.c (gfc_check_event_query): New function.
2015-12-02 Tobias Burnus <burnus@net-b.de>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* check.c (gfc_check_event_query): New function.
* dump-parse-tree.c (show_code_node): Handle EXEC_EVENT_POST,
EXEC_EVENT_WAIT.
* expr.c (gfc_check_vardef_context): New check for event variables
definition.
* gfortran.h (gfc_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(gfc_isym_id): GFC_ISYM_EVENT_QUERY.
(struct symbol_attribute): New field.
(gfc_exec_op): Add EXEC_EVENT_POST and EXEC_EVENT_WAIT.
* gfortran.texi: Document about new events functions and minor
changes.
* interface.c (compare_parameter): New check.
(gfc_procedure_use): New check for explicit procedure interface.
(add_subroutines): Add event_query.
* intrinsic.h (gfc_check_event_query,gfc_resolve_event_query):
New prototypes.
* iresolve.c (gfc_resolve_event_query): New function.
* iso-fortran-env.def (event_type): New type.
* match.c (event_statement,gfc_match_event_post,gfc_match_event_wait):
New functions.
(gfc_match_name): New event post and event wait.
* match.h (gfc_match_event_post,gfc_match_event_wait):
New prototypes.
* module.c (ab_attribute): Add AB_EVENT_COMP.
(attr_bits): Likewise.
(mio_symbol_attribute): Handle event_comp attribute.
* parse.c (decode_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(next_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(gfc_ascii_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(parse_derived): Check for event_type components.
* resolve.c (resolve_allocate_expr): Check for event variable def.
(resolve_lock_unlock): Renamed to resolve_lock_unlock_event. It
includes logic for locks and events.
(gfc_resolve_code): Call it.
(gfc_resolve_symbol): New check for event variable to be a corray.
* st.c (gfc_free_statement): Handle new EXEC_EVENT_POST and
EXEC_EVENT_WAIT.
* trans-decl.c (gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
gfor_fndecl_caf_event_query): New global variables.
(generate_coarray_sym_init): Checking for event_type.
(gfc_conv_procedure_call): Check for C bind attribute.
* trans-intrinsic.c (conv_intrinsic_event_query): New function.
(conv_intrinsic_move_alloc): Call it.
* trans-stmt.c (gfc_trans_lock_unlock): Passing address
of actual argument.
(gfc_trans_sync): Likewise.
(gfc_trans_event_post_wait): New function.
* trans-stmt.h (gfc_trans_event_post_wait): New prototype.
* trans-types.c (gfc_get_derived_type): Integer_kind as event_type.
* trans.c (gfc_allocate_using_lib): New argument and logic for events.
(gfc_allocate_allocatable): Passing new argument.
(trans_code): Handle EXEC_EVENT_POST, EXEC_EVENT_WAIT.
* trans.h (gfc_coarray_type): New elements.
(gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
gfor_fndecl_caf_event_query): Declare them.
2015-12-02 Tobias Burnus <burnus@net-b.de>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* gfortran.dg/coarray/event_1.f90: New.
* gfortran.dg/coarray/event_2.f90: New.
Co-Authored-By: Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
From-SVN: r231208
2015-12-02 22:59:05 +01:00
|
|
|
@node _gfortran_caf_event_post
|
|
|
|
@subsection @code{_gfortran_caf_event_post} --- Post an event
|
|
|
|
@cindex Coarray, _gfortran_caf_event_post
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Increment the event count of the specified event variable.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_event_post (caf_token_t token, size_t index,
|
|
|
|
int image_index, int *stat, char *errmsg, int errmsg_len)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{token} @tab intent(in) An opaque pointer identifying the coarray.
|
|
|
|
@item @var{index} @tab Array index; first array index is 0. For scalars, it is
|
|
|
|
always 0.
|
|
|
|
@item @var{image_index} @tab The ID of the remote image; must be a positive
|
|
|
|
number; zero indicates the current image when accessed noncoindexed.
|
|
|
|
@item @var{stat} @tab intent(out) Stores the STAT=; may be NULL
|
|
|
|
@item @var{errmsg} @tab intent(out) When an error occurs, this will be set to
|
|
|
|
an error message; may be NULL
|
|
|
|
@item @var{errmsg_len} @tab the buffer size of errmsg.
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{NOTES}
|
|
|
|
This acts like an atomic add of one to the remote image's event variable.
|
|
|
|
The statement is an image-control statement but does not imply sync memory.
|
|
|
|
Still, all preceeding push communications of this image to the specified
|
|
|
|
remote image has to be completed before @code{event_wait} on the remote
|
|
|
|
image returns.
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_caf_event_wait
|
|
|
|
@subsection @code{_gfortran_caf_event_wait} --- Wait that an event occurred
|
|
|
|
@cindex Coarray, _gfortran_caf_event_wait
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Wait until the event count has reached at least the specified
|
|
|
|
@var{until_count}; if so, atomically decrement the event variable by this
|
|
|
|
amount and return.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_event_wait (caf_token_t token, size_t index,
|
|
|
|
int until_count, int *stat, char *errmsg, int errmsg_len)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{token} @tab intent(in) An opaque pointer identifying the coarray.
|
|
|
|
@item @var{index} @tab Array index; first array index is 0. For scalars, it is
|
|
|
|
always 0.
|
|
|
|
@item @var{until_count} @tab The number of events which have to be available
|
|
|
|
before the function returns.
|
|
|
|
@item @var{stat} @tab intent(out) Stores the STAT=; may be NULL
|
|
|
|
@item @var{errmsg} @tab intent(out) When an error occurs, this will be set to
|
|
|
|
an error message; may be NULL
|
|
|
|
@item @var{errmsg_len} @tab the buffer size of errmsg.
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{NOTES}
|
|
|
|
This function only operates on a local coarray. It acts like a loop checking
|
|
|
|
atomically the value of the event variable, breaking if the value is greater
|
|
|
|
or equal the requested number of counts. Before the function returns, the
|
|
|
|
event variable has to be decremented by the requested @var{until_count} value.
|
|
|
|
A possible implementation would be a busy loop for a certain number of spins
|
|
|
|
(possibly depending on the number of threads relative to the number of available
|
|
|
|
cores) followed by other waiting strategy such as a sleeping wait (possibly with
|
|
|
|
an increasing number of sleep time) or, if possible, a futex wait.
|
|
|
|
|
|
|
|
The statement is an image-control statement but does not imply sync memory.
|
|
|
|
Still, all preceeding push communications to this image of images having
|
|
|
|
issued a @code{event_push} have to be completed before this function returns.
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_caf_event_query
|
|
|
|
@subsection @code{_gfortran_caf_event_query} --- Query event count
|
|
|
|
@cindex Coarray, _gfortran_caf_event_query
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Return the event count of the specified event count.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_event_query (caf_token_t token, size_t index,
|
|
|
|
int image_index, int *count, int *stat)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{token} @tab intent(in) An opaque pointer identifying the coarray.
|
|
|
|
@item @var{index} @tab Array index; first array index is 0. For scalars, it is
|
|
|
|
always 0.
|
|
|
|
@item @var{image_index} @tab The ID of the remote image; must be a positive
|
|
|
|
number; zero indicates the current image when accessed noncoindexed.
|
|
|
|
@item @var{count} @tab intent(out) The number of events currently posted to
|
|
|
|
the event variable
|
|
|
|
@item @var{stat} @tab intent(out) Stores the STAT=; may be NULL
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{NOTES}
|
|
|
|
The typical use is to check the local even variable to only call
|
|
|
|
@code{event_wait} when the data is available. However, a coindexed variable
|
|
|
|
is permitted; there is no ordering or synchronization implied. It acts like
|
|
|
|
an atomic fetch of the value of the event variable.
|
|
|
|
@end table
|
2014-08-14 20:35:01 +02:00
|
|
|
|
2015-03-21 09:31:17 +01:00
|
|
|
@node _gfortran_caf_sync_all
|
|
|
|
@subsection @code{_gfortran_caf_sync_all} --- All-image barrier
|
|
|
|
@cindex Coarray, _gfortran_caf_sync_all
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Synchronization of all images in the current team; the program only continues
|
|
|
|
on a given image after this function has been called on all images of the
|
|
|
|
current team. Additionally, it ensures that all pending data transfers of
|
|
|
|
previous segment have completed.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_sync_all (int *stat, char *errmsg, int errmsg_len)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{stat} @tab intent(out) Stores the status STAT= and may be NULL.
|
|
|
|
@item @var{errmsg} @tab intent(out) When an error occurs, this will be set to
|
|
|
|
an error message; may be NULL
|
|
|
|
@item @var{errmsg_len} @tab the buffer size of errmsg.
|
|
|
|
@end multitable
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_caf_sync_images
|
|
|
|
@subsection @code{_gfortran_caf_sync_images} --- Barrier for selected images
|
|
|
|
@cindex Coarray, _gfortran_caf_sync_images
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Synchronization between the specified images; the program only continues on a
|
|
|
|
given image after this function has been called on all images specified for
|
|
|
|
that image. Note that one image can wait for all other images in the current
|
|
|
|
team (e.g. via @code{sync images(*)}) while those only wait for that specific
|
|
|
|
image. Additionally, @code{sync images} it ensures that all pending data
|
|
|
|
transfers of previous segment have completed.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_sync_images (int count, int images[], int *stat,
|
|
|
|
char *errmsg, int errmsg_len)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{count} @tab the number of images which are provided in the next
|
|
|
|
argument. For a zero-sized array, the value is zero. For @code{sync
|
|
|
|
images (*)}, the value is @math{-1}.
|
|
|
|
@item @var{images} @tab intent(in) an array with the images provided by the
|
|
|
|
user. If @var{count} is zero, a NULL pointer is passed.
|
|
|
|
@item @var{stat} @tab intent(out) Stores the status STAT= and may be NULL.
|
|
|
|
@item @var{errmsg} @tab intent(out) When an error occurs, this will be set to
|
|
|
|
an error message; may be NULL
|
|
|
|
@item @var{errmsg_len} @tab the buffer size of errmsg.
|
|
|
|
@end multitable
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_caf_sync_memory
|
|
|
|
@subsection @code{_gfortran_caf_sync_memory} --- Wait for completion of segment-memory operations
|
|
|
|
@cindex Coarray, _gfortran_caf_sync_memory
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Acts as optimization barrier between different segments. It also ensures that
|
|
|
|
all pending memory operations of this image have been completed.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_sync_memory (int *stat, char *errmsg, int errmsg_len)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{stat} @tab intent(out) Stores the status STAT= and may be NULL.
|
|
|
|
@item @var{errmsg} @tab intent(out) When an error occurs, this will be set to
|
|
|
|
an error message; may be NULL
|
|
|
|
@item @var{errmsg_len} @tab the buffer size of errmsg.
|
|
|
|
@end multitable
|
|
|
|
|
2015-03-24 08:04:51 +01:00
|
|
|
@item @emph{NOTE} A simple implementation could be
|
|
|
|
@code{__asm__ __volatile__ ("":::"memory")} to prevent code movements.
|
2015-03-21 09:31:17 +01:00
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_caf_error_stop
|
|
|
|
@subsection @code{_gfortran_caf_error_stop} --- Error termination with exit code
|
|
|
|
@cindex Coarray, _gfortran_caf_error_stop
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Invoked for an @code{ERROR STOP} statement which has an integer argument. The
|
|
|
|
function should terminate the program with the specified exit code.
|
|
|
|
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_error_stop (int32_t error)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{error} @tab the exit status to be used.
|
|
|
|
@end multitable
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_caf_error_stop_str
|
|
|
|
@subsection @code{_gfortran_caf_error_stop_str} --- Error termination with string
|
|
|
|
@cindex Coarray, _gfortran_caf_error_stop_str
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Invoked for an @code{ERROR STOP} statement which has a string as argument. The
|
|
|
|
function should terminate the program with a nonzero-exit code.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_error_stop (const char *string, int32_t len)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{string} @tab the error message (not zero terminated)
|
|
|
|
@item @var{len} @tab the length of the string
|
|
|
|
@end multitable
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_caf_atomic_define
|
|
|
|
@subsection @code{_gfortran_caf_atomic_define} --- Atomic variable assignment
|
|
|
|
@cindex Coarray, _gfortran_caf_atomic_define
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Assign atomically a value to an integer or logical variable.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_atomic_define (caf_token_t token, size_t offset,
|
|
|
|
int image_index, void *value, int *stat, int type, int kind)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{token} @tab intent(in) An opaque pointer identifying the coarray.
|
|
|
|
@item @var{offset} @tab By which amount of bytes the actual data is shifted
|
|
|
|
compared to the base address of the coarray.
|
|
|
|
@item @var{image_index} @tab The ID of the remote image; must be a positive
|
check.c (gfc_check_event_query): New function.
2015-12-02 Tobias Burnus <burnus@net-b.de>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* check.c (gfc_check_event_query): New function.
* dump-parse-tree.c (show_code_node): Handle EXEC_EVENT_POST,
EXEC_EVENT_WAIT.
* expr.c (gfc_check_vardef_context): New check for event variables
definition.
* gfortran.h (gfc_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(gfc_isym_id): GFC_ISYM_EVENT_QUERY.
(struct symbol_attribute): New field.
(gfc_exec_op): Add EXEC_EVENT_POST and EXEC_EVENT_WAIT.
* gfortran.texi: Document about new events functions and minor
changes.
* interface.c (compare_parameter): New check.
(gfc_procedure_use): New check for explicit procedure interface.
(add_subroutines): Add event_query.
* intrinsic.h (gfc_check_event_query,gfc_resolve_event_query):
New prototypes.
* iresolve.c (gfc_resolve_event_query): New function.
* iso-fortran-env.def (event_type): New type.
* match.c (event_statement,gfc_match_event_post,gfc_match_event_wait):
New functions.
(gfc_match_name): New event post and event wait.
* match.h (gfc_match_event_post,gfc_match_event_wait):
New prototypes.
* module.c (ab_attribute): Add AB_EVENT_COMP.
(attr_bits): Likewise.
(mio_symbol_attribute): Handle event_comp attribute.
* parse.c (decode_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(next_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(gfc_ascii_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(parse_derived): Check for event_type components.
* resolve.c (resolve_allocate_expr): Check for event variable def.
(resolve_lock_unlock): Renamed to resolve_lock_unlock_event. It
includes logic for locks and events.
(gfc_resolve_code): Call it.
(gfc_resolve_symbol): New check for event variable to be a corray.
* st.c (gfc_free_statement): Handle new EXEC_EVENT_POST and
EXEC_EVENT_WAIT.
* trans-decl.c (gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
gfor_fndecl_caf_event_query): New global variables.
(generate_coarray_sym_init): Checking for event_type.
(gfc_conv_procedure_call): Check for C bind attribute.
* trans-intrinsic.c (conv_intrinsic_event_query): New function.
(conv_intrinsic_move_alloc): Call it.
* trans-stmt.c (gfc_trans_lock_unlock): Passing address
of actual argument.
(gfc_trans_sync): Likewise.
(gfc_trans_event_post_wait): New function.
* trans-stmt.h (gfc_trans_event_post_wait): New prototype.
* trans-types.c (gfc_get_derived_type): Integer_kind as event_type.
* trans.c (gfc_allocate_using_lib): New argument and logic for events.
(gfc_allocate_allocatable): Passing new argument.
(trans_code): Handle EXEC_EVENT_POST, EXEC_EVENT_WAIT.
* trans.h (gfc_coarray_type): New elements.
(gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
gfor_fndecl_caf_event_query): Declare them.
2015-12-02 Tobias Burnus <burnus@net-b.de>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* gfortran.dg/coarray/event_1.f90: New.
* gfortran.dg/coarray/event_2.f90: New.
Co-Authored-By: Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
From-SVN: r231208
2015-12-02 22:59:05 +01:00
|
|
|
number; zero indicates the current image when used noncoindexed.
|
2015-03-21 09:31:17 +01:00
|
|
|
@item @var{value} @tab intent(in) the value to be assigned, passed by reference.
|
|
|
|
@item @var{stat} @tab intent(out) Stores the status STAT= and may be NULL.
|
|
|
|
@item @var{type} @tab the data type, i.e. @code{BT_INTEGER} (1) or
|
|
|
|
@code{BT_LOGICAL} (2).
|
|
|
|
@item @var{kind} @tab The kind value (only 4; always @code{int})
|
|
|
|
@end multitable
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_caf_atomic_ref
|
|
|
|
@subsection @code{_gfortran_caf_atomic_ref} --- Atomic variable reference
|
|
|
|
@cindex Coarray, _gfortran_caf_atomic_ref
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Reference atomically a value of a kind-4 integer or logical variable.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_atomic_ref (caf_token_t token, size_t offset,
|
|
|
|
int image_index, void *value, int *stat, int type, int kind)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{token} @tab intent(in) An opaque pointer identifying the coarray.
|
|
|
|
@item @var{offset} @tab By which amount of bytes the actual data is shifted
|
|
|
|
compared to the base address of the coarray.
|
|
|
|
@item @var{image_index} @tab The ID of the remote image; must be a positive
|
check.c (gfc_check_event_query): New function.
2015-12-02 Tobias Burnus <burnus@net-b.de>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* check.c (gfc_check_event_query): New function.
* dump-parse-tree.c (show_code_node): Handle EXEC_EVENT_POST,
EXEC_EVENT_WAIT.
* expr.c (gfc_check_vardef_context): New check for event variables
definition.
* gfortran.h (gfc_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(gfc_isym_id): GFC_ISYM_EVENT_QUERY.
(struct symbol_attribute): New field.
(gfc_exec_op): Add EXEC_EVENT_POST and EXEC_EVENT_WAIT.
* gfortran.texi: Document about new events functions and minor
changes.
* interface.c (compare_parameter): New check.
(gfc_procedure_use): New check for explicit procedure interface.
(add_subroutines): Add event_query.
* intrinsic.h (gfc_check_event_query,gfc_resolve_event_query):
New prototypes.
* iresolve.c (gfc_resolve_event_query): New function.
* iso-fortran-env.def (event_type): New type.
* match.c (event_statement,gfc_match_event_post,gfc_match_event_wait):
New functions.
(gfc_match_name): New event post and event wait.
* match.h (gfc_match_event_post,gfc_match_event_wait):
New prototypes.
* module.c (ab_attribute): Add AB_EVENT_COMP.
(attr_bits): Likewise.
(mio_symbol_attribute): Handle event_comp attribute.
* parse.c (decode_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(next_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(gfc_ascii_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(parse_derived): Check for event_type components.
* resolve.c (resolve_allocate_expr): Check for event variable def.
(resolve_lock_unlock): Renamed to resolve_lock_unlock_event. It
includes logic for locks and events.
(gfc_resolve_code): Call it.
(gfc_resolve_symbol): New check for event variable to be a corray.
* st.c (gfc_free_statement): Handle new EXEC_EVENT_POST and
EXEC_EVENT_WAIT.
* trans-decl.c (gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
gfor_fndecl_caf_event_query): New global variables.
(generate_coarray_sym_init): Checking for event_type.
(gfc_conv_procedure_call): Check for C bind attribute.
* trans-intrinsic.c (conv_intrinsic_event_query): New function.
(conv_intrinsic_move_alloc): Call it.
* trans-stmt.c (gfc_trans_lock_unlock): Passing address
of actual argument.
(gfc_trans_sync): Likewise.
(gfc_trans_event_post_wait): New function.
* trans-stmt.h (gfc_trans_event_post_wait): New prototype.
* trans-types.c (gfc_get_derived_type): Integer_kind as event_type.
* trans.c (gfc_allocate_using_lib): New argument and logic for events.
(gfc_allocate_allocatable): Passing new argument.
(trans_code): Handle EXEC_EVENT_POST, EXEC_EVENT_WAIT.
* trans.h (gfc_coarray_type): New elements.
(gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
gfor_fndecl_caf_event_query): Declare them.
2015-12-02 Tobias Burnus <burnus@net-b.de>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* gfortran.dg/coarray/event_1.f90: New.
* gfortran.dg/coarray/event_2.f90: New.
Co-Authored-By: Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
From-SVN: r231208
2015-12-02 22:59:05 +01:00
|
|
|
number; zero indicates the current image when used noncoindexed.
|
2015-03-21 09:31:17 +01:00
|
|
|
@item @var{value} @tab intent(out) The variable assigned the atomically
|
|
|
|
referenced variable.
|
|
|
|
@item @var{stat} @tab intent(out) Stores the status STAT= and may be NULL.
|
|
|
|
@item @var{type} @tab the data type, i.e. @code{BT_INTEGER} (1) or
|
|
|
|
@code{BT_LOGICAL} (2).
|
|
|
|
@item @var{kind} @tab The kind value (only 4; always @code{int})
|
|
|
|
@end multitable
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_caf_atomic_cas
|
|
|
|
@subsection @code{_gfortran_caf_atomic_cas} --- Atomic compare and swap
|
|
|
|
@cindex Coarray, _gfortran_caf_atomic_cas
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Atomic compare and swap of a kind-4 integer or logical variable. Assigns
|
|
|
|
atomically the specified value to the atomic variable, if the latter has
|
|
|
|
the value specified by the passed condition value.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_atomic_cas (caf_token_t token, size_t offset,
|
|
|
|
int image_index, void *old, void *compare, void *new_val, int *stat,
|
|
|
|
int type, int kind)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{token} @tab intent(in) An opaque pointer identifying the coarray.
|
|
|
|
@item @var{offset} @tab By which amount of bytes the actual data is shifted
|
|
|
|
compared to the base address of the coarray.
|
|
|
|
@item @var{image_index} @tab The ID of the remote image; must be a positive
|
check.c (gfc_check_event_query): New function.
2015-12-02 Tobias Burnus <burnus@net-b.de>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* check.c (gfc_check_event_query): New function.
* dump-parse-tree.c (show_code_node): Handle EXEC_EVENT_POST,
EXEC_EVENT_WAIT.
* expr.c (gfc_check_vardef_context): New check for event variables
definition.
* gfortran.h (gfc_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(gfc_isym_id): GFC_ISYM_EVENT_QUERY.
(struct symbol_attribute): New field.
(gfc_exec_op): Add EXEC_EVENT_POST and EXEC_EVENT_WAIT.
* gfortran.texi: Document about new events functions and minor
changes.
* interface.c (compare_parameter): New check.
(gfc_procedure_use): New check for explicit procedure interface.
(add_subroutines): Add event_query.
* intrinsic.h (gfc_check_event_query,gfc_resolve_event_query):
New prototypes.
* iresolve.c (gfc_resolve_event_query): New function.
* iso-fortran-env.def (event_type): New type.
* match.c (event_statement,gfc_match_event_post,gfc_match_event_wait):
New functions.
(gfc_match_name): New event post and event wait.
* match.h (gfc_match_event_post,gfc_match_event_wait):
New prototypes.
* module.c (ab_attribute): Add AB_EVENT_COMP.
(attr_bits): Likewise.
(mio_symbol_attribute): Handle event_comp attribute.
* parse.c (decode_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(next_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(gfc_ascii_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(parse_derived): Check for event_type components.
* resolve.c (resolve_allocate_expr): Check for event variable def.
(resolve_lock_unlock): Renamed to resolve_lock_unlock_event. It
includes logic for locks and events.
(gfc_resolve_code): Call it.
(gfc_resolve_symbol): New check for event variable to be a corray.
* st.c (gfc_free_statement): Handle new EXEC_EVENT_POST and
EXEC_EVENT_WAIT.
* trans-decl.c (gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
gfor_fndecl_caf_event_query): New global variables.
(generate_coarray_sym_init): Checking for event_type.
(gfc_conv_procedure_call): Check for C bind attribute.
* trans-intrinsic.c (conv_intrinsic_event_query): New function.
(conv_intrinsic_move_alloc): Call it.
* trans-stmt.c (gfc_trans_lock_unlock): Passing address
of actual argument.
(gfc_trans_sync): Likewise.
(gfc_trans_event_post_wait): New function.
* trans-stmt.h (gfc_trans_event_post_wait): New prototype.
* trans-types.c (gfc_get_derived_type): Integer_kind as event_type.
* trans.c (gfc_allocate_using_lib): New argument and logic for events.
(gfc_allocate_allocatable): Passing new argument.
(trans_code): Handle EXEC_EVENT_POST, EXEC_EVENT_WAIT.
* trans.h (gfc_coarray_type): New elements.
(gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
gfor_fndecl_caf_event_query): Declare them.
2015-12-02 Tobias Burnus <burnus@net-b.de>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* gfortran.dg/coarray/event_1.f90: New.
* gfortran.dg/coarray/event_2.f90: New.
Co-Authored-By: Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
From-SVN: r231208
2015-12-02 22:59:05 +01:00
|
|
|
number; zero indicates the current image when used noncoindexed.
|
2015-03-21 09:31:17 +01:00
|
|
|
@item @var{old} @tab intent(out) the value which the atomic variable had
|
|
|
|
just before the cas operation.
|
|
|
|
@item @var{compare} @tab intent(in) The value used for comparision.
|
|
|
|
@item @var{new_val} @tab intent(in) The new value for the atomic variable,
|
|
|
|
assigned to the atomic variable, if @code{compare} equals the value of the
|
|
|
|
atomic variable.
|
|
|
|
@item @var{stat} @tab intent(out) Stores the status STAT= and may be NULL.
|
|
|
|
@item @var{type} @tab the data type, i.e. @code{BT_INTEGER} (1) or
|
|
|
|
@code{BT_LOGICAL} (2).
|
|
|
|
@item @var{kind} @tab The kind value (only 4; always @code{int})
|
|
|
|
@end multitable
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_caf_atomic_op
|
|
|
|
@subsection @code{_gfortran_caf_atomic_op} --- Atomic operation
|
|
|
|
@cindex Coarray, _gfortran_caf_atomic_op
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Apply an operation atomically to an atomic integer or logical variable.
|
|
|
|
After the operation, @var{old} contains the value just before the operation,
|
|
|
|
which, respectively, adds (GFC_CAF_ATOMIC_ADD) atomically the @code{value} to
|
|
|
|
the atomic integer variable or does a bitwise AND, OR or exclusive OR of the
|
|
|
|
between the atomic variable and @var{value}; the result is then stored in the
|
|
|
|
atomic variable.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_atomic_op (int op, caf_token_t token, size_t offset,
|
|
|
|
int image_index, void *value, void *old, int *stat, int type, int kind)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{op} @tab the operation to be performed; possible values
|
|
|
|
@code{GFC_CAF_ATOMIC_ADD} (1), @code{GFC_CAF_ATOMIC_AND} (2),
|
|
|
|
@code{GFC_CAF_ATOMIC_OR} (3), @code{GFC_CAF_ATOMIC_XOR} (4).
|
|
|
|
@item @var{token} @tab intent(in) An opaque pointer identifying the coarray.
|
|
|
|
@item @var{offset} @tab By which amount of bytes the actual data is shifted
|
|
|
|
compared to the base address of the coarray.
|
|
|
|
@item @var{image_index} @tab The ID of the remote image; must be a positive
|
check.c (gfc_check_event_query): New function.
2015-12-02 Tobias Burnus <burnus@net-b.de>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* check.c (gfc_check_event_query): New function.
* dump-parse-tree.c (show_code_node): Handle EXEC_EVENT_POST,
EXEC_EVENT_WAIT.
* expr.c (gfc_check_vardef_context): New check for event variables
definition.
* gfortran.h (gfc_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(gfc_isym_id): GFC_ISYM_EVENT_QUERY.
(struct symbol_attribute): New field.
(gfc_exec_op): Add EXEC_EVENT_POST and EXEC_EVENT_WAIT.
* gfortran.texi: Document about new events functions and minor
changes.
* interface.c (compare_parameter): New check.
(gfc_procedure_use): New check for explicit procedure interface.
(add_subroutines): Add event_query.
* intrinsic.h (gfc_check_event_query,gfc_resolve_event_query):
New prototypes.
* iresolve.c (gfc_resolve_event_query): New function.
* iso-fortran-env.def (event_type): New type.
* match.c (event_statement,gfc_match_event_post,gfc_match_event_wait):
New functions.
(gfc_match_name): New event post and event wait.
* match.h (gfc_match_event_post,gfc_match_event_wait):
New prototypes.
* module.c (ab_attribute): Add AB_EVENT_COMP.
(attr_bits): Likewise.
(mio_symbol_attribute): Handle event_comp attribute.
* parse.c (decode_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(next_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(gfc_ascii_statement): Add ST_EVENT_POST, ST_EVENT_WAIT.
(parse_derived): Check for event_type components.
* resolve.c (resolve_allocate_expr): Check for event variable def.
(resolve_lock_unlock): Renamed to resolve_lock_unlock_event. It
includes logic for locks and events.
(gfc_resolve_code): Call it.
(gfc_resolve_symbol): New check for event variable to be a corray.
* st.c (gfc_free_statement): Handle new EXEC_EVENT_POST and
EXEC_EVENT_WAIT.
* trans-decl.c (gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
gfor_fndecl_caf_event_query): New global variables.
(generate_coarray_sym_init): Checking for event_type.
(gfc_conv_procedure_call): Check for C bind attribute.
* trans-intrinsic.c (conv_intrinsic_event_query): New function.
(conv_intrinsic_move_alloc): Call it.
* trans-stmt.c (gfc_trans_lock_unlock): Passing address
of actual argument.
(gfc_trans_sync): Likewise.
(gfc_trans_event_post_wait): New function.
* trans-stmt.h (gfc_trans_event_post_wait): New prototype.
* trans-types.c (gfc_get_derived_type): Integer_kind as event_type.
* trans.c (gfc_allocate_using_lib): New argument and logic for events.
(gfc_allocate_allocatable): Passing new argument.
(trans_code): Handle EXEC_EVENT_POST, EXEC_EVENT_WAIT.
* trans.h (gfc_coarray_type): New elements.
(gfor_fndecl_caf_event_post,gfor_fndecl_caf_event_wait,
gfor_fndecl_caf_event_query): Declare them.
2015-12-02 Tobias Burnus <burnus@net-b.de>
Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* gfortran.dg/coarray/event_1.f90: New.
* gfortran.dg/coarray/event_2.f90: New.
Co-Authored-By: Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
From-SVN: r231208
2015-12-02 22:59:05 +01:00
|
|
|
number; zero indicates the current image when used noncoindexed.
|
2015-03-21 09:31:17 +01:00
|
|
|
@item @var{old} @tab intent(out) the value which the atomic variable had
|
|
|
|
just before the atomic operation.
|
|
|
|
@item @var{val} @tab intent(in) The new value for the atomic variable,
|
|
|
|
assigned to the atomic variable, if @code{compare} equals the value of the
|
|
|
|
atomic variable.
|
|
|
|
@item @var{stat} @tab intent(out) Stores the status STAT= and may be NULL.
|
|
|
|
@item @var{type} @tab the data type, i.e. @code{BT_INTEGER} (1) or
|
|
|
|
@code{BT_LOGICAL} (2).
|
|
|
|
@item @var{kind} @tab The kind value (only 4; always @code{int})
|
|
|
|
@end multitable
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-05-08 00:14:23 +02:00
|
|
|
|
2014-10-24 22:52:41 +02:00
|
|
|
@node _gfortran_caf_co_broadcast
|
|
|
|
@subsection @code{_gfortran_caf_co_broadcast} --- Sending data to all images
|
|
|
|
@cindex Coarray, _gfortran_caf_co_broadcast
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Distribute a value from a given image to all other images in the team. Has to
|
|
|
|
be called collectively.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_co_broadcast (gfc_descriptor_t *a,
|
|
|
|
int source_image, int *stat, char *errmsg, int errmsg_len)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{a} @tab intent(inout) And array descriptor with the data to be
|
|
|
|
breoadcasted (on @var{source_image}) or to be received (other images).
|
|
|
|
@item @var{source_image} @tab The ID of the image from which the data should
|
|
|
|
be taken.
|
2015-03-21 09:31:17 +01:00
|
|
|
@item @var{stat} @tab intent(out) Stores the status STAT= and may be NULL.
|
2014-10-24 22:52:41 +02:00
|
|
|
@item @var{errmsg} @tab intent(out) When an error occurs, this will be set to
|
|
|
|
an error message; may be NULL
|
|
|
|
@item @var{errmsg_len} @tab the buffer size of errmsg.
|
|
|
|
@end multitable
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_caf_co_max
|
|
|
|
@subsection @code{_gfortran_caf_co_max} --- Collective maximum reduction
|
|
|
|
@cindex Coarray, _gfortran_caf_co_max
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Calculates the for the each array element of the variable @var{a} the maximum
|
|
|
|
value for that element in the current team; if @var{result_image} has the
|
|
|
|
value 0, the result shall be stored on all images, otherwise, only on the
|
|
|
|
specified image. This function operates on numeric values and character
|
|
|
|
strings.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_co_max (gfc_descriptor_t *a, int result_image,
|
|
|
|
int *stat, char *errmsg, int a_len, int errmsg_len)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{a} @tab intent(inout) And array descriptor with the data to be
|
|
|
|
breoadcasted (on @var{source_image}) or to be received (other images).
|
|
|
|
@item @var{result_image} @tab The ID of the image to which the reduced
|
|
|
|
value should be copied to; if zero, it has to be copied to all images.
|
2015-03-21 09:31:17 +01:00
|
|
|
@item @var{stat} @tab intent(out) Stores the status STAT= and may be NULL.
|
2014-10-24 22:52:41 +02:00
|
|
|
@item @var{errmsg} @tab intent(out) When an error occurs, this will be set to
|
|
|
|
an error message; may be NULL
|
|
|
|
@item @var{a_len} @tab The string length of argument @var{a}.
|
|
|
|
@item @var{errmsg_len} @tab the buffer size of errmsg.
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{NOTES}
|
|
|
|
If @var{result_image} is nonzero, the value on all images except of the
|
|
|
|
specified one become undefined; hence, the library may make use of this.
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_caf_co_min
|
|
|
|
@subsection @code{_gfortran_caf_co_min} --- Collective minimum reduction
|
|
|
|
@cindex Coarray, _gfortran_caf_co_min
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Calculates the for the each array element of the variable @var{a} the minimum
|
|
|
|
value for that element in the current team; if @var{result_image} has the
|
|
|
|
value 0, the result shall be stored on all images, otherwise, only on the
|
|
|
|
specified image. This function operates on numeric values and character
|
|
|
|
strings.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_co_min (gfc_descriptor_t *a, int result_image,
|
|
|
|
int *stat, char *errmsg, int a_len, int errmsg_len)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{a} @tab intent(inout) And array descriptor with the data to be
|
|
|
|
breoadcasted (on @var{source_image}) or to be received (other images).
|
|
|
|
@item @var{result_image} @tab The ID of the image to which the reduced
|
|
|
|
value should be copied to; if zero, it has to be copied to all images.
|
2015-03-21 09:31:17 +01:00
|
|
|
@item @var{stat} @tab intent(out) Stores the status STAT= and may be NULL.
|
2014-10-24 22:52:41 +02:00
|
|
|
@item @var{errmsg} @tab intent(out) When an error occurs, this will be set to
|
|
|
|
an error message; may be NULL
|
|
|
|
@item @var{a_len} @tab The string length of argument @var{a}.
|
|
|
|
@item @var{errmsg_len} @tab the buffer size of errmsg.
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{NOTES}
|
|
|
|
If @var{result_image} is nonzero, the value on all images except of the
|
|
|
|
specified one become undefined; hence, the library may make use of this.
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_caf_co_sum
|
|
|
|
@subsection @code{_gfortran_caf_co_sum} --- Collective summing reduction
|
|
|
|
@cindex Coarray, _gfortran_caf_co_sum
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Calculates the for the each array element of the variable @var{a} the sum
|
|
|
|
value for that element in the current team; if @var{result_image} has the
|
|
|
|
value 0, the result shall be stored on all images, otherwise, only on the
|
|
|
|
specified image. This function operates on numeric values.
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_co_sum (gfc_descriptor_t *a, int result_image,
|
|
|
|
int *stat, char *errmsg, int errmsg_len)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{a} @tab intent(inout) And array descriptor with the data to be
|
|
|
|
breoadcasted (on @var{source_image}) or to be received (other images).
|
|
|
|
@item @var{result_image} @tab The ID of the image to which the reduced
|
|
|
|
value should be copied to; if zero, it has to be copied to all images.
|
2015-03-21 09:31:17 +01:00
|
|
|
@item @var{stat} @tab intent(out) Stores the status STAT= and may be NULL.
|
2014-10-24 22:52:41 +02:00
|
|
|
@item @var{errmsg} @tab intent(out) When an error occurs, this will be set to
|
|
|
|
an error message; may be NULL
|
|
|
|
@item @var{errmsg_len} @tab the buffer size of errmsg.
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{NOTES}
|
|
|
|
If @var{result_image} is nonzero, the value on all images except of the
|
|
|
|
specified one become undefined; hence, the library may make use of this.
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@node _gfortran_caf_co_reduce
|
|
|
|
@subsection @code{_gfortran_caf_co_reduce} --- Generic collective reduction
|
|
|
|
@cindex Coarray, _gfortran_caf_co_reduce
|
|
|
|
|
|
|
|
@table @asis
|
|
|
|
@item @emph{Description}:
|
|
|
|
Calculates the for the each array element of the variable @var{a} the reduction
|
|
|
|
value for that element in the current team; if @var{result_image} has the
|
|
|
|
value 0, the result shall be stored on all images, otherwise, only on the
|
|
|
|
specified image. The @var{opr} is a pure function doing a mathematically
|
|
|
|
commutative and associative operation.
|
|
|
|
|
|
|
|
The @var{opr_flags} denote the following; the values are bitwise ored.
|
|
|
|
@code{GFC_CAF_BYREF} (1) if the result should be returned
|
|
|
|
by value; @code{GFC_CAF_HIDDENLEN} (2) whether the result and argument
|
|
|
|
string lengths shall be specified as hidden argument;
|
|
|
|
@code{GFC_CAF_ARG_VALUE} (4) whether the arguments shall be passed by value,
|
|
|
|
@code{GFC_CAF_ARG_DESC} (8) whether the arguments shall be passed by descriptor.
|
|
|
|
|
|
|
|
|
|
|
|
@item @emph{Syntax}:
|
|
|
|
@code{void _gfortran_caf_co_reduce (gfc_descriptor_t *a,
|
|
|
|
void * (*opr) (void *, void *), int opr_flags, int result_image,
|
|
|
|
int *stat, char *errmsg, int a_len, int errmsg_len)}
|
|
|
|
|
|
|
|
@item @emph{Arguments}:
|
|
|
|
@multitable @columnfractions .15 .70
|
|
|
|
@item @var{opr} @tab Function pointer to the reduction function.
|
|
|
|
@item @var{opr_flags} @tab Flags regarding the reduction function
|
|
|
|
@item @var{a} @tab intent(inout) And array descriptor with the data to be
|
|
|
|
breoadcasted (on @var{source_image}) or to be received (other images).
|
|
|
|
@item @var{result_image} @tab The ID of the image to which the reduced
|
|
|
|
value should be copied to; if zero, it has to be copied to all images.
|
2015-03-21 09:31:17 +01:00
|
|
|
@item @var{stat} @tab intent(out) Stores the status STAT= and may be NULL.
|
2014-10-24 22:52:41 +02:00
|
|
|
@item @var{errmsg} @tab intent(out) When an error occurs, this will be set to
|
|
|
|
an error message; may be NULL
|
|
|
|
@item @var{a_len} @tab The string length of argument @var{a}.
|
|
|
|
@item @var{errmsg_len} @tab the buffer size of errmsg.
|
|
|
|
@end multitable
|
|
|
|
|
|
|
|
@item @emph{NOTES}
|
|
|
|
If @var{result_image} is nonzero, the value on all images except of the
|
|
|
|
specified one become undefined; hence, the library may make use of this.
|
|
|
|
For character arguments, the result is passed as first argument, followed
|
|
|
|
by the result string length, next come the two string arguments, followed
|
|
|
|
by the two hidden arguments. With C binding, there are no hidden arguments
|
|
|
|
and by-reference passing and either only a single character is passed or
|
|
|
|
an array descriptor.
|
|
|
|
@end table
|
|
|
|
|
|
|
|
|
2006-12-17 03:41:48 +01:00
|
|
|
@c Intrinsic Procedures
|
2005-10-30 21:54:43 +01:00
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
|
2006-12-17 03:41:48 +01:00
|
|
|
@include intrinsic.texi
|
|
|
|
|
|
|
|
|
|
|
|
@tex
|
|
|
|
\blankpart
|
|
|
|
@end tex
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
@c Contributing
|
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
|
|
|
|
@node Contributing
|
2006-12-17 03:41:48 +01:00
|
|
|
@unnumbered Contributing
|
2004-05-13 08:41:07 +02:00
|
|
|
@cindex Contributing
|
|
|
|
|
|
|
|
Free software is only possible if people contribute to efforts
|
|
|
|
to create it.
|
|
|
|
We're always in need of more people helping out with ideas
|
|
|
|
and comments, writing documentation and contributing code.
|
|
|
|
|
2006-10-05 01:07:39 +02:00
|
|
|
If you want to contribute to GNU Fortran,
|
2004-05-13 08:41:07 +02:00
|
|
|
have a look at the long lists of projects you can take on.
|
|
|
|
Some of these projects are small,
|
|
|
|
some of them are large;
|
|
|
|
some are completely orthogonal to the rest of what is
|
2006-10-05 01:07:39 +02:00
|
|
|
happening on GNU Fortran,
|
2004-05-13 08:41:07 +02:00
|
|
|
but others are ``mainstream'' projects in need of enthusiastic hackers.
|
|
|
|
All of these projects are important!
|
2011-11-07 23:21:54 +01:00
|
|
|
We will eventually get around to the things here,
|
2004-05-13 08:41:07 +02:00
|
|
|
but they are also things doable by someone who is willing and able.
|
|
|
|
|
|
|
|
@menu
|
|
|
|
* Contributors::
|
|
|
|
* Projects::
|
2006-12-17 03:41:48 +01:00
|
|
|
* Proposed Extensions::
|
2004-05-13 08:41:07 +02:00
|
|
|
@end menu
|
|
|
|
|
|
|
|
|
|
|
|
@node Contributors
|
2006-10-05 01:07:39 +02:00
|
|
|
@section Contributors to GNU Fortran
|
2004-05-13 08:41:07 +02:00
|
|
|
@cindex Contributors
|
|
|
|
@cindex Credits
|
|
|
|
@cindex Authors
|
|
|
|
|
|
|
|
Most of the parser was hand-crafted by @emph{Andy Vaught}, who is
|
|
|
|
also the initiator of the whole project. Thanks Andy!
|
|
|
|
Most of the interface with GCC was written by @emph{Paul Brook}.
|
|
|
|
|
|
|
|
The following individuals have contributed code and/or
|
2006-10-05 01:07:39 +02:00
|
|
|
ideas and significant help to the GNU Fortran project
|
2008-01-24 19:28:11 +01:00
|
|
|
(in alphabetical order):
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
@itemize @minus
|
2008-01-24 19:28:11 +01:00
|
|
|
@item Janne Blomqvist
|
2004-05-13 08:41:07 +02:00
|
|
|
@item Steven Bosscher
|
|
|
|
@item Paul Brook
|
2008-01-24 19:28:11 +01:00
|
|
|
@item Tobias Burnus
|
2006-08-24 01:10:39 +02:00
|
|
|
@item Fran@,{c}ois-Xavier Coudert
|
2008-01-24 19:28:11 +01:00
|
|
|
@item Bud Davis
|
|
|
|
@item Jerry DeLisle
|
2005-10-30 12:15:27 +01:00
|
|
|
@item Erik Edelmann
|
2008-01-24 19:28:11 +01:00
|
|
|
@item Bernhard Fischer
|
|
|
|
@item Daniel Franke
|
|
|
|
@item Richard Guenther
|
|
|
|
@item Richard Henderson
|
|
|
|
@item Katherine Holcomb
|
|
|
|
@item Jakub Jelinek
|
|
|
|
@item Niels Kristian Bech Jensen
|
|
|
|
@item Steven Johnson
|
|
|
|
@item Steven G. Kargl
|
2005-10-30 12:15:27 +01:00
|
|
|
@item Thomas Koenig
|
|
|
|
@item Asher Langton
|
2008-01-24 19:28:11 +01:00
|
|
|
@item H. J. Lu
|
|
|
|
@item Toon Moene
|
|
|
|
@item Brooks Moses
|
|
|
|
@item Andrew Pinski
|
|
|
|
@item Tim Prince
|
|
|
|
@item Christopher D. Rickett
|
2006-08-24 01:10:39 +02:00
|
|
|
@item Richard Sandiford
|
2008-01-24 19:28:11 +01:00
|
|
|
@item Tobias Schl@"uter
|
|
|
|
@item Roger Sayle
|
|
|
|
@item Paul Thomas
|
|
|
|
@item Andy Vaught
|
|
|
|
@item Feng Wang
|
|
|
|
@item Janus Weil
|
2009-06-03 22:32:23 +02:00
|
|
|
@item Daniel Kraft
|
2004-05-13 08:41:07 +02:00
|
|
|
@end itemize
|
|
|
|
|
|
|
|
The following people have contributed bug reports,
|
|
|
|
smaller or larger patches,
|
|
|
|
and much needed feedback and encouragement for the
|
2006-10-05 01:07:39 +02:00
|
|
|
GNU Fortran project:
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
@itemize @minus
|
|
|
|
@item Bill Clodius
|
2008-02-16 15:10:12 +01:00
|
|
|
@item Dominique d'Humi@`eres
|
2004-05-13 08:41:07 +02:00
|
|
|
@item Kate Hedstrom
|
2008-01-24 19:28:11 +01:00
|
|
|
@item Erik Schnetter
|
2009-06-03 22:32:23 +02:00
|
|
|
@item Joost VandeVondele
|
2004-05-13 08:41:07 +02:00
|
|
|
@end itemize
|
|
|
|
|
|
|
|
Many other individuals have helped debug,
|
2006-10-05 01:07:39 +02:00
|
|
|
test and improve the GNU Fortran compiler over the past few years,
|
2006-08-24 01:41:19 +02:00
|
|
|
and we welcome you to do the same!
|
2004-05-13 08:41:07 +02:00
|
|
|
If you already have done so,
|
|
|
|
and you would like to see your name listed in the
|
|
|
|
list above, please contact us.
|
|
|
|
|
|
|
|
|
|
|
|
@node Projects
|
|
|
|
@section Projects
|
|
|
|
|
|
|
|
@table @emph
|
|
|
|
|
|
|
|
@item Help build the test suite
|
2008-02-16 15:10:12 +01:00
|
|
|
Solicit more code for donation to the test suite: the more extensive the
|
|
|
|
testsuite, the smaller the risk of breaking things in the future! We can
|
|
|
|
keep code private on request.
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
@item Bug hunting/squishing
|
2008-02-16 15:10:12 +01:00
|
|
|
Find bugs and write more test cases! Test cases are especially very
|
|
|
|
welcome, because it allows us to concentrate on fixing bugs instead of
|
2010-09-24 08:39:20 +02:00
|
|
|
isolating them. Going through the bugzilla database at
|
2014-05-23 22:32:04 +02:00
|
|
|
@url{https://gcc.gnu.org/@/bugzilla/} to reduce testcases posted there and
|
2008-02-16 15:10:12 +01:00
|
|
|
add more information (for example, for which version does the testcase
|
|
|
|
work, for which versions does it fail?) is also very helpful.
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2008-02-16 15:10:12 +01:00
|
|
|
@end table
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
|
2006-12-17 03:41:48 +01:00
|
|
|
@node Proposed Extensions
|
|
|
|
@section Proposed Extensions
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2006-12-17 03:41:48 +01:00
|
|
|
Here's a list of proposed extensions for the GNU Fortran compiler, in no particular
|
|
|
|
order. Most of these are necessary to be fully compatible with
|
|
|
|
existing Fortran compilers, but they are not part of the official
|
|
|
|
J3 Fortran 95 standard.
|
2004-05-13 08:41:07 +02:00
|
|
|
|
gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
gcc/fortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* gfortran.texi (caf_register_t): Add CAF_REGTYPE_CRITICAL.
(_gfortran_caf_register): Update for locking/critical.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* resolve.c (resolve_critical): New.
(gfc_resolve_code): Call it.
* trans-decl.c (gfor_fndecl_caf_critical,
gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
(gfc_build_builtin_function_decls): Remove critical,
assign locking declarations.
(generate_coarray_sym_init): Handle locking and
critical variables.
* trans-stmt.c (gfc_trans_critical): Add calls to
lock/unlock libcaf functions.
* trans.h (gfc_coarray_type): Update locking, add
critical enum values.
(gfor_fndecl_caf_critical, gfor_fndecl_caf_end_critical): Remove.
(gfor_fndecl_caf_lock, gfor_fndecl_caf_unlock): Add.
libgfortran/
2014-08-14 Tobias Burnus <burnus@net-b.de>
* caf/libcaf.h (caf_register_t): Update for critical.
(_gfortran_caf_critical, _gfortran_caf_end_critical): Remove.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
* caf/single.c (_gfortran_caf_register): Handle locking
variables.
(_gfortran_caf_sendget): Re-name args for consistency.
(_gfortran_caf_lock, _gfortran_caf_unlock): Add.
From-SVN: r213979
2014-08-14 20:39:15 +02:00
|
|
|
@subsection Compiler extensions:
|
2006-12-17 03:41:48 +01:00
|
|
|
@itemize @bullet
|
|
|
|
@item
|
|
|
|
User-specified alignment rules for structures.
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2006-12-17 03:41:48 +01:00
|
|
|
@item
|
|
|
|
Automatically extend single precision constants to double.
|
2005-09-08 21:42:59 +02:00
|
|
|
|
2006-12-17 03:41:48 +01:00
|
|
|
@item
|
|
|
|
Compile code that conserves memory by dynamically allocating common and
|
|
|
|
module storage either on stack or heap.
|
2005-09-08 21:42:59 +02:00
|
|
|
|
2006-12-17 03:41:48 +01:00
|
|
|
@item
|
|
|
|
Compile flag to generate code for array conformance checking (suggest -CC).
|
2005-09-08 21:42:59 +02:00
|
|
|
|
2006-12-17 03:41:48 +01:00
|
|
|
@item
|
|
|
|
User control of symbol names (underscores, etc).
|
2005-09-08 21:42:59 +02:00
|
|
|
|
2006-12-17 03:41:48 +01:00
|
|
|
@item
|
|
|
|
Compile setting for maximum size of stack frame size before spilling
|
|
|
|
parts to static or heap.
|
2005-09-08 21:42:59 +02:00
|
|
|
|
2005-10-30 21:54:43 +01:00
|
|
|
@item
|
2006-12-17 03:41:48 +01:00
|
|
|
Flag to force local variables into static space.
|
2005-09-09 21:20:52 +02:00
|
|
|
|
|
|
|
@item
|
2006-12-17 03:41:48 +01:00
|
|
|
Flag to force local variables onto stack.
|
|
|
|
@end itemize
|
|
|
|
|
|
|
|
|
|
|
|
@subsection Environment Options
|
|
|
|
@itemize @bullet
|
2006-03-05 20:24:48 +01:00
|
|
|
@item
|
2006-12-17 03:41:48 +01:00
|
|
|
Pluggable library modules for random numbers, linear algebra.
|
|
|
|
LA should use BLAS calling conventions.
|
|
|
|
|
2006-03-11 00:28:38 +01:00
|
|
|
@item
|
2006-12-17 03:41:48 +01:00
|
|
|
Environment variables controlling actions on arithmetic exceptions like
|
|
|
|
overflow, underflow, precision loss---Generate NaN, abort, default.
|
|
|
|
action.
|
|
|
|
|
2006-10-01 02:51:21 +02:00
|
|
|
@item
|
2006-12-17 03:41:48 +01:00
|
|
|
Set precision for fp units that support it (i387).
|
2006-03-05 20:24:48 +01:00
|
|
|
|
2006-08-20 11:22:04 +02:00
|
|
|
@item
|
2006-12-17 03:41:48 +01:00
|
|
|
Variable for setting fp rounding mode.
|
2006-08-20 11:22:04 +02:00
|
|
|
|
2006-11-08 10:23:53 +01:00
|
|
|
@item
|
2006-12-17 03:41:48 +01:00
|
|
|
Variable to fill uninitialized variables with a user-defined bit
|
|
|
|
pattern.
|
2006-11-08 10:23:53 +01:00
|
|
|
|
2006-12-10 22:22:49 +01:00
|
|
|
@item
|
2006-12-17 03:41:48 +01:00
|
|
|
Environment variable controlling filename that is opened for that unit
|
|
|
|
number.
|
2006-12-10 22:22:49 +01:00
|
|
|
|
|
|
|
@item
|
2006-12-17 03:41:48 +01:00
|
|
|
Environment variable to clear/trash memory being freed.
|
2006-12-10 22:22:49 +01:00
|
|
|
|
2006-11-08 10:23:53 +01:00
|
|
|
@item
|
2006-12-17 03:41:48 +01:00
|
|
|
Environment variable to control tracing of allocations and frees.
|
2006-08-20 11:22:04 +02:00
|
|
|
|
2006-11-15 16:46:42 +01:00
|
|
|
@item
|
2006-12-17 03:41:48 +01:00
|
|
|
Environment variable to display allocated memory at normal program end.
|
2006-11-15 16:46:42 +01:00
|
|
|
|
2006-12-10 22:22:49 +01:00
|
|
|
@item
|
2006-12-17 03:41:48 +01:00
|
|
|
Environment variable for filename for * IO-unit.
|
|
|
|
|
|
|
|
@item
|
|
|
|
Environment variable for temporary file directory.
|
|
|
|
|
|
|
|
@item
|
2013-02-07 12:08:20 +01:00
|
|
|
Environment variable forcing standard output to be line buffered (Unix).
|
2006-08-20 11:22:04 +02:00
|
|
|
|
2005-09-08 21:42:59 +02:00
|
|
|
@end itemize
|
|
|
|
|
|
|
|
|
2005-10-30 21:54:43 +01:00
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
@c GNU General Public License
|
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
|
2008-04-01 18:38:56 +02:00
|
|
|
@include gpl_v3.texi
|
2005-10-30 21:54:43 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
@c GNU Free Documentation License
|
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
|
|
|
|
@include fdl.texi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
@c Funding Free Software
|
|
|
|
@c ---------------------------------------------------------------------
|
|
|
|
|
|
|
|
@include funding.texi
|
|
|
|
|
2005-09-08 21:42:59 +02:00
|
|
|
@c ---------------------------------------------------------------------
|
2007-04-27 18:52:10 +02:00
|
|
|
@c Indices
|
2005-09-08 21:42:59 +02:00
|
|
|
@c ---------------------------------------------------------------------
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2007-04-27 18:52:10 +02:00
|
|
|
@node Option Index
|
2007-04-29 12:49:08 +02:00
|
|
|
@unnumbered Option Index
|
2007-04-27 21:38:29 +02:00
|
|
|
@command{gfortran}'s command line options are indexed here without any
|
2010-09-24 08:39:20 +02:00
|
|
|
initial @samp{-} or @samp{--}. Where an option has both positive and
|
2007-04-27 21:38:29 +02:00
|
|
|
negative forms (such as -foption and -fno-option), relevant entries in
|
|
|
|
the manual are indexed under the most appropriate form; it may sometimes
|
|
|
|
be useful to look up both forms.
|
2007-04-27 18:52:10 +02:00
|
|
|
@printindex op
|
|
|
|
|
|
|
|
@node Keyword Index
|
2007-04-29 12:49:08 +02:00
|
|
|
@unnumbered Keyword Index
|
2004-05-13 08:41:07 +02:00
|
|
|
@printindex cp
|
|
|
|
|
|
|
|
@bye
|