public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/104312] New: ICE with -ff2c in fold_convert_loc, at fold-const.cc:2451
@ 2022-01-31 20:01 gscfq@t-online.de
  2023-04-05 20:27 ` [Bug fortran/104312] " anlauf at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gscfq@t-online.de @ 2022-01-31 20:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104312

            Bug ID: 104312
           Summary: ICE with -ff2c in fold_convert_loc, at
                    fold-const.cc:2451
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Affects versions down to at least r5 :


$ cat z1.f90
function f()
real, pointer :: f, e
entry e()
end


$ gfortran-12-20220130 -c z1.f90
$
$ gfortran-12-20220130 -c z1.f90 -ff2c
z1.f90:1:0:

    1 | function f()
      |
internal compiler error: in fold_convert_loc, at fold-const.cc:2451
0x9b68e7 fold_convert_loc(unsigned int, tree_node*, tree_node*)
        ../../gcc/fold-const.cc:2450
0xa3130d gimplify_modify_expr
        ../../gcc/gimplify.cc:5918
0xa2901a gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc/gimplify.cc:14963
0xa2bb48 gimplify_stmt(tree_node**, gimple**)
        ../../gcc/gimplify.cc:7035
0xa29306 gimplify_and_add(tree_node*, gimple**)
        ../../gcc/gimplify.cc:495
0xa29306 gimplify_return_expr
        ../../gcc/gimplify.cc:1677
0xa29306 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc/gimplify.cc:15225
0xa2bb48 gimplify_stmt(tree_node**, gimple**)
        ../../gcc/gimplify.cc:7035
0xa2c0a1 gimplify_bind_expr
        ../../gcc/gimplify.cc:1427
0xa2948a gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc/gimplify.cc:15164
0xa2bb48 gimplify_stmt(tree_node**, gimple**)
        ../../gcc/gimplify.cc:7035
0xa2cbcb gimplify_body(tree_node*, bool)
        ../../gcc/gimplify.cc:16209
0xa2d01f gimplify_function_tree(tree_node*)
        ../../gcc/gimplify.cc:16363
0x8b3147 cgraph_node::analyze()
        ../../gcc/cgraphunit.cc:675
0x8b5af7 analyze_functions
        ../../gcc/cgraphunit.cc:1240
0x8b64bd symbol_table::finalize_compilation_unit()
        ../../gcc/cgraphunit.cc:2500

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/104312] ICE with -ff2c in fold_convert_loc, at fold-const.cc:2451
  2022-01-31 20:01 [Bug fortran/104312] New: ICE with -ff2c in fold_convert_loc, at fold-const.cc:2451 gscfq@t-online.de
@ 2023-04-05 20:27 ` anlauf at gcc dot gnu.org
  2023-04-11 20:13 ` anlauf at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-04-05 20:27 UTC (permalink / raw)
  To: 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/104312] ICE with -ff2c in fold_convert_loc, at fold-const.cc:2451
  2022-01-31 20:01 [Bug fortran/104312] New: ICE with -ff2c in fold_convert_loc, at fold-const.cc:2451 gscfq@t-online.de
  2023-04-05 20:27 ` [Bug fortran/104312] " anlauf at gcc dot gnu.org
@ 2023-04-11 20:13 ` anlauf at gcc dot gnu.org
  2023-04-12  9:14 ` cvs-commit at gcc dot gnu.org
  2023-04-12  9:22 ` anlauf at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-04-11 20:13 UTC (permalink / raw)
  To: 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/104312] ICE with -ff2c in fold_convert_loc, at fold-const.cc:2451
  2022-01-31 20:01 [Bug fortran/104312] New: ICE with -ff2c in fold_convert_loc, at fold-const.cc:2451 gscfq@t-online.de
  2023-04-05 20:27 ` [Bug fortran/104312] " anlauf at gcc dot gnu.org
  2023-04-11 20:13 ` anlauf at gcc dot gnu.org
@ 2023-04-12  9:14 ` cvs-commit at gcc dot gnu.org
  2023-04-12  9:22 ` anlauf at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-04-12  9:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104312

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:

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

commit r13-7146-g2273fd5a6fdbe8f7da2c0e217c279bcbaaa7df9e
Author: Harald Anlauf <anlauf@gmx.de>
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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/104312] ICE with -ff2c in fold_convert_loc, at fold-const.cc:2451
  2022-01-31 20:01 [Bug fortran/104312] New: ICE with -ff2c in fold_convert_loc, at fold-const.cc:2451 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2023-04-12  9:14 ` cvs-commit at gcc dot gnu.org
@ 2023-04-12  9:22 ` anlauf at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-04-12  9:22 UTC (permalink / raw)
  To: 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-04-12  9:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-31 20:01 [Bug fortran/104312] New: ICE with -ff2c in fold_convert_loc, at fold-const.cc:2451 gscfq@t-online.de
2023-04-05 20:27 ` [Bug fortran/104312] " anlauf at gcc dot gnu.org
2023-04-11 20:13 ` anlauf at gcc dot gnu.org
2023-04-12  9:14 ` cvs-commit at gcc dot gnu.org
2023-04-12  9:22 ` anlauf at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).