[Bug fortran/59612] iso_fortran_env segfaults with -fdump-fortran-original

2013-12-29 Thread janus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59612

--- Comment #5 from janus at gcc dot gnu.org ---
Author: janus
Date: Sun Dec 29 17:20:50 2013
New Revision: 206237

URL: http://gcc.gnu.org/viewcvs?rev=206237root=gccview=rev
Log:
2013-12-29  Janus Weil  ja...@gcc.gnu.org

PR fortran/59612
* dump-parse-tree.c (show_typespec): Check for charlen.
* invoke.texi: Fix documentation of -fdump-fortran-optimized and
-fdump-parse-tree.

Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/dump-parse-tree.c
trunk/gcc/fortran/invoke.texi


[Bug fortran/59612] iso_fortran_env segfaults with -fdump-fortran-original

2013-12-29 Thread janus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59612

--- Comment #6 from janus at gcc dot gnu.org ---
The patches of comment 1 and 2 have been applied in r206237, so that the
original problem is fixed by now.


[Bug fortran/59612] iso_fortran_env segfaults with -fdump-fortran-original

2013-12-29 Thread janus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59612

--- Comment #7 from janus at gcc dot gnu.org ---
(In reply to janus from comment #2)
 Does -fdump-fortran-optimized actually do anything?

The reason why I did not get any output from it is of course that it is only in
effect if -ffrontend-optimize is given in addition. Maybe it would be worth to
mention this in the documentation, e.g. like this:


Index: invoke.texi
===
--- invoke.texi(revision 206237)
+++ invoke.texi(working copy)
@@ -991,8 +991,9 @@

 @item -fdump-fortran-optimized
 @opindex @code{fdump-fortran-optimized}
-Output the parse tree after front-end optimization.  Only really
-useful for debugging the GNU Fortran compiler itself.
+Output the parse tree after front-end optimization (if enabled via
+@option{-ffrontend-optimize}).  Only really useful for debugging the GNU
+Fortran compiler itself.

 @item -fdump-parse-tree
 @opindex @code{fdump-parse-tree}


[Bug fortran/59612] iso_fortran_env segfaults with -fdump-fortran-original

2013-12-28 Thread janus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59612

janus at gcc dot gnu.org changed:

   What|Removed |Added

   Keywords||ice-on-valid-code
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2013-12-28
 CC||janus at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from janus at gcc dot gnu.org ---
Straightforward patch:

Index: gcc/fortran/dump-parse-tree.c
===
--- gcc/fortran/dump-parse-tree.c(revision 206176)
+++ gcc/fortran/dump-parse-tree.c(working copy)
@@ -110,7 +110,8 @@ show_typespec (gfc_typespec *ts)
   break;

 case BT_CHARACTER:
-  show_expr (ts-u.cl-length);
+  if (ts-u.cl)
+show_expr (ts-u.cl-length);
   fprintf(dumpfile,  %d, ts-kind);
   break;


[Bug fortran/59612] iso_fortran_env segfaults with -fdump-fortran-original

2013-12-28 Thread janus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59612

--- Comment #2 from janus at gcc dot gnu.org ---
Note that there are two small errors in the related documentation:


Index: gcc/fortran/invoke.texi
===
--- gcc/fortran/invoke.texi(revision 206176)
+++ gcc/fortran/invoke.texi(working copy)
@@ -989,11 +989,12 @@ Output the internal parse tree after translating t
 into internal representation.  Only really useful for debugging the
 GNU Fortran compiler itself.

-@item -fdump-optimized-tree
+@item -fdump-fortran-optimized
 @opindex @code{fdump-fortran-optimized}
 Output the parse tree after front-end optimization.  Only really
 useful for debugging the GNU Fortran compiler itself.

+@item -dump-parse-tree
 @opindex @code{fdump-parse-tree}
 Output the internal parse tree after translating the source program
 into internal representation.  Only really useful for debugging the


Does -fdump-fortran-optimized actually do anything?


[Bug fortran/59612] iso_fortran_env segfaults with -fdump-fortran-original

2013-12-28 Thread janus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59612

--- Comment #3 from janus at gcc dot gnu.org ---
Maybe it would make sense to run the testsuite with -fdump-fortran-original, in
order to check for further problems:


Index: gcc/testsuite/gfortran.dg/dg.exp
===
--- gcc/testsuite/gfortran.dg/dg.exp(revision 206231)
+++ gcc/testsuite/gfortran.dg/dg.exp(working copy)
@@ -22,7 +22,7 @@
 # If a testcase doesn't have special options, use these.
 global DEFAULT_FFLAGS
 if ![info exists DEFAULT_FFLAGS] then {
-set DEFAULT_FFLAGS  -pedantic-errors
+set DEFAULT_FFLAGS  -pedantic-errors -fdump-fortran-original
 }

 # Initialize `dg'.


[Bug fortran/59612] iso_fortran_env segfaults with -fdump-fortran-original

2013-12-28 Thread janus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59612

--- Comment #4 from janus at gcc dot gnu.org ---
(In reply to janus from comment #3)
 Maybe it would make sense to run the testsuite with -fdump-fortran-original,
 in order to check for further problems:

Does not seem to yield any failures here (with the patch from comment 1
applied).