Bug 86051 - internal compiler error: in conv_function_val, at fortran/trans-expr.c:3717
Summary: internal compiler error: in conv_function_val, at fortran/trans-expr.c:3717
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 7.3.1
: P4 normal
Target Milestone: 6.5
Assignee: kargls
URL:
Keywords:
Depends on: 85996
Blocks:
  Show dependency treegraph
 
Reported: 2018-06-04 22:33 UTC by Daniel Bershatsky
Modified: 2018-06-09 18:37 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2018-06-05 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bershatsky 2018-06-04 22:33:51 UTC
Unfortunately, I have not succeeded in building short example that brokes compiler. So, in order to reproduce the issue one should get file located in GitHub. https://github.com/oseledets/tt-fort/blob/658ae2d9148148fb4933de2dda2434aee0b94c39/dispmodule.f90

- GNU Fortran (GCC) 7.3.1 20180406

- x86_64 GNU/Linux

- GNU Fortran distributed with ArchLinux or Ubuntu 18.04 LTS
$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --enable-multilib --disable-werror --enable-checking=release --enable-default-pie --enable-default-ssp
Thread model: posix
gcc version 7.3.1 20180406 (GCC)

- With fortran source located at https://github.com/oseledets/tt-fort/blob/658ae2d9148148fb4933de2dda2434aee0b94c39/dispmodule.f90
$ gfortran -fdefault-integer-8 -ffree-line-length-none -O3 -fPIC -c dispmodule.f90
dispmodule.f90:1248:0:

     character(widthmax_dint(x, fmt)) :: sa(size(x))
 
internal compiler error: in conv_function_val, at fortran/trans-expr.c:3717

- Files generated by adding -save-temps
$ cat dispmodule.s 
	.file	"dispmodule.f90"
