[Bug fortran/104312] ICE with -ff2c in fold_convert_loc, at fold-const.cc:2451

2023-04-12 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104312

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #4 from anlauf at gcc dot gnu.org ---
Fixed on mainline for gcc-13.

[Bug fortran/104312] ICE with -ff2c in fold_convert_loc, at fold-const.cc:2451

2023-04-12 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104312

--- Comment #3 from CVS Commits  ---
The master branch has been updated by Harald Anlauf :

https://gcc.gnu.org/g:2273fd5a6fdbe8f7da2c0e217c279bcbaaa7df9e

commit r13-7146-g2273fd5a6fdbe8f7da2c0e217c279bcbaaa7df9e
Author: Harald Anlauf 
Date:   Tue Apr 11 21:44:20 2023 +0200

Fortran: fix functions with entry and pointer/allocatable result [PR104312]

gcc/fortran/ChangeLog:

PR fortran/104312
* resolve.cc (resolve_entries): Handle functions with ENTRY and
ALLOCATABLE results.
* trans-expr.cc (gfc_conv_procedure_call): Functions with a result
with the POINTER or ALLOCATABLE attribute shall not get any special
treatment with -ff2c, as they cannot be written in Fortran 77.
* trans-types.cc (gfc_return_by_reference): Likewise.
(gfc_get_function_type): Likewise.

gcc/testsuite/ChangeLog:

PR fortran/104312
* gfortran.dg/entry_26.f90: New test.
* gfortran.dg/entry_27.f90: New test.

[Bug fortran/104312] ICE with -ff2c in fold_convert_loc, at fold-const.cc:2451

2023-04-11 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104312

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |anlauf at gcc dot 
gnu.org

--- Comment #2 from anlauf at gcc dot gnu.org ---
Patch: https://gcc.gnu.org/pipermail/fortran/2023-April/059167.html

[Bug fortran/104312] ICE with -ff2c in fold_convert_loc, at fold-const.cc:2451

2023-04-05 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104312

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
 CC||anlauf at gcc dot gnu.org
   Last reconfirmed||2023-04-05

--- Comment #1 from anlauf at gcc dot gnu.org ---
Confirmed.

The issue may be clearer if the testcase is extended as follows:

function f()
  real, pointer :: f, e
  real, target  :: a(2)
  f => a(1)
  return
entry e()
  e => a(2)
end

so that one gets (before the traceback):

pr104312-zz.f90:5:8:

5 |   return
  |1
Error: pointer value used where a floating-point was expected
pr104312-zz.f90:8:3:

8 | end
  |   1
Error: pointer value used where a floating-point was expected
pr104312-zz.f90:1:0:

1 | function f()
  | 
internal compiler error: in fold_convert_loc, at fold-const.cc:2504


Setting a breakpoint in gfc_generate_return and checking the fndecl,
one sees that it is wrong for -ff2c.