Bug 65996 - [5/6 Regression] gfortran ICE with -dH
Summary: [5/6 Regression] gfortran ICE with -dH
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 5.1.0
: P4 minor
Target Milestone: 5.4
Assignee: Jerry DeLisle
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-03 18:56 UTC by Melven.Roehrig-Zoellner
Modified: 2016-02-24 06:47 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-05-04 00:00:00


Attachments
source file to reproduce the error (1.61 KB, text/plain)
2015-05-03 18:56 UTC, Melven.Roehrig-Zoellner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Melven.Roehrig-Zoellner 2015-05-03 18:56:12 UTC
Created attachment 35450 [details]
source file to reproduce the error

When I add the flag -dH, gfortran aborts with an ICE for a specific source file (attached).

Full log:

> gfortran -cpp -c -dH -v env_module.f90
Using built-in specs.
COLLECT_GCC=gfortran
Target: x86_64-unknown-linux-gnu
Configured with: /tools/modulesystem/tools/gcc/gcc-5.1.0/src/configure --prefix=/tools/modulesystem/tools/gcc/gcc-5.1.0/install/sled11.x86_64.gcc-4.3.4.release
Thread model: posix
gcc version 5.1.0 (GCC)
COLLECT_GCC_OPTIONS='-cpp' '-c' '-dH' '-v' '-mtune=generic' '-march=x86-64'
 /tools/modulesystem/tools/gcc/gcc-5.1.0/install/sled11.x86_64.gcc-4.3.4.release/libexec/gcc/x86_64-unknown-linux-gnu/5.1.0/f951 /home_local/zoel_ml/essex/phist/src/kernels/builtin/env_module.f90 -cpp=/tmp/ccMuxZYL.f90 -quiet -v /home_local/zoel_ml/essex/phist/src/kernels/builtin/env_module.f90 -quiet -dumpbase env_module.f90 -dH -mtune=generic -march=x86-64 -auxbase env_module -version -fintrinsic-modules-path /tools/modulesystem/tools/gcc/gcc-5.1.0/install/sled11.x86_64.gcc-4.3.4.release/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/finclude -o /tmp/ccMAZIhi.s
GNU Fortran (GCC) version 5.1.0 (x86_64-unknown-linux-gnu)
        compiled by GNU C version 5.1.0, GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "/tools/modulesystem/tools/gcc/gcc-5.1.0/install/sled11.x86_64.gcc-4.3.4.release/include"
ignoring nonexistent directory "/tools/modulesystem/tools/gcc/gcc-5.1.0/install/sled11.x86_64.gcc-4.3.4.release/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../x86_64-unknown-linux-gnu/include"
ignoring duplicate directory "/tools/modulesystem/tools/gsl/gsl-1.16/install/sled11.x86_64.gcc-4.8.2.release/include"
  as it is a non-system directory that duplicates a system directory
ignoring duplicate directory "/tools/modulesystem/tools/lapack/lapack-3.5.0/install/sled11.x86_64.gcc-4.8.2.release/include"
  as it is a non-system directory that duplicates a system directory
ignoring duplicate directory "/tools/modulesystem/tools/gdb/gdb-7.9/install/sled11.x86_64.gcc-5.1.0.release/include"
  as it is a non-system directory that duplicates a system directory
ignoring duplicate directory "/tools/modulesystem/tools/hwloc/hwloc-1.10.1/install/sled11.x86_64.gcc-5.1.0.release/include"
  as it is a non-system directory that duplicates a system directory
ignoring duplicate directory "/tools/modulesystem/tools/likwid/likwid-3.1.3/install/sled11.x86_64.gcc-5.1.0.release.openmpi-1.8.4/include"
  as it is a non-system directory that duplicates a system directory
ignoring duplicate directory "/tools/modulesystem/tools/openmpi/openmpi-1.8.4/install/sled11.x86_64.gcc-5.1.0.release.mpi-thread-multiple/include"
  as it is a non-system directory that duplicates a system directory
ignoring duplicate directory "/tools/modulesystem/tools/binutils/binutils-2.25/install/sled11.x86_64.gcc-5.1.0.release/include"
  as it is a non-system directory that duplicates a system directory
ignoring duplicate directory "/tools/modulesystem/tools/gcc/gcc-5.1.0/install/sled11.x86_64.gcc-4.3.4.release/include"
  as it is a non-system directory that duplicates a system directory
ignoring duplicate directory "/tools/modulesystem/tools/mpc/mpc-1.0.1/install/sled11.x86_64.gcc-4.3.4.release/include"
  as it is a non-system directory that duplicates a system directory
ignoring duplicate directory "/tools/modulesystem/tools/mpfr/mpfr-3.1.2/install/sled11.x86_64.gcc-4.3.4.release/include"
  as it is a non-system directory that duplicates a system directory
ignoring duplicate directory "/tools/modulesystem/tools/isl/isl-0.14/install/sled11.x86_64.gcc-4.3.4.release/include"
  as it is a non-system directory that duplicates a system directory
