Changed between 20171112 and 20171119 : $ cat z1.f90 program p type t integer :: a end type type(t) :: x(3) x = f() print *, x contains elemental function f() result(z) class(t), pointer :: z(:) end end $ gfortran-8-20171112 -c z1.f90 $ $ gfortran-8-20180121 -c z1.f90 z1.f90:6:0: x = f() internal compiler error: in gfc_trans_assignment_1, at fortran/trans-expr.c:10233 0x784622 gfc_trans_assignment_1 ../../gcc/fortran/trans-expr.c:10232 0x748027 trans_code ../../gcc/fortran/trans.c:1828 0x76ef29 gfc_generate_function_code(gfc_namespace*) ../../gcc/fortran/trans-decl.c:6451 0x6fecd0 translate_all_program_units ../../gcc/fortran/parse.c:6103 0x6fecd0 gfc_parse_file() ../../gcc/fortran/parse.c:6306 0x74520f gfc_be_parse_file ../../gcc/fortran/f95-lang.c:204
Please note that a result with "type" instead of "class" gives : $ cat z2.f90 program p type t integer :: a end type type(t) :: x(3) x = f() print *, x contains elemental function f() result(z) type(t), pointer :: z(:) end end $ gfortran-8-20171112 -c z2.f90 z2.f90:9:3: elemental function f() result(z) 1 Error: ELEMENTAL function 'f' at (1) must have a scalar result $ gfortran-8-20180121 -c z2.f90 z2.f90:9:3: elemental function f() result(z) 1 Error: ELEMENTAL function 'f' at (1) must have a scalar result
Started with r254936.
Created attachment 43234 [details] submit2.diff Hi Jakub, I have made the changes to the types of the dtype elements that you suggested. It led to a cast being needed in trans-intrinsic.c(gfc_conv_intrinsic_rank) but, apart from that, the changes were straightforward. Please find the updated patch attached. OK for trunk? Once I have committed this patch, I promise that I will stick to regressions and bug fixes through to release :-) Paul On 24 January 2018 at 09:11, jakub at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org> wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83999 > > Jakub Jelinek <jakub at gcc dot gnu.org> changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > Priority|P3 |P4 > Status|UNCONFIRMED |NEW > Last reconfirmed| |2018-01-24 > CC| |jakub at gcc dot gnu.org, > | |pault at gcc dot gnu.org > Ever confirmed|0 |1 > > --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- > Started with r254936. > > -- > You are receiving this mail because: > You are on the CC list for the bug.
(In reply to paul.richard.thomas@gmail.com from comment #3) > OK for trunk? Ok, thanks.
Hi Jakub, Thanks for the OK and the help in getting the padding sorted out. Committed as Committed revision 257065. Paul On 24 January 2018 at 20:26, Paul Richard Thomas <paul.richard.thomas@gmail.com> wrote: > Hi Jakub, > > I have made the changes to the types of the dtype elements that you > suggested. It led to a cast being needed in > trans-intrinsic.c(gfc_conv_intrinsic_rank) but, apart from that, the > changes were straightforward. Please find the updated patch attached. > > OK for trunk? > > Once I have committed this patch, I promise that I will stick to > regressions and bug fixes through to release :-) > > Paul > > > On 24 January 2018 at 09:11, jakub at gcc dot gnu.org > <gcc-bugzilla@gcc.gnu.org> wrote: >> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83999 >> >> Jakub Jelinek <jakub at gcc dot gnu.org> changed: >> >> What |Removed |Added >> ---------------------------------------------------------------------------- >> Priority|P3 |P4 >> Status|UNCONFIRMED |NEW >> Last reconfirmed| |2018-01-24 >> CC| |jakub at gcc dot gnu.org, >> | |pault at gcc dot gnu.org >> Ever confirmed|0 |1 >> >> --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- >> Started with r254936. >> >> -- >> You are receiving this mail because: >> You are on the CC list for the bug. > > > > -- > "If you can't explain it simply, you don't understand it well enough" > - Albert Einstein
GCC 8.1 has been released.
GCC 8.2 has been released.
For some reason, the array spec is not set for the symbol for z1.f90: (gdb) p sym->as $11 = (gfc_array_spec *) 0x0 (gdb) p sym->name $12 = 0x7ffff734d0b8 "f" (with a breakpoint in resolve_fl_procedure).
Created attachment 44799 [details] Patch for the PR For some reason, I do not see the problem on the current 8-branch. In fact, it comes up with the correct error, even though this patch has not been applied! I will apply to both branches as a belt-and-braces fix :-) Cheers Paul
Author: pault Date: Sat Oct 6 15:14:29 2018 New Revision: 264899 URL: https://gcc.gnu.org/viewcvs?rev=264899&root=gcc&view=rev Log: 2018-10-06 Paul Thomas <pault@gcc.gnu.org> PR fortran/83999 * resolve.c (resolve_fl_procedure): Include class functions in the test that elemental function results be scalar. 2018-10-06 Paul Thomas <pault@gcc.gnu.org> PR fortran/83999 * gfortran.dg/elemental_function_4.f90 : New test. Added: trunk/gcc/testsuite/gfortran.dg/elemental_function_4.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/resolve.c trunk/gcc/testsuite/ChangeLog
Author: pault Date: Mon Oct 8 14:20:40 2018 New Revision: 264931 URL: https://gcc.gnu.org/viewcvs?rev=264931&root=gcc&view=rev Log: 2018-10-08 Paul Thomas <pault@gcc.gnu.org> PR fortran/83999 Backport from trunk * resolve.c (resolve_fl_procedure): Include class functions in the test that elemental function results be scalar. 2018-10-08 Paul Thomas <pault@gcc.gnu.org> PR fortran/83999 Backport from trunk * gfortran.dg/elemental_function_4.f90 : New test. Added: branches/gcc-8-branch/gcc/testsuite/gfortran.dg/elemental_function_4.f90 Modified: branches/gcc-8-branch/gcc/fortran/ChangeLog branches/gcc-8-branch/gcc/fortran/resolve.c branches/gcc-8-branch/gcc/testsuite/ChangeLog
Fixed on both branches. Thanks for the report. Paul