* Fortran: Use non conflicting file extensions for intermediates [PR81615]
@ 2023-12-20 4:32 Rimvydas Jasinskas
2023-12-20 19:29 ` Harald Anlauf
0 siblings, 1 reply; 13+ messages in thread
From: Rimvydas Jasinskas @ 2023-12-20 4:32 UTC (permalink / raw)
To: Rimvydas Jasinskas via Fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 470 bytes --]
Dear all,
In the spirit of c/c++ using the .i/.ii extensions for intermediates,
use the .fi/.fii intermediate extensions for gfortran fixed/free form
sources when -save-temps is invoked to avoid various issues.
The documentation part will be submitted separately, because it
involves adding a "Developer options" mini-section (as suggested by
Harald) and moving the -fdump-* options from "Options for debugging
your program or GNU Fortran" section.
Regards,
Rimvydas
[-- Attachment #2: 0001-Fortran-Use-non-conflicting-file-extensions-for-inte.patch --]
[-- Type: text/x-patch, Size: 3610 bytes --]
From d313ccb110c5418260b667c5f289a249247de059 Mon Sep 17 00:00:00 2001
From: Rimvydas Jasinskas <rimvydas.jas@gmail.com>
Date: Wed, 20 Dec 2023 03:39:33 +0000
Subject: Fortran: Use non conflicting file extensions for intermediates
[PR81615]
gcc/ChangeLog:
* doc/invoke.texi: Document the new file extensions
gcc/fortran/ChangeLog:
PR fortran/81615
* lang-specs.h (F951_CPP_OPTIONS): Do not hardcode ".f90" extension
(F951_CPP_EXTENSION): Use .fi/.fii for fixed/free form sources
* options.cc (form_from_filename): Handle the new extensions
Signed-off-by: Rimvydas Jasinskas <rimvydas.jas@gmail.com>
---
gcc/doc/invoke.texi | 2 ++
gcc/fortran/lang-specs.h | 10 +++++++++-
gcc/fortran/options.cc | 6 ++++++
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 940adbce1bd..22313a86d9a 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -1591,6 +1591,7 @@ C++ header file to be turned into a precompiled header or Ada spec.
@item @var{file}.f
@itemx @var{file}.for
@itemx @var{file}.ftn
+@itemx @var{file}.fi
Fixed form Fortran source code that should not be preprocessed.
@item @var{file}.F
@@ -1605,6 +1606,7 @@ preprocessor).
@itemx @var{file}.f95
@itemx @var{file}.f03
@itemx @var{file}.f08
+@itemx @var{file}.fii
Free form Fortran source code that should not be preprocessed.
@item @var{file}.F90
diff --git a/gcc/fortran/lang-specs.h b/gcc/fortran/lang-specs.h
index 7b298457613..5b1ea00cf0d 100644
--- a/gcc/fortran/lang-specs.h
+++ b/gcc/fortran/lang-specs.h
@@ -29,7 +29,8 @@
/* Options that f951 should know about, even if not preprocessing. */
#define CPP_FORWARD_OPTIONS "%{i*} %{I*} %{M*}"
-#define F951_CPP_OPTIONS "%{!nocpp: -cpp=%g.f90 %{E} %(cpp_unique_options) \
+#define F951_CPP_OPTIONS "%{!nocpp: -cpp=%g" F951_CPP_EXTENSION \
+ " %{E} %(cpp_unique_options) \
%{E|M|MM:%(cpp_debug_options) " CPP_ONLY_OPTIONS \
" -fsyntax-only};: " CPP_FORWARD_OPTIONS "}"
@@ -44,6 +45,7 @@
#define F951_SOURCE_FORM "%{!ffree-form:-ffixed-form}"
+#define F951_CPP_EXTENSION ".fi"
{".F", "@f77-cpp-input", 0, 0, 0},
{".FOR", "@f77-cpp-input", 0, 0, 0},
{".FTN", "@f77-cpp-input", 0, 0, 0},
@@ -55,11 +57,15 @@
{".f", "@f77", 0, 0, 0},
{".for", "@f77", 0, 0, 0},
{".ftn", "@f77", 0, 0, 0},
+{".fi", "@f77", 0, 0, 0},
{"@f77",
"f951 %i " F951_SOURCE_FORM " \
%{E:%{!cpp:%egfortran does not support -E without -cpp}} \
%{cpp:" F951_CPP_OPTIONS ";: " CPP_FORWARD_OPTIONS "} \
%{!E:" F951_OPTIONS "}", 0, 0, 0},
+
+#undef F951_CPP_EXTENSION
+#define F951_CPP_EXTENSION ".fii"
{".F90", "@f95-cpp-input", 0, 0, 0},
{".F95", "@f95-cpp-input", 0, 0, 0},
{".F03", "@f95-cpp-input", 0, 0, 0},
@@ -70,6 +76,7 @@
{".f95", "@f95", 0, 0, 0},
{".f03", "@f95", 0, 0, 0},
{".f08", "@f95", 0, 0, 0},
+{".fii", "@f95", 0, 0, 0},
{"@f95",
"f951 %i %{E:%{!cpp:%egfortran does not support -E without -cpp}}\
%{cpp:" F951_CPP_OPTIONS ";: " CPP_FORWARD_OPTIONS "} \
@@ -79,5 +86,6 @@
#undef CPP_ONLY_OPTIONS
#undef CPP_FORWARD_OPTIONS
#undef F951_SOURCE_FORM
+#undef F951_CPP_EXTENSION
#undef F951_CPP_OPTIONS
#undef F951_OPTIONS
diff --git a/gcc/fortran/options.cc b/gcc/fortran/options.cc
index 02a29f83b58..53a6e8553bb 100644
--- a/gcc/fortran/options.cc
+++ b/gcc/fortran/options.cc
@@ -199,6 +199,12 @@ form_from_filename (const char *filename)
".f08", FORM_FREE}
,
{
+ ".fii", FORM_FREE}
+ ,
+ {
+ ".fi", FORM_FIXED}
+ ,
+ {
".f", FORM_FIXED}
,
{
--
2.43.0
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Fortran: Use non conflicting file extensions for intermediates [PR81615]
2023-12-20 4:32 Fortran: Use non conflicting file extensions for intermediates [PR81615] Rimvydas Jasinskas
@ 2023-12-20 19:29 ` Harald Anlauf
2023-12-20 19:29 ` Harald Anlauf
2023-12-24 1:33 ` Rimvydas Jasinskas
0 siblings, 2 replies; 13+ messages in thread
From: Harald Anlauf @ 2023-12-20 19:29 UTC (permalink / raw)
To: Rimvydas Jasinskas, Rimvydas Jasinskas via Fortran, gcc-patches
Am 20.12.23 um 05:32 schrieb Rimvydas Jasinskas:
> Dear all,
>
> In the spirit of c/c++ using the .i/.ii extensions for intermediates,
> use the .fi/.fii intermediate extensions for gfortran fixed/free form
> sources when -save-temps is invoked to avoid various issues.
I checked with Jerry on Mattermost that there are no objections
regarding the suffixes.
Pushed: https://gcc.gnu.org/g:ba615557a4c698d27042a5fe058ea6e721a03b12
Thanks for the patch!
> The documentation part will be submitted separately, because it
> involves adding a "Developer options" mini-section (as suggested by
> Harald) and moving the -fdump-* options from "Options for debugging
> your program or GNU Fortran" section.
Documentation improvements are always great!
> Regards,
> Rimvydas
Cheers,
Harald
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Fortran: Use non conflicting file extensions for intermediates [PR81615]
2023-12-20 19:29 ` Harald Anlauf
@ 2023-12-20 19:29 ` Harald Anlauf
2023-12-24 1:33 ` Rimvydas Jasinskas
1 sibling, 0 replies; 13+ messages in thread
From: Harald Anlauf @ 2023-12-20 19:29 UTC (permalink / raw)
To: gcc-patches; +Cc: fortran
Am 20.12.23 um 05:32 schrieb Rimvydas Jasinskas:
> Dear all,
>
> In the spirit of c/c++ using the .i/.ii extensions for intermediates,
> use the .fi/.fii intermediate extensions for gfortran fixed/free form
> sources when -save-temps is invoked to avoid various issues.
I checked with Jerry on Mattermost that there are no objections
regarding the suffixes.
Pushed: https://gcc.gnu.org/g:ba615557a4c698d27042a5fe058ea6e721a03b12
Thanks for the patch!
> The documentation part will be submitted separately, because it
> involves adding a "Developer options" mini-section (as suggested by
> Harald) and moving the -fdump-* options from "Options for debugging
> your program or GNU Fortran" section.
Documentation improvements are always great!
> Regards,
> Rimvydas
Cheers,
Harald
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Fortran: Use non conflicting file extensions for intermediates [PR81615]
2023-12-20 19:29 ` Harald Anlauf
2023-12-20 19:29 ` Harald Anlauf
@ 2023-12-24 1:33 ` Rimvydas Jasinskas
2023-12-27 20:34 ` Harald Anlauf
2023-12-30 11:01 ` Thomas Koenig
1 sibling, 2 replies; 13+ messages in thread
From: Rimvydas Jasinskas @ 2023-12-24 1:33 UTC (permalink / raw)
To: Rimvydas Jasinskas via Fortran; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 225 bytes --]
Documentation part.
The makeinfo gcc/fortran/gfortran.texi does not seem to have any new warnings.
Is there a specific reason thy -fc-prototypes (Interoperability
Options section) is excluded from manpage?
Regards,
Rimvydas
[-- Attachment #2: 0001-Fortran-Add-Developer-Options-mini-section-to-docume.patch --]
[-- Type: text/x-patch, Size: 8035 bytes --]
From 3adb6cd8a2aa1576a8ff63b280239e725f1f112e Mon Sep 17 00:00:00 2001
From: Rimvydas Jasinskas <rimvydas.jas@gmail.com>
Date: Sat, 23 Dec 2023 18:59:09 +0000
Subject: Fortran: Add Developer Options mini-section to documentation
Separate out -fdump-* options to the new section. Sort by option name.
While there, document -save-temps intermediates.
gcc/fortran/ChangeLog:
* invoke.texi: Add Developer Options section. Move '-fdump-*'
to it. Add small examples about changed '-save-temps' behavior.
Signed-off-by: Rimvydas Jasinskas <rimvydas.jas@gmail.com>
---
gcc/fortran/invoke.texi | 117 ++++++++++++++++++++++++++--------------
1 file changed, 77 insertions(+), 40 deletions(-)
diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi
index c7fd019a7c5..6b85fb8dff0 100644
--- a/gcc/fortran/invoke.texi
+++ b/gcc/fortran/invoke.texi
@@ -94,12 +94,13 @@ one is not the default.
compiled.
* Preprocessing Options:: Enable and customize preprocessing.
* Error and Warning Options:: How picky should the compiler be?
-* Debugging Options:: Symbol tables, measurements, and debugging dumps.
+* Debugging Options:: Symbol tables, measurements.
* Directory Options:: Where to find module files
* Link Options :: Influencing the linking step
* Runtime Options:: Influencing runtime behavior
* Code Gen Options:: Specifying conventions for function calls, data layout
and register usage.
+* Developer Options:: Printing GNU Fortran specific info, debugging dumps.
* Interoperability Options:: Options for interoperability with other
languages.
* Environment Variables:: Environment variables that affect @command{gfortran}.
@@ -159,9 +160,8 @@ and warnings}.
}
@item Debugging Options
-@xref{Debugging Options,,Options for debugging your program or GNU Fortran}.
-@gccoptlist{-fbacktrace -fdump-fortran-optimized -fdump-fortran-original
--fdebug-aux-vars -fdump-fortran-global -fdump-parse-tree -ffpe-trap=@var{list}
+@xref{Debugging Options,,Options for debugging your program}.
+@gccoptlist{-fbacktrace -fdebug-aux-vars -ffpe-trap=@var{list}
-ffpe-summary=@var{list}
}
@@ -201,6 +201,12 @@ and warnings}.
-fpack-derived -frealloc-lhs -frecursive -frepack-arrays
-fshort-enums -fstack-arrays
}
+
+@item Developer Options
+@xref{Developer Options,,GNU Fortran Developer Options}.
+@gccoptlist{-fdump-fortran-global -fdump-fortran-optimized
+-fdump-fortran-original -fdump-parse-tree -save-temps
+}
@end table
@node Fortran Dialect Options
@@ -1280,40 +1286,14 @@ and other GNU compilers.
Some of these have no effect when compiling programs written in Fortran.
@node Debugging Options
-@section Options for debugging your program or GNU Fortran
+@section Options for debugging your program
@cindex options, debugging
@cindex debugging information options
GNU Fortran has various special options that are used for debugging
-either your program or the GNU Fortran compiler.
+your program.
@table @gcctabopt
-@opindex @code{fdump-fortran-original}
-@item -fdump-fortran-original
-Output the internal parse tree after translating the source program
-into internal representation. This option is mostly useful for
-debugging the GNU Fortran compiler itself. The output generated by
-this option might change between releases. This option may also
-generate internal compiler errors for features which have only
-recently been added.
-
-@opindex @code{fdump-fortran-optimized}
-@item -fdump-fortran-optimized
-Output the parse tree after front-end optimization. Mostly useful for
-debugging the GNU Fortran compiler itself. The output generated by
-this option might change between releases. This option may also
-generate internal compiler errors for features which have only
-recently been added.
-
-@opindex @code{fdump-parse-tree}
-@item -fdump-parse-tree
-Output the internal parse tree after translating the source program
-into internal representation. Mostly useful for debugging the GNU
-Fortran compiler itself. The output generated by this option might
-change between releases. This option may also generate internal
-compiler errors for features which have only recently been added. This
-option is deprecated; use @code{-fdump-fortran-original} instead.
-
@opindex @code{fdebug-aux-vars}
@item -fdebug-aux-vars
Renames internal variables created by the gfortran front end and makes
@@ -1323,14 +1303,6 @@ useful for debugging the compiler's code generation together with
@code{-fdump-tree-original} and enabling debugging of the executable
program by using @code{-g} or @code{-ggdb3}.
-@opindex @code{fdump-fortran-global}
-@item -fdump-fortran-global
-Output a list of the global identifiers after translating into
-middle-end representation. Mostly useful for debugging the GNU Fortran
-compiler itself. The output generated by this option might change
-between releases. This option may also generate internal compiler
-errors for features which have only recently been added.
-
@opindex @code{ffpe-trap=}@var{list}
@item -ffpe-trap=@var{list}
Specify a list of floating point exception traps to enable. On most
@@ -1543,6 +1515,71 @@ and regards zero as positive number in the @code{SIGN} intrinsic for
compatibility with Fortran 77. The default is @option{-fsign-zero}.
@end table
+@node Developer Options
+@section GNU Fortran Developer Options
+@cindex options, debugging
+@cindex developer options
+
+GNU Fortran has various special options that are used for debugging
+the GNU Fortran compiler.
+
+@table @gcctabopt
+@opindex @code{fdump-fortran-global}
+@item -fdump-fortran-global
+Output a list of the global identifiers after translating into
+middle-end representation. Mostly useful for debugging the GNU Fortran
+compiler itself. The output generated by this option might change
+between releases. This option may also generate internal compiler
+errors for features which have only recently been added.
+
+@opindex @code{fdump-fortran-optimized}
+@item -fdump-fortran-optimized
+Output the parse tree after front-end optimization. Mostly useful for
+debugging the GNU Fortran compiler itself. The output generated by
+this option might change between releases. This option may also
+generate internal compiler errors for features which have only
+recently been added.
+
+@opindex @code{fdump-fortran-original}
+@item -fdump-fortran-original
+Output the internal parse tree after translating the source program
+into internal representation. This option is mostly useful for
+debugging the GNU Fortran compiler itself. The output generated by
+this option might change between releases. This option may also
+generate internal compiler errors for features which have only
+recently been added.
+
+@opindex @code{fdump-parse-tree}
+@item -fdump-parse-tree
+Output the internal parse tree after translating the source program
+into internal representation. Mostly useful for debugging the GNU
+Fortran compiler itself. The output generated by this option might
+change between releases. This option may also generate internal
+compiler errors for features which have only recently been added. This
+option is deprecated; use @code{-fdump-fortran-original} instead.
+
+@item -save-temps
+Store the usual ``temporary'' intermediate files permanently; name them
+as auxiliary output files, as specified described under GCC
+@option{-dumpbase} and @option{-dumpdir}.
+
+@smallexample
+gfortran -save-temps -c foo.F90
+@end smallexample
+
+preprocesses to in @file{foo.fii}, compiles to an intermediate
+@file{foo.s}, and then assembles to the (implied) output file
+@file{foo.o}, whereas:
+
+@smallexample
+gfortran -save-temps -S foo.F
+@end smallexample
+
+saves the (no longer) temporary preprocessed file in @file{foo.fi}, and
+then compiles to the (implied) output file @file{foo.s}.
+
+@end table
+
@node Code Gen Options
@section Options for code generation conventions
@cindex code generation, conventions
--
2.43.0
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Fortran: Use non conflicting file extensions for intermediates [PR81615]
2023-12-24 1:33 ` Rimvydas Jasinskas
@ 2023-12-27 20:34 ` Harald Anlauf
2023-12-27 20:34 ` Harald Anlauf
2023-12-28 7:09 ` Rimvydas Jasinskas
2023-12-30 11:01 ` Thomas Koenig
1 sibling, 2 replies; 13+ messages in thread
From: Harald Anlauf @ 2023-12-27 20:34 UTC (permalink / raw)
To: Rimvydas Jasinskas, Rimvydas Jasinskas via Fortran; +Cc: gcc-patches
Hi Rimvydas!
Am 24.12.23 um 02:33 schrieb Rimvydas Jasinskas:
> Documentation part.
> The makeinfo gcc/fortran/gfortran.texi does not seem to have any new warnings.
The patch is almost fine, except for a strange wording here:
+@smallexample
+gfortran -save-temps -c foo.F90
+@end smallexample
+
+preprocesses to in @file{foo.fii}, compiles to an intermediate
+@file{foo.s}, and then assembles to the (implied) output file
+@file{foo.o}, whereas:
I understand the formulation is copied from gcc/doc/invoke.texi,
where it does not fully make sense to me either.
How about:
"preprocesses input file @file{foo.F90} to @file{foo.fii}, ..."
Furthermore,
+@smallexample
+gfortran -save-temps -S foo.F
+@end smallexample
+
+saves the (no longer) temporary preprocessed file in @file{foo.fi}, and
+then compiles to the (implied) output file @file{foo.s}.
Even if this is copied from the gcc texinfo file, how about:
"saves the preprocessor output in @file{foo.fi}, ..."
which I find easier to read.
Can you also add a reference to the PR number in the commit message?
> Is there a specific reason thy -fc-prototypes (Interoperability
> Options section) is excluded from manpage?
Can you be more specific? I get here (since gcc-9):
% man /opt/gcc/14/share/man/man1/gfortran.1 |grep -A 1 "Interoperability
Options"
Interoperability Options
-fc-prototypes -fc-prototypes-external
although no detailed explanation (-> gfortran.info).
> Regards,
> Rimvydas
Thanks,
Harald
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Fortran: Use non conflicting file extensions for intermediates [PR81615]
2023-12-27 20:34 ` Harald Anlauf
@ 2023-12-27 20:34 ` Harald Anlauf
2023-12-28 7:09 ` Rimvydas Jasinskas
1 sibling, 0 replies; 13+ messages in thread
From: Harald Anlauf @ 2023-12-27 20:34 UTC (permalink / raw)
To: gcc-patches; +Cc: fortran
Hi Rimvydas!
Am 24.12.23 um 02:33 schrieb Rimvydas Jasinskas:
> Documentation part.
> The makeinfo gcc/fortran/gfortran.texi does not seem to have any new warnings.
The patch is almost fine, except for a strange wording here:
+@smallexample
+gfortran -save-temps -c foo.F90
+@end smallexample
+
+preprocesses to in @file{foo.fii}, compiles to an intermediate
+@file{foo.s}, and then assembles to the (implied) output file
+@file{foo.o}, whereas:
I understand the formulation is copied from gcc/doc/invoke.texi,
where it does not fully make sense to me either.
How about:
"preprocesses input file @file{foo.F90} to @file{foo.fii}, ..."
Furthermore,
+@smallexample
+gfortran -save-temps -S foo.F
+@end smallexample
+
+saves the (no longer) temporary preprocessed file in @file{foo.fi}, and
+then compiles to the (implied) output file @file{foo.s}.
Even if this is copied from the gcc texinfo file, how about:
"saves the preprocessor output in @file{foo.fi}, ..."
which I find easier to read.
Can you also add a reference to the PR number in the commit message?
> Is there a specific reason thy -fc-prototypes (Interoperability
> Options section) is excluded from manpage?
Can you be more specific? I get here (since gcc-9):
% man /opt/gcc/14/share/man/man1/gfortran.1 |grep -A 1 "Interoperability
Options"
Interoperability Options
-fc-prototypes -fc-prototypes-external
although no detailed explanation (-> gfortran.info).
> Regards,
> Rimvydas
Thanks,
Harald
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Fortran: Use non conflicting file extensions for intermediates [PR81615]
2023-12-27 20:34 ` Harald Anlauf
2023-12-27 20:34 ` Harald Anlauf
@ 2023-12-28 7:09 ` Rimvydas Jasinskas
2023-12-28 20:31 ` Harald Anlauf
1 sibling, 1 reply; 13+ messages in thread
From: Rimvydas Jasinskas @ 2023-12-28 7:09 UTC (permalink / raw)
To: Harald Anlauf; +Cc: Rimvydas Jasinskas via Fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 2070 bytes --]
On Wed, Dec 27, 2023 at 10:34 PM Harald Anlauf <anlauf@gmx.de> wrote:
> The patch is almost fine, except for a strange wording here:
>
> +@smallexample
> +gfortran -save-temps -c foo.F90
> +@end smallexample
> +
> +preprocesses to in @file{foo.fii}, compiles to an intermediate
> +@file{foo.s}, and then assembles to the (implied) output file
> +@file{foo.o}, whereas:
>
> I understand the formulation is copied from gcc/doc/invoke.texi,
> where it does not fully make sense to me either.
>
> How about:
>
> "preprocesses input file @file{foo.F90} to @file{foo.fii}, ..."
>
> Furthermore,
>
> +@smallexample
> +gfortran -save-temps -S foo.F
> +@end smallexample
> +
> +saves the (no longer) temporary preprocessed file in @file{foo.fi}, and
> +then compiles to the (implied) output file @file{foo.s}.
>
> Even if this is copied from the gcc texinfo file, how about:
>
> "saves the preprocessor output in @file{foo.fi}, ..."
>
> which I find easier to read.
>
> Can you also add a reference to the PR number in the commit message?
I agree, wording sounds a lot better, included in v2 together with PR number.
> > Is there a specific reason thy -fc-prototypes (Interoperability
> > Options section) is excluded from manpage?
>
> Can you be more specific? I get here (since gcc-9):
>
> % man /opt/gcc/14/share/man/man1/gfortran.1 |grep -A 1 "Interoperability
> Options"
> Interoperability Options
> -fc-prototypes -fc-prototypes-external
>
> although no detailed explanation (-> gfortran.info).
The https://gcc.gnu.org/onlinedocs/gfortran/Invoking-GNU-Fortran.html
does contain a working link to
https://gcc.gnu.org/onlinedocs/gfortran/Interoperability-Options.html
However the manpage has Interoperability section explicitly disabled
with "@c man end" ... "@c man begin ENVIRONMENT".
After digging into git log it seems that Interoperability section was
unintentionally added after this comment mark in
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=e655a6cc43
Best regards,
Rimvydas
[-- Attachment #2: 0002-Fortran-Add-Developer-Options-mini-section-to-docume.patch --]
[-- Type: text/x-patch, Size: 8056 bytes --]
From f8663a022a8b9c4f1c4a76d8e4823e24f691623c Mon Sep 17 00:00:00 2001
From: Rimvydas Jasinskas <rimvydas.jas@gmail.com>
Date: Sat, 23 Dec 2023 18:59:09 +0000
Subject: Fortran: Add Developer Options mini-section to documentation
Separate out -fdump-* options to the new section. Sort by option name.
While there, document -save-temps intermediates.
gcc/fortran/ChangeLog:
PR fortran/81615
* invoke.texi: Add Developer Options section. Move '-fdump-*'
to it. Add small examples about changed '-save-temps' behavior.
Signed-off-by: Rimvydas Jasinskas <rimvydas.jas@gmail.com>
---
gcc/fortran/invoke.texi | 117 ++++++++++++++++++++++++++--------------
1 file changed, 77 insertions(+), 40 deletions(-)
diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi
index c7fd019a7c5..5d526e23e5c 100644
--- a/gcc/fortran/invoke.texi
+++ b/gcc/fortran/invoke.texi
@@ -94,12 +94,13 @@ one is not the default.
compiled.
* Preprocessing Options:: Enable and customize preprocessing.
* Error and Warning Options:: How picky should the compiler be?
-* Debugging Options:: Symbol tables, measurements, and debugging dumps.
+* Debugging Options:: Symbol tables, measurements.
* Directory Options:: Where to find module files
* Link Options :: Influencing the linking step
* Runtime Options:: Influencing runtime behavior
* Code Gen Options:: Specifying conventions for function calls, data layout
and register usage.
+* Developer Options:: Printing GNU Fortran specific info, debugging dumps.
* Interoperability Options:: Options for interoperability with other
languages.
* Environment Variables:: Environment variables that affect @command{gfortran}.
@@ -159,9 +160,8 @@ and warnings}.
}
@item Debugging Options
-@xref{Debugging Options,,Options for debugging your program or GNU Fortran}.
-@gccoptlist{-fbacktrace -fdump-fortran-optimized -fdump-fortran-original
--fdebug-aux-vars -fdump-fortran-global -fdump-parse-tree -ffpe-trap=@var{list}
+@xref{Debugging Options,,Options for debugging your program}.
+@gccoptlist{-fbacktrace -fdebug-aux-vars -ffpe-trap=@var{list}
-ffpe-summary=@var{list}
}
@@ -201,6 +201,12 @@ and warnings}.
-fpack-derived -frealloc-lhs -frecursive -frepack-arrays
-fshort-enums -fstack-arrays
}
+
+@item Developer Options
+@xref{Developer Options,,GNU Fortran Developer Options}.
+@gccoptlist{-fdump-fortran-global -fdump-fortran-optimized
+-fdump-fortran-original -fdump-parse-tree -save-temps
+}
@end table
@node Fortran Dialect Options
@@ -1280,40 +1286,14 @@ and other GNU compilers.
Some of these have no effect when compiling programs written in Fortran.
@node Debugging Options
-@section Options for debugging your program or GNU Fortran
+@section Options for debugging your program
@cindex options, debugging
@cindex debugging information options
GNU Fortran has various special options that are used for debugging
-either your program or the GNU Fortran compiler.
+your program.
@table @gcctabopt
-@opindex @code{fdump-fortran-original}
-@item -fdump-fortran-original
-Output the internal parse tree after translating the source program
-into internal representation. This option is mostly useful for
-debugging the GNU Fortran compiler itself. The output generated by
-this option might change between releases. This option may also
-generate internal compiler errors for features which have only
-recently been added.
-
-@opindex @code{fdump-fortran-optimized}
-@item -fdump-fortran-optimized
-Output the parse tree after front-end optimization. Mostly useful for
-debugging the GNU Fortran compiler itself. The output generated by
-this option might change between releases. This option may also
-generate internal compiler errors for features which have only
-recently been added.
-
-@opindex @code{fdump-parse-tree}
-@item -fdump-parse-tree
-Output the internal parse tree after translating the source program
-into internal representation. Mostly useful for debugging the GNU
-Fortran compiler itself. The output generated by this option might
-change between releases. This option may also generate internal
-compiler errors for features which have only recently been added. This
-option is deprecated; use @code{-fdump-fortran-original} instead.
-
@opindex @code{fdebug-aux-vars}
@item -fdebug-aux-vars
Renames internal variables created by the gfortran front end and makes
@@ -1323,14 +1303,6 @@ useful for debugging the compiler's code generation together with
@code{-fdump-tree-original} and enabling debugging of the executable
program by using @code{-g} or @code{-ggdb3}.
-@opindex @code{fdump-fortran-global}
-@item -fdump-fortran-global
-Output a list of the global identifiers after translating into
-middle-end representation. Mostly useful for debugging the GNU Fortran
-compiler itself. The output generated by this option might change
-between releases. This option may also generate internal compiler
-errors for features which have only recently been added.
-
@opindex @code{ffpe-trap=}@var{list}
@item -ffpe-trap=@var{list}
Specify a list of floating point exception traps to enable. On most
@@ -1543,6 +1515,71 @@ and regards zero as positive number in the @code{SIGN} intrinsic for
compatibility with Fortran 77. The default is @option{-fsign-zero}.
@end table
+@node Developer Options
+@section GNU Fortran Developer Options
+@cindex options, debugging
+@cindex developer options
+
+GNU Fortran has various special options that are used for debugging
+the GNU Fortran compiler.
+
+@table @gcctabopt
+@opindex @code{fdump-fortran-global}
+@item -fdump-fortran-global
+Output a list of the global identifiers after translating into
+middle-end representation. Mostly useful for debugging the GNU Fortran
+compiler itself. The output generated by this option might change
+between releases. This option may also generate internal compiler
+errors for features which have only recently been added.
+
+@opindex @code{fdump-fortran-optimized}
+@item -fdump-fortran-optimized
+Output the parse tree after front-end optimization. Mostly useful for
+debugging the GNU Fortran compiler itself. The output generated by
+this option might change between releases. This option may also
+generate internal compiler errors for features which have only
+recently been added.
+
+@opindex @code{fdump-fortran-original}
+@item -fdump-fortran-original
+Output the internal parse tree after translating the source program
+into internal representation. This option is mostly useful for
+debugging the GNU Fortran compiler itself. The output generated by
+this option might change between releases. This option may also
+generate internal compiler errors for features which have only
+recently been added.
+
+@opindex @code{fdump-parse-tree}
+@item -fdump-parse-tree
+Output the internal parse tree after translating the source program
+into internal representation. Mostly useful for debugging the GNU
+Fortran compiler itself. The output generated by this option might
+change between releases. This option may also generate internal
+compiler errors for features which have only recently been added. This
+option is deprecated; use @code{-fdump-fortran-original} instead.
+
+@item -save-temps
+Store the usual ``temporary'' intermediate files permanently; name them
+as auxiliary output files, as specified described under GCC
+@option{-dumpbase} and @option{-dumpdir}.
+
+@smallexample
+gfortran -save-temps -c foo.F90
+@end smallexample
+
+preprocesses input file @file{foo.F90} to @file{foo.fii}, compiles to an
+intermediate @file{foo.s}, and then assembles to the (implied) output
+file @file{foo.o}, whereas:
+
+@smallexample
+gfortran -save-temps -S foo.F
+@end smallexample
+
+saves the preprocessor output in @file{foo.fi}, and then compiles to
+the (implied) output file @file{foo.s}.
+
+@end table
+
@node Code Gen Options
@section Options for code generation conventions
@cindex code generation, conventions
--
2.43.0
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Fortran: Use non conflicting file extensions for intermediates [PR81615]
2023-12-28 7:09 ` Rimvydas Jasinskas
@ 2023-12-28 20:31 ` Harald Anlauf
2023-12-28 20:31 ` Harald Anlauf
0 siblings, 1 reply; 13+ messages in thread
From: Harald Anlauf @ 2023-12-28 20:31 UTC (permalink / raw)
To: Rimvydas Jasinskas; +Cc: Rimvydas Jasinskas via Fortran, gcc-patches
Hi Rimvydas!
Am 28.12.23 um 08:09 schrieb Rimvydas Jasinskas:
> On Wed, Dec 27, 2023 at 10:34 PM Harald Anlauf <anlauf@gmx.de> wrote:
>> The patch is almost fine, except for a strange wording here:
>>
>> +@smallexample
>> +gfortran -save-temps -c foo.F90
>> +@end smallexample
>> +
>> +preprocesses to in @file{foo.fii}, compiles to an intermediate
>> +@file{foo.s}, and then assembles to the (implied) output file
>> +@file{foo.o}, whereas:
>>
>> I understand the formulation is copied from gcc/doc/invoke.texi,
>> where it does not fully make sense to me either.
>>
>> How about:
>>
>> "preprocesses input file @file{foo.F90} to @file{foo.fii}, ..."
>>
>> Furthermore,
>>
>> +@smallexample
>> +gfortran -save-temps -S foo.F
>> +@end smallexample
>> +
>> +saves the (no longer) temporary preprocessed file in @file{foo.fi}, and
>> +then compiles to the (implied) output file @file{foo.s}.
>>
>> Even if this is copied from the gcc texinfo file, how about:
>>
>> "saves the preprocessor output in @file{foo.fi}, ..."
>>
>> which I find easier to read.
>>
>> Can you also add a reference to the PR number in the commit message?
> I agree, wording sounds a lot better, included in v2 together with PR number.
Yes, this is OK.
Pushed: https://gcc.gnu.org/g:2cb93e6686e4af5725d8c919cf19f535a7f3aa33
Thanks for the patch!
>>> Is there a specific reason thy -fc-prototypes (Interoperability
>>> Options section) is excluded from manpage?
>>
>> Can you be more specific? I get here (since gcc-9):
>>
>> % man /opt/gcc/14/share/man/man1/gfortran.1 |grep -A 1 "Interoperability
>> Options"
>> Interoperability Options
>> -fc-prototypes -fc-prototypes-external
>>
>> although no detailed explanation (-> gfortran.info).
> The https://gcc.gnu.org/onlinedocs/gfortran/Invoking-GNU-Fortran.html
> does contain a working link to
> https://gcc.gnu.org/onlinedocs/gfortran/Interoperability-Options.html
> However the manpage has Interoperability section explicitly disabled
> with "@c man end" ... "@c man begin ENVIRONMENT".
> After digging into git log it seems that Interoperability section was
> unintentionally added after this comment mark in
> https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=e655a6cc43
Yes, that might have been unintentional.
Can you open a PR, and if you have a fix, attach it there?
Thanks,
Harald
> Best regards,
> Rimvydas
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Fortran: Use non conflicting file extensions for intermediates [PR81615]
2023-12-28 20:31 ` Harald Anlauf
@ 2023-12-28 20:31 ` Harald Anlauf
0 siblings, 0 replies; 13+ messages in thread
From: Harald Anlauf @ 2023-12-28 20:31 UTC (permalink / raw)
To: gcc-patches; +Cc: fortran
Hi Rimvydas!
Am 28.12.23 um 08:09 schrieb Rimvydas Jasinskas:
> On Wed, Dec 27, 2023 at 10:34 PM Harald Anlauf <anlauf@gmx.de> wrote:
>> The patch is almost fine, except for a strange wording here:
>>
>> +@smallexample
>> +gfortran -save-temps -c foo.F90
>> +@end smallexample
>> +
>> +preprocesses to in @file{foo.fii}, compiles to an intermediate
>> +@file{foo.s}, and then assembles to the (implied) output file
>> +@file{foo.o}, whereas:
>>
>> I understand the formulation is copied from gcc/doc/invoke.texi,
>> where it does not fully make sense to me either.
>>
>> How about:
>>
>> "preprocesses input file @file{foo.F90} to @file{foo.fii}, ..."
>>
>> Furthermore,
>>
>> +@smallexample
>> +gfortran -save-temps -S foo.F
>> +@end smallexample
>> +
>> +saves the (no longer) temporary preprocessed file in @file{foo.fi}, and
>> +then compiles to the (implied) output file @file{foo.s}.
>>
>> Even if this is copied from the gcc texinfo file, how about:
>>
>> "saves the preprocessor output in @file{foo.fi}, ..."
>>
>> which I find easier to read.
>>
>> Can you also add a reference to the PR number in the commit message?
> I agree, wording sounds a lot better, included in v2 together with PR number.
Yes, this is OK.
Pushed: https://gcc.gnu.org/g:2cb93e6686e4af5725d8c919cf19f535a7f3aa33
Thanks for the patch!
>>> Is there a specific reason thy -fc-prototypes (Interoperability
>>> Options section) is excluded from manpage?
>>
>> Can you be more specific? I get here (since gcc-9):
>>
>> % man /opt/gcc/14/share/man/man1/gfortran.1 |grep -A 1 "Interoperability
>> Options"
>> Interoperability Options
>> -fc-prototypes -fc-prototypes-external
>>
>> although no detailed explanation (-> gfortran.info).
> The https://gcc.gnu.org/onlinedocs/gfortran/Invoking-GNU-Fortran.html
> does contain a working link to
> https://gcc.gnu.org/onlinedocs/gfortran/Interoperability-Options.html
> However the manpage has Interoperability section explicitly disabled
> with "@c man end" ... "@c man begin ENVIRONMENT".
> After digging into git log it seems that Interoperability section was
> unintentionally added after this comment mark in
> https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=e655a6cc43
Yes, that might have been unintentional.
Can you open a PR, and if you have a fix, attach it there?
Thanks,
Harald
> Best regards,
> Rimvydas
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Fortran: Use non conflicting file extensions for intermediates [PR81615]
2023-12-24 1:33 ` Rimvydas Jasinskas
2023-12-27 20:34 ` Harald Anlauf
@ 2023-12-30 11:01 ` Thomas Koenig
2023-12-30 11:08 ` Thomas Koenig
1 sibling, 1 reply; 13+ messages in thread
From: Thomas Koenig @ 2023-12-30 11:01 UTC (permalink / raw)
To: Rimvydas Jasinskas, Rimvydas Jasinskas via Fortran; +Cc: gcc-patches
Hi Rimvydas,
> Documentation part.
> The makeinfo gcc/fortran/gfortran.texi does not seem to have any new warnings.
Thanks for your work on this!
I think this also desevers a mention in changes.html. Here is something
that I came up with. OK? Or does anybody have suggestions for a better
wording?
diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html
index 4b83037a..b3b67dda 100644
--- a/htdocs/gcc-14/changes.html
+++ b/htdocs/gcc-14/changes.html
@@ -282,8 +282,13 @@ a work-in-progress.</p>
<!-- <h3 id="d">D</h3> -->
-<!-- <h3 id="fortran">Fortran</h3> -->
-
+<h3 id="fortran">Fortran</h3>
+<ul>
+ <li> With the <code>-save-temps</code> option, <code>.fii</code> and
+ <code>.fi</code> files are now generated from <code>.F90</code>
+ and <code>.F</code> files, respectively.
+ </li>
+</ul>
<!-- <h3 id="go">Go</h3> -->
<!--
.................................................................. -->
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Fortran: Use non conflicting file extensions for intermediates [PR81615]
2023-12-30 11:01 ` Thomas Koenig
@ 2023-12-30 11:08 ` Thomas Koenig
2024-01-01 21:25 ` Harald Anlauf
0 siblings, 1 reply; 13+ messages in thread
From: Thomas Koenig @ 2023-12-30 11:08 UTC (permalink / raw)
To: Rimvydas Jasinskas, Rimvydas Jasinskas via Fortran; +Cc: gcc-patches
Replying to myself...
> I think this also desevers a mention in changes.html. Here is something
> that I came up with. OK? Or does anybody have suggestions for a better
> wording?
>
Or maybe this is better:
diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html
index 4b83037a..d232f631 100644
--- a/htdocs/gcc-14/changes.html
+++ b/htdocs/gcc-14/changes.html
@@ -282,8 +282,14 @@ a work-in-progress.</p>
<!-- <h3 id="d">D</h3> -->
-<!-- <h3 id="fortran">Fortran</h3> -->
-
+<h3 id="fortran">Fortran</h3>
+<ul>
+ <li> With the <code>-save-temps</code> option, preprocessed files
+ with the <code>.fii</code> extension will be generated for
+ free-form source files such as <code>.F90</code> and
+ <code>.fi</code> for fixed-form files such as <code>.F</code>.
+ </li>
+</ul>
<!-- <h3 id="go">Go</h3> -->
<!--
.................................................................. -->
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Fortran: Use non conflicting file extensions for intermediates [PR81615]
2023-12-30 11:08 ` Thomas Koenig
@ 2024-01-01 21:25 ` Harald Anlauf
2024-01-01 21:25 ` Harald Anlauf
0 siblings, 1 reply; 13+ messages in thread
From: Harald Anlauf @ 2024-01-01 21:25 UTC (permalink / raw)
To: Thomas Koenig, Rimvydas Jasinskas, Rimvydas Jasinskas via Fortran
Cc: gcc-patches
Hi Thomas!
Am 30.12.23 um 12:08 schrieb Thomas Koenig:
> Replying to myself...
>
>
>> I think this also desevers a mention in changes.html. Here is something
>> that I came up with. OK? Or does anybody have suggestions for a better
>> wording?
>>
>
> Or maybe this is better:
>
> diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html
> index 4b83037a..d232f631 100644
> --- a/htdocs/gcc-14/changes.html
> +++ b/htdocs/gcc-14/changes.html
> @@ -282,8 +282,14 @@ a work-in-progress.</p>
>
> <!-- <h3 id="d">D</h3> -->
>
> -<!-- <h3 id="fortran">Fortran</h3> -->
> -
> +<h3 id="fortran">Fortran</h3>
> +<ul>
> + <li> With the <code>-save-temps</code> option, preprocessed files
> + with the <code>.fii</code> extension will be generated for
> + free-form source files such as <code>.F90</code> and
> + <code>.fi</code> for fixed-form files such as <code>.F</code>.
> + </li>
> +</ul>
> <!-- <h3 id="go">Go</h3> -->
I slightly prefer this variant.
I wonder if it were better to write "generated from" instead of
"generated for". A native speaker might help here.
While at it: gfortran now accepts "-std=f2023", which implies that
the limit for line-length in free-form has been increased to 10000
characters, and statements may have up to 1 million characters.
(See Tobias' commit r14-5553-gb9eba3baf54b4f).
I'd consider this as important as the other change... ;-)
Thanks,
Harald
> <!--
> .................................................................. -->
>
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Fortran: Use non conflicting file extensions for intermediates [PR81615]
2024-01-01 21:25 ` Harald Anlauf
@ 2024-01-01 21:25 ` Harald Anlauf
0 siblings, 0 replies; 13+ messages in thread
From: Harald Anlauf @ 2024-01-01 21:25 UTC (permalink / raw)
To: gcc-patches; +Cc: fortran
Hi Thomas!
Am 30.12.23 um 12:08 schrieb Thomas Koenig:
> Replying to myself...
>
>
>> I think this also desevers a mention in changes.html. Here is something
>> that I came up with. OK? Or does anybody have suggestions for a better
>> wording?
>>
>
> Or maybe this is better:
>
> diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html
> index 4b83037a..d232f631 100644
> --- a/htdocs/gcc-14/changes.html
> +++ b/htdocs/gcc-14/changes.html
> @@ -282,8 +282,14 @@ a work-in-progress.</p>
>
> <!-- <h3 id="d">D</h3> -->
>
> -<!-- <h3 id="fortran">Fortran</h3> -->
> -
> +<h3 id="fortran">Fortran</h3>
> +<ul>
> + <li> With the <code>-save-temps</code> option, preprocessed files
> + with the <code>.fii</code> extension will be generated for
> + free-form source files such as <code>.F90</code> and
> + <code>.fi</code> for fixed-form files such as <code>.F</code>.
> + </li>
> +</ul>
> <!-- <h3 id="go">Go</h3> -->
I slightly prefer this variant.
I wonder if it were better to write "generated from" instead of
"generated for". A native speaker might help here.
While at it: gfortran now accepts "-std=f2023", which implies that
the limit for line-length in free-form has been increased to 10000
characters, and statements may have up to 1 million characters.
(See Tobias' commit r14-5553-gb9eba3baf54b4f).
I'd consider this as important as the other change... ;-)
Thanks,
Harald
> <!--
> .................................................................. -->
>
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2024-01-01 21:25 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-20 4:32 Fortran: Use non conflicting file extensions for intermediates [PR81615] Rimvydas Jasinskas
2023-12-20 19:29 ` Harald Anlauf
2023-12-20 19:29 ` Harald Anlauf
2023-12-24 1:33 ` Rimvydas Jasinskas
2023-12-27 20:34 ` Harald Anlauf
2023-12-27 20:34 ` Harald Anlauf
2023-12-28 7:09 ` Rimvydas Jasinskas
2023-12-28 20:31 ` Harald Anlauf
2023-12-28 20:31 ` Harald Anlauf
2023-12-30 11:01 ` Thomas Koenig
2023-12-30 11:08 ` Thomas Koenig
2024-01-01 21:25 ` Harald Anlauf
2024-01-01 21:25 ` Harald Anlauf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).