ignoring duplicate directory "/tools/modulesystem/tools/gmp/gmp-5.1.3/install/sled11.x86_64.gcc-4.3.4.release/include"
  as it is a non-system directory that duplicates a system directory
ignoring duplicate directory "/tools/modulesystem/tools/python2.7/python2.7-2.7.6/install/sled11.x86_64.gcc-4.3.4.release/include"
  as it is a non-system directory that duplicates a system directory
ignoring duplicate directory "/tools/modulesystem/tools/subversion/subversion-1.8.5/install/sled11.x86_64.gcc-4.3.4.release/include"
  as it is a non-system directory that duplicates a system directory
ignoring duplicate directory "/tools/modulesystem/tools/sqlite/sqlite-3.8.2/install/sled11.x86_64.gcc-4.3.4.release/include"
  as it is a non-system directory that duplicates a system directory
ignoring duplicate directory "/tools/modulesystem/tools/serf/serf-1.3.3/install/sled11.x86_64.gcc-4.3.4.release/include"
  as it is a non-system directory that duplicates a system directory
ignoring duplicate directory "/tools/modulesystem/tools/aprutil/aprutil-1.5.3/install/sled11.x86_64.gcc-4.3.4.release/include"
  as it is a non-system directory that duplicates a system directory
ignoring duplicate directory "/tools/modulesystem/tools/apr/apr-1.5.0/install/sled11.x86_64.gcc-4.3.4.release/include"
  as it is a non-system directory that duplicates a system directory
ignoring duplicate directory "/tools/modulesystem/tools/expat/expat-2.1.0/install/sled11.x86_64.gcc-4.3.4.release/include"
  as it is a non-system directory that duplicates a system directory
ignoring duplicate directory "/tools/modulesystem/tools/curl/curl-7.26.0/install/sled11.x86_64.gcc-4.3.4.release/include"
  as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
 /tools/modulesystem/tools/gcc/gcc-5.1.0/install/sled11.x86_64.gcc-4.3.4.release/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/finclude
 /tools/modulesystem/tools/gsl/gsl-1.16/install/sled11.x86_64.gcc-4.8.2.release/include
 /tools/modulesystem/tools/lapack/lapack-3.5.0/install/sled11.x86_64.gcc-4.8.2.release/include
 /tools/modulesystem/tools/gdb/gdb-7.9/install/sled11.x86_64.gcc-5.1.0.release/include
 /tools/modulesystem/tools/hwloc/hwloc-1.10.1/install/sled11.x86_64.gcc-5.1.0.release/include
 /tools/modulesystem/tools/likwid/likwid-3.1.3/install/sled11.x86_64.gcc-5.1.0.release.openmpi-1.8.4/include
 /tools/modulesystem/tools/openmpi/openmpi-1.8.4/install/sled11.x86_64.gcc-5.1.0.release.mpi-thread-multiple/include
 /tools/modulesystem/tools/binutils/binutils-2.25/install/sled11.x86_64.gcc-5.1.0.release/include
 /tools/modulesystem/tools/gcc/gcc-5.1.0/install/sled11.x86_64.gcc-4.3.4.release/include
 /tools/modulesystem/tools/mpc/mpc-1.0.1/install/sled11.x86_64.gcc-4.3.4.release/include
 /tools/modulesystem/tools/mpfr/mpfr-3.1.2/install/sled11.x86_64.gcc-4.3.4.release/include
 /tools/modulesystem/tools/isl/isl-0.14/install/sled11.x86_64.gcc-4.3.4.release/include
 /tools/modulesystem/tools/gmp/gmp-5.1.3/install/sled11.x86_64.gcc-4.3.4.release/include
 /tools/modulesystem/tools/python2.7/python2.7-2.7.6/install/sled11.x86_64.gcc-4.3.4.release/include
 /tools/modulesystem/tools/subversion/subversion-1.8.5/install/sled11.x86_64.gcc-4.3.4.release/include
 /tools/modulesystem/tools/sqlite/sqlite-3.8.2/install/sled11.x86_64.gcc-4.3.4.release/include
 /tools/modulesystem/tools/serf/serf-1.3.3/install/sled11.x86_64.gcc-4.3.4.release/include
 /tools/modulesystem/tools/aprutil/aprutil-1.5.3/install/sled11.x86_64.gcc-4.3.4.release/include
 /tools/modulesystem/tools/apr/apr-1.5.0/install/sled11.x86_64.gcc-4.3.4.release/include
 /tools/modulesystem/tools/expat/expat-2.1.0/install/sled11.x86_64.gcc-4.3.4.release/include
 /tools/modulesystem/tools/curl/curl-7.26.0/install/sled11.x86_64.gcc-4.3.4.release/include
 /tools/modulesystem/tools/gcc/gcc-5.1.0/install/sled11.x86_64.gcc-4.3.4.release/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/include
 /usr/local/include
 /tools/modulesystem/tools/gcc/gcc-5.1.0/install/sled11.x86_64.gcc-4.3.4.release/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/include-fixed
 /usr/include
End of search list.
GNU Fortran2008 (GCC) version 5.1.0 (x86_64-unknown-linux-gnu)
        compiled by GNU C version 5.1.0, GMP version 5.1.3, MPFR version 3.1.2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
gfortran: internal compiler error: Aborted (program f951)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


When I remove the -dH it compiles fine (I left out a lot of flags that were not required to reproduce the bug).

More information:
self-build gcc 5.1.0
OS: SUSE Linux Enterprise Desktop 11 service pack 2
libc: 2.11.3 (20110527)
native gcc: gcc (SUSE Linux) 4.3.4 [gcc-4_3-branch revision 152973]
kernel: Linux 3.0.13-0.27-default x86_64 GNU/Linux
Comment 1 Jakub Jelinek 2015-05-04 08:48:25 UTC
Most likely started with r217600.
Comment 2 Dominique d'Humieres 2015-05-04 09:50:15 UTC
The following test (from pr58334)

program foo
implicit none
character(len=16) :: a,b,c
a="XXX"
b="&
  &XXX"
c="XXX &
  & XXX"
write(0,*) 'a=',a,' b=',b,' c=',c 
endprogram foo

shows the same behavior.

BTW what -dH is supposed to do (I did not find it in the manual)?
Comment 3 Jakub Jelinek 2015-05-04 09:58:24 UTC
Though, looking at the implementation and documentation of -dH, it sounds like it is intentional.  -dH is supposed to stand for abort the compiler after issuing an error.  That is not an internal compiler error, but just abort requested by the user.  So NOTABUG IMHO.
Comment 4 Melven.Roehrig-Zoellner 2015-05-04 10:20:22 UTC
> man gcc | grep -- -dH
           -dH Produce a core dump whenever an error occurs.
(This refers to a *compiler error* - so I should only need/use it to report a gcc bug.)

But this flag shouldn't "trigger" an error when there is none without it or am I missing something here?
Comment 5 Jakub Jelinek 2015-05-04 10:37:54 UTC
I don't have mpi installed, so it is hard to find out if you get an error or not - your testcase is clearly not self-contained; I certainly do get an error and correct abort after that.
Comment 6 Dominique d'Humieres 2015-05-04 10:46:05 UTC
> I don't have mpi installed, so it is hard to find out if you get an error
> or not - your testcase is clearly not self-contained; I certainly do get
> an error and correct abort after that.

Self contained test in comment 2.
Comment 7 Jakub Jelinek 2015-05-04 10:52:58 UTC
So supposedly gfc_error needs to for buffered_p case also save and temporarily
clear global_dc->abort_on_error.  Maybe various other changes needed for that.

Wonder what is -dH good for, don't really see when it would be really useful.
Comment 8 Melven.Roehrig-Zoellner 2015-05-04 12:14:18 UTC
Thanks for the quick replies and the discussion about the "not-so-usefulness" of the -dH switch (at least for our project).
We most probably used this switch by mistake - you might possibly improve the documentation by adding
"-dH Produce a core dump whenever a *compilation* error occurs."
to prevent further misunderstandings for people who don't read the full paragraph.
Comment 9 Richard Biener 2015-07-16 09:10:39 UTC
GCC 5.2 is being released, adjusting target milestone to 5.3.
Comment 10 Richard Biener 2015-12-04 10:43:16 UTC
GCC 5.3 is being released, adjusting target milestone.
Comment 11 Jerry DeLisle 2016-01-05 18:22:44 UTC
I will work this one.
Comment 12 Jerry DeLisle 2016-01-21 21:08:32 UTC
Author: jvdelisle
Date: Thu Jan 21 21:08:00 2016
New Revision: 232707

URL: https://gcc.gnu.org/viewcvs?rev=232707&root=gcc&view=rev
Log:
2016-01-21  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/65996
	* error.c (gfc_error): Save the state of abort_on_error and set
	it to false for buffered errors to allow normal processing.
	Restore the state before leaving.

2016-01-21  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/65996
	gfortran.dg/pr65996.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/pr65996.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/error.c
    trunk/gcc/testsuite/ChangeLog
Comment 13 Jerry DeLisle 2016-02-24 06:46:13 UTC
Author: jvdelisle
Date: Wed Feb 24 06:45:41 2016
New Revision: 233653

URL: https://gcc.gnu.org/viewcvs?rev=233653&root=gcc&view=rev
Log:
2016-02-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	Backported from mainline
	PR fortran/65996
	* error.c (gfc_error): Save the state of abort_on_error and set
	it to false for buffered errors to allow normal processing.
	Restore the state before leaving.

	PR fortran/65996
	* gfortran.dg/pr65996.f90: New test.

Added:
    branches/gcc-5-branch/gcc/testsuite/gfortran.dg/pr65996.f90
Modified:
    branches/gcc-5-branch/gcc/fortran/ChangeLog
    branches/gcc-5-branch/gcc/fortran/error.c
    branches/gcc-5-branch/gcc/testsuite/ChangeLog
Comment 14 Jerry DeLisle 2016-02-24 06:47:08 UTC
Fixed, Closing