📄 gfortran.texi
字号:
@command{-Wl,--whole-archive -lpthread -Wl,--no-whole-archive} is addedto the command line. However, this is not supported by @command{gcc} andthus not recommended.@end itemize@node Argument list functions@subsection Argument list functions @code{%VAL}, @code{%REF} and @code{%LOC}@cindex argument list functions@cindex @code{%VAL}@cindex @code{%REF}@cindex @code{%LOC}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 or windowing facilities. It is best to constrain such uses to isolated portions of a program--portions that deal specifically and exclusively with low-level, system-dependent facilities. Such portions might well 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 a do-nothing. @code{%LOC} has the same effect as a fortran pointer.An example of passing an argument by value to a C subroutine foo.:@smallexampleCC prototype void foo_ (float x);C external foo real*4 x x = 3.14159 call foo (%VAL (x)) end@end smallexampleFor details refer to the g77 manual@uref{http://gcc.gnu.org/onlinedocs/gcc-3.4.6/g77/index.html#Top}.Also, the gfortran testsuite c_by_val.f and its partner c_by_val.c areworth a look.@node Extensions not implemented in GNU Fortran@section Extensions not implemented in GNU Fortran@cindex extensions, not implementedThe long history of the Fortran language, its wide use and broaduserbase, the large number of different compiler vendors and the lack ofsome features crucial to users in the first standards have lead to theexistence of an important number of extensions to the language. Whilesome of the most useful or popular extensions are supported by the GNUFortran compiler, not all existing extensions are supported. This sectionaims at listing these extensions and offering advice on how best makecode that uses them running with the GNU Fortran compiler.@c More can be found here:@c -- http://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* STRUCTURE and RECORD::@c * UNION and MAP::* ENCODE and DECODE statements::@c * Expressions in FORMAT statements::@c * Q edit descriptor::@c * AUTOMATIC statement::@c * TYPE and ACCEPT I/O Statements::@c * .XOR. operator::@c * CARRIAGECONTROL, DEFAULTFILE, DISPOSE and RECORDTYPE I/O specifiers::@c * Omitted arguments in procedure call:@end menu@node STRUCTURE and RECORD@subsection @code{STRUCTURE} and @code{RECORD}@cindex @code{STRUCTURE}@cindex @code{RECORD}Structures are user-defined aggregate data types; this functionality wasstandardized in Fortran 90 with an different syntax, under the name of``derived types''. Here is an example of code using the non portablestructure syntax:@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 priceEND 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 variablespear.id = 92316pear.description = "juicy D'Anjou pear"pear.price = 0.15store_catalog(7).id = 7831store_catalog(7).description = "milk bottle"store_catalog(7).price = 1.2! We can also manipulates the whole structurestore_catalog(12) = pearprint *, store_catalog(12)@end example@noindentThis 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 priceEND 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 = 92316pear%description = "juicy D'Anjou pear"pear%price = 0.15store_catalog(7)%id = 7831store_catalog(7)%description = "milk bottle"store_catalog(7)%price = 1.2! Assignments of a whole variable don't changestore_catalog(12) = pearprint *, store_catalog(12)@end example@c @node UNION and MAP@c @subsection @code{UNION} and @code{MAP}@c @cindex @code{UNION}@c @cindex @code{MAP}@c@c For help writing this one, see@c http://www.eng.umd.edu/~nsw/ench250/fortran1.htm#UNION and@c http://www.tacc.utexas.edu/services/userguides/pgi/pgiws_ug/pgi32u06.htm@node ENCODE and DECODE statements@subsection @code{ENCODE} and @code{DECODE} statements@cindex @code{ENCODE}@cindex @code{DECODE}GNU Fortran doesn't support the @code{ENCODE} and @code{DECODE}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 sinceFortran 77. For example, replace a code fragment like@smallexample INTEGER*1 LINE(80) REAL A, B, Cc ... Code that sets LINE DECODE (80, 9000, LINE) A, B, C 9000 FORMAT (1X, 3(F10.5))@end smallexample@noindentwith the following:@smallexample CHARACTER(LEN=80) LINE REAL A, B, Cc ... Code that sets LINE READ (UNIT=LINE, FMT=9000) A, B, C 9000 FORMAT (1X, 3(F10.5))@end smallexampleSimilarly, replace a code fragment like@smallexample INTEGER*1 LINE(80) REAL A, B, Cc ... Code that sets A, B and C ENCODE (80, 9000, LINE) A, B, C 9000 FORMAT (1X, 'OUTPUT IS ', 3(F10.5))@end smallexample@noindentwith the following:@smallexample INTEGER*1 LINE(80) REAL A, B, Cc ... 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@c ---------------------------------------------------------------------@c Intrinsic Procedures@c ---------------------------------------------------------------------@include intrinsic.texi@tex\blankpart@end tex@c ---------------------------------------------------------------------@c Contributing@c ---------------------------------------------------------------------@node Contributing@unnumbered Contributing@cindex ContributingFree software is only possible if people contribute to effortsto create it.We're always in need of more people helping out with ideasand comments, writing documentation and contributing code.If you want to contribute to GNU Fortran,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 ishappening on GNU Fortran,but others are ``mainstream'' projects in need of enthusiastic hackers.All of these projects are important!We'll eventually get around to the things here,but they are also things doable by someone who is willing and able.@menu* Contributors::* Projects::* Proposed Extensions::@end menu@node Contributors@section Contributors to GNU Fortran@cindex Contributors@cindex Credits@cindex AuthorsMost of the parser was hand-crafted by @emph{Andy Vaught}, who isalso 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/orideas and significant help to the GNU Fortran project(in alphabetical order):@itemize @minus@item Janne Blomqvist@item Steven Bosscher@item Paul Brook@item Tobias Burnus@item Fran@,{c}ois-Xavier Coudert@item Bud Davis@item Jerry DeLisle@item Erik Edelmann@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@item Thomas Koenig@item Asher Langton@item H. J. Lu@item Toon Moene@item Brooks Moses@item Andrew Pinski@item Tim Prince@item Christopher D. Rickett@item Richard Sandiford@item Tobias Schl@"uter@item Roger Sayle@item Paul Thomas@item Andy Vaught@item Feng Wang@item Janus Weil@end itemizeThe following people have contributed bug reports,smaller or larger patches,and much needed feedback and encouragement for theGNU Fortran project: @itemize @minus@item Bill Clodius@item Dominique d'Humi@`eres@item Kate Hedstrom@item Erik Schnetter@end itemizeMany other individuals have helped debug,test and improve the GNU Fortran compiler over the past few years,and we welcome you to do the same!If you already have done so,and you would like to see your name listed in thelist above, please contact us.@node Projects@section Projects@table @emph@item Help build the test suiteSolicit more code for donation to the test suite: the more extensive thetestsuite, the smaller the risk of breaking things in the future! We cankeep code private on request.@item Bug hunting/squishingFind bugs and write more test cases! Test cases are especially verywelcome, because it allows us to concentrate on fixing bugs instead ofisolating them. Going through the bugzilla database at@url{http://gcc.gnu.org/bugzilla/} to reduce testcases posted there andadd more information (for example, for which version does the testcasework, for which versions does it fail?) is also very helpful.@end table@node Proposed Extensions@section Proposed ExtensionsHere's a list of proposed extensions for the GNU Fortran compiler, in no particularorder. Most of these are necessary to be fully compatible withexisting Fortran compilers, but they are not part of the officialJ3 Fortran 95 standard.@subsection Compiler extensions: @itemize @bullet@itemUser-specified alignment rules for structures.@itemFlag to generate @code{Makefile} info.@itemAutomatically extend single precision constants to double.@itemCompile code that conserves memory by dynamically allocating common andmodule storage either on stack or heap.@itemCompile flag to generate code for array conforma
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -