[Bug fortran/78686] ICE in gfc_apply_init, at fortran/expr.c:4124

2017-11-21 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78686

Paul Thomas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Paul Thomas  ---
Fixed on 7- and 8-branches.

Closing - thanks for the report.

Paul

[Bug fortran/78686] ICE in gfc_apply_init, at fortran/expr.c:4124

2017-11-21 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78686

--- Comment #6 from Paul Thomas  ---
Author: pault
Date: Tue Nov 21 19:09:01 2017
New Revision: 255029

URL: https://gcc.gnu.org/viewcvs?rev=255029=gcc=rev
Log:
2017-11-21  Paul Thomas  

Backported from trunk fix for PR82586
PR fortran/78686
* resolve.c (resolve_generic_f): Check usage of derived type by
calling gfc_use_derived.

2017-11-21  Paul Thomas  

Backported from trunk fix for PR82586
PR fortran/78686
* gfortran.dg/pr78686.f90: New test.


Added:
branches/gcc-7-branch/gcc/testsuite/gfortran.dg/pr78686.f90
Modified:
branches/gcc-7-branch/gcc/fortran/ChangeLog
branches/gcc-7-branch/gcc/fortran/resolve.c
branches/gcc-7-branch/gcc/testsuite/ChangeLog

[Bug fortran/78686] ICE in gfc_apply_init, at fortran/expr.c:4124

2017-11-21 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78686

Paul Thomas  changed:

   What|Removed |Added

 CC||pault at gcc dot gnu.org
   Assignee|kargl at gcc dot gnu.org   |pault at gcc dot gnu.org

--- Comment #5 from Paul Thomas  ---
(In reply to Dominique d'Humieres from comment #4)
> The ICE has been replaced with the error
> 
> Error: Derived type 't' at (1) is being used before it is defined
> 
> between revisions r253763 (2017-10-14, ICE) and r253982 (2017-10-22, error),
> may be r253970 (pr82586, pr82587, and pr82589).

You are correct. It is the first chunk in the changes to resolve.c that did it.

I have taken this and will keep it open until I am next working on 7-branch and
will aply it there.

Thanks

Paul

[Bug fortran/78686] ICE in gfc_apply_init, at fortran/expr.c:4124

2017-11-21 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78686

--- Comment #4 from Dominique d'Humieres  ---
The ICE has been replaced with the error

Error: Derived type 't' at (1) is being used before it is defined

between revisions r253763 (2017-10-14, ICE) and r253982 (2017-10-22, error),
may be r253970 (pr82586, pr82587, and pr82589).

[Bug fortran/78686] ICE in gfc_apply_init, at fortran/expr.c:4124

2017-11-09 Thread kargl at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78686

kargl at gcc dot gnu.org changed:

   What|Removed |Added

 CC||kargl at gcc dot gnu.org

--- Comment #3 from kargl at gcc dot gnu.org ---
(In reply to Gerhard Steinmetz from comment #0)
> With invalid code, down to at least 4.8 :
> 
> 
> $ cat z1.f90
> program p
>type t
>   character :: c(1) = [t()]
>end type
> end
> 
> 
> $ gfortran-7-20161204 z1.f90
> f951: internal compiler error: in gfc_apply_init, at fortran/expr.c:4124
> 0x6911be gfc_apply_init(gfc_typespec*, symbol_attribute*, gfc_expr*)
> ../../gcc/fortran/expr.c:4124
> 0x684d98 build_struct
> ../../gcc/fortran/decl.c:1942
> 0x684d98 variable_decl
> ../../gcc/fortran/decl.c:2437
> 0x684d98 gfc_match_data_decl()
> ../../gcc/fortran/decl.c:4892
> 0x6dca79 match_word_omp_simd
> ../../gcc/fortran/parse.c:93
> 0x6e002e match_word
> ../../gcc/fortran/parse.c:377
> 0x6e002e decode_statement
> ../../gcc/fortran/parse.c:377
> 0x6e1e34 next_free
> ../../gcc/fortran/parse.c:1180
> 0x6e1e34 next_statement
> ../../gcc/fortran/parse.c:1413
> 0x6e337a parse_derived
> ../../gcc/fortran/parse.c:3233
> 0x6e337a parse_spec
> ../../gcc/fortran/parse.c:3773
> 0x6e5bb3 parse_progunit
> ../../gcc/fortran/parse.c:5615
> 0x6e71a4 gfc_parse_file()
> ../../gcc/fortran/parse.c:6124
> 0x72b182 gfc_be_parse_file
> ../../gcc/fortran/f95-lang.c:202


With up to date trunk (GNU Fortran (GCC) 8.0.0 20171109),
I see

% gfcx -c a.f90
a.f90:3:31:

   character :: c(1) = [t()]
   1
Error: Derived type 't' at (1) is being used before it is defined

I see the same error for the code in comment #2.  I'll prepare
testcases and commit those later today or tomorrow.

[Bug fortran/78686] ICE in gfc_apply_init, at fortran/expr.c:4124

2016-12-06 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78686

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-12-06
 Ever confirmed|0   |1

--- Comment #2 from Dominique d'Humieres  ---
Confirmed.

[Bug fortran/78686] ICE in gfc_apply_init, at fortran/expr.c:4124

2016-12-05 Thread gerhard.steinmetz.fort...@t-online.de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78686

--- Comment #1 from Gerhard Steinmetz  
---

Whereas, for example with "real" :


$ cat z2.f90
program p
   type t
  real :: c(1) = [t()]
   end type
end


$ gfortran-7-20161204 z2.f90
z2.f90:3:20:

   real :: c(1) = [t()]
1
Error: Can't convert TYPE(t) to REAL(4) at (1)