Comment 1 kargls 2018-06-05 00:38:22 UTC
(In reply to Daniel Bershatsky from comment #0)
> Unfortunately, I have not succeeded in building short example that brokes
> compiler. So, in order to reproduce the issue one should get file located in

Unfortunately, we'll need a reduced testcase.  Downloading the
source package from github, and making suitable changes to 
Makefile to invoke gfortran 9.0.0, I can compile the code.


> dispmodule.f90
> dispmodule.f90:1248:0:
> 
>      character(widthmax_dint(x, fmt)) :: sa(size(x))
>  

This may have been fixed by a patch I submitted today.
Comment 2 Dominique d'Humieres 2018-06-05 08:30:08 UTC
> This may have been fixed by a patch I submitted today.

I confirmed that the PR is fixed by the patch at

https://gcc.gnu.org/ml/fortran/2018-06/msg00013.html
Comment 3 Daniel Bershatsky 2018-06-06 11:17:42 UTC
(In reply to Dominique d'Humieres from comment #2)
> > This may have been fixed by a patch I submitted today.
> 
> I confirmed that the PR is fixed by the patch at
> 
> https://gcc.gnu.org/ml/fortran/2018-06/msg00013.html

That's great! I will check it out by myself and will be back.

Will this patch be applyed to gfortran branches 6.*, 7.*, and 8.*? If it were not I would like to get a guidance how to avoid the issue. There are lots of users who are using these obsolete fortran versions.
Comment 4 Steve Kargl 2018-06-06 14:55:37 UTC
On Wed, Jun 06, 2018 at 11:17:42AM +0000, daniel.bershatsky at skolkovotech dot ru wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86051
> 
> --- Comment #3 from Daniel Bershatsky <daniel.bershatsky at skolkovotech dot ru> ---
> (In reply to Dominique d'Humieres from comment #2)
> > > This may have been fixed by a patch I submitted today.
> > 
> > I confirmed that the PR is fixed by the patch at
> > 
> > https://gcc.gnu.org/ml/fortran/2018-06/msg00013.html
> 
> That's great! I will check it out by myself and will be back.
> 
> Will this patch be applyed to gfortran branches 6.*, 7.*, and 8.*? If it were
> not I would like to get a guidance how to avoid the issue. There are lots of
> users who are using these obsolete fortran versions.
> 

It will be back ported. (Well, at least an attempt will be made
to back port the patch, but it should apply with little change).
Comment 5 kargls 2018-06-09 15:48:45 UTC
Author: kargl
Date: Sat Jun  9 15:47:40 2018
New Revision: 261362

URL: https://gcc.gnu.org/viewcvs?rev=261362&root=gcc&view=rev
Log:
2018-06-09  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/85138
	PR fortran/85996
	PR fortran/86051
	* decl.c (gfc_match_char_spec): Use private namespace in attempt to
	reduce a charlen to a constant.

2018-06-09  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/85138
	PR fortran/85996
	PR fortran/86051
	* gfortran.dg/pr85138_1.f90: New test.
	* gfortran.dg/pr85138_2.f90: Ditto.
	* gfortran.dg/pr85996.f90: Ditto.

Added:
    trunk/gcc/testsuite/gfortran.dg/pr85138_1.f90
    trunk/gcc/testsuite/gfortran.dg/pr85138_2.f90
    trunk/gcc/testsuite/gfortran.dg/pr85996.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c
    trunk/gcc/testsuite/ChangeLog
Comment 6 kargls 2018-06-09 18:09:33 UTC
Author: kargl
Date: Sat Jun  9 18:09:00 2018
New Revision: 261370

URL: https://gcc.gnu.org/viewcvs?rev=261370&root=gcc&view=rev
Log:
2018-06-09  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/85138
	PR fortran/85996
	PR fortran/86051
	* decl.c (gfc_match_char_spec): Use private namespace in attempt to
	reduce a charlen to a constant.

2018-06-09  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/85138
	PR fortran/85996
	PR fortran/86051
	* gfortran.dg/pr85138_1.f90: New test.
	* gfortran.dg/pr85138_2.f90: Ditto.
	* gfortran.dg/pr85996.f90: Ditto.

Added:
    branches/gcc-8-branch/gcc/testsuite/gfortran.dg/pr85138_1.f90
    branches/gcc-8-branch/gcc/testsuite/gfortran.dg/pr85138_2.f90
    branches/gcc-8-branch/gcc/testsuite/gfortran.dg/pr85996.f90
Modified:
    branches/gcc-8-branch/gcc/fortran/ChangeLog
    branches/gcc-8-branch/gcc/fortran/decl.c
    branches/gcc-8-branch/gcc/testsuite/ChangeLog
Comment 7 kargls 2018-06-09 18:30:12 UTC
Author: kargl
Date: Sat Jun  9 18:29:40 2018
New Revision: 261371

URL: https://gcc.gnu.org/viewcvs?rev=261371&root=gcc&view=rev
Log:
2018-06-09  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/85138
	PR fortran/85996
	PR fortran/86051
	* decl.c (gfc_match_char_spec): Use private namespace in attempt to
	reduce a charlen to a constant.

2018-06-09  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/85138
	PR fortran/85996
	PR fortran/86051
	* gfortran.dg/pr85138_1.f90: New test.
	* gfortran.dg/pr85138_2.f90: Ditto.
	* gfortran.dg/pr85996.f90: Ditto.

Added:
    branches/gcc-7-branch/gcc/testsuite/gfortran.dg/pr85138_1.f90
    branches/gcc-7-branch/gcc/testsuite/gfortran.dg/pr85138_2.f90
    branches/gcc-7-branch/gcc/testsuite/gfortran.dg/pr85996.f90
Modified:
    branches/gcc-7-branch/gcc/fortran/ChangeLog
    branches/gcc-7-branch/gcc/fortran/decl.c
    branches/gcc-7-branch/gcc/testsuite/ChangeLog
Comment 8 kargls 2018-06-09 18:36:30 UTC
Author: kargl
Date: Sat Jun  9 18:35:58 2018
New Revision: 261372

URL: https://gcc.gnu.org/viewcvs?rev=261372&root=gcc&view=rev
Log:
2018-06-09  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/85138
	PR fortran/85996
	PR fortran/86051
	* decl.c (gfc_match_char_spec): Use private namespace in attempt to
	reduce a charlen to a constant.

2018-06-09  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/85138
	PR fortran/85996
	PR fortran/86051
	* gfortran.dg/pr85138_1.f90: New test.
	* gfortran.dg/pr85138_2.f90: Ditto.
	* gfortran.dg/pr85996.f90: Ditto.

Added:
    branches/gcc-6-branch/gcc/testsuite/gfortran.dg/pr85138_1.f90
    branches/gcc-6-branch/gcc/testsuite/gfortran.dg/pr85138_2.f90
    branches/gcc-6-branch/gcc/testsuite/gfortran.dg/pr85996.f90
Modified:
    branches/gcc-6-branch/gcc/fortran/ChangeLog
    branches/gcc-6-branch/gcc/fortran/decl.c
    branches/gcc-6-branch/gcc/testsuite/ChangeLog
Comment 9 kargls 2018-06-09 18:37:42 UTC
Fixed on trunk and 6, 7, and 8 branches.