Bug 1576463 - gfortran internal compiler error: in convert_move, at expr.c:229 for buggy Fortran code
Summary: gfortran internal compiler error: in convert_move, at expr.c:229 for buggy Fo...
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 27
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-05-09 14:03 UTC by Susi Lehtola
Modified: 2018-11-30 21:32 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-11-30 21:32:09 UTC
Type: Bug


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 85738 0 None None None 2018-05-10 18:42:26 UTC

Description Susi Lehtola 2018-05-09 14:03:42 UTC
I found a crash in
$ gfortran --version
GNU Fortran (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)

for a slightly buggy Fortran code I downloaded from a software repository. The reduced testcase is as follows

$ cat > test.f90 << EOF
module test
contains
  function gx(l)
    implicit none
    integer, intent(in) :: l
    integer, external :: fx
    real(8) :: gx
    gx=fx(l)**2/(2*(2*l + 1))
  end function gx
end module test

function fx(l)
  implicit none
  integer, intent(in) :: l
  real(8) :: fx
  fx = l
end function fx
EOF

$ gfortran -c test.f90 
test.f90:8:0:

     gx=fx(l)**2/(2*(2*l + 1))
 
internal compiler error: in convert_move, at expr.c:229
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.

The same source compiles fine in gfortran 4.4.7 (on RHEL7).

I was able to get the code to compile on 7.3.1 by fixing the external definition for fx, i.e.
    integer, external :: fx
to
    real(8), external :: fx

but I think the compiler shouldn't crash even if its given buggy code.

Comment 1 Marek Polacek 2018-05-09 15:55:07 UTC
(In reply to Susi Lehtola from comment #0)
> but I think the compiler shouldn't crash even if its given buggy code.

Right.

With trunk:
$ ./f951 -quiet z.f90
z.f90:3:0:

   function gx(l)
 
Error: type mismatch in binary expression
integer(kind=4)

real(kind=8)

integer(kind=4)

_5 = D.3778 / _4;
z.f90:3:0: internal compiler error: verify_gimple failed
0xfc73ce verify_gimple_in_seq(gimple*)
	/home/marek/src/gcc/gcc/tree-cfg.c:5021
0xc43772 gimplify_body(tree_node*, bool)
	/home/marek/src/gcc/gcc/gimplify.c:12715
0xc43c52 gimplify_function_tree(tree_node*)
	/home/marek/src/gcc/gcc/gimplify.c:12805
0xa077c4 cgraph_node::analyze()
	/home/marek/src/gcc/gcc/cgraphunit.c:670
0xa090a9 analyze_functions
	/home/marek/src/gcc/gcc/cgraphunit.c:1131
0xa0dd69 symbol_table::finalize_compilation_unit()
	/home/marek/src/gcc/gcc/cgraphunit.c:2691
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Comment 2 Susi Lehtola 2018-05-09 16:46:25 UTC
Great success!

Comment 3 Ben Cotton 2018-11-27 15:46:12 UTC
This message is a reminder that Fedora 27 is nearing its end of life.
On 2018-Nov-30  Fedora will stop maintaining and issuing updates for
Fedora 27. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora  'version' of '27'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 27 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 4 Ben Cotton 2018-11-30 21:32:09 UTC
Fedora 27 changed to end-of-life (EOL) status on 2018-11-30. Fedora 27 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.