[Bug fortran/80467] Function Without Arguments Fails to Generate Error When Declared Later

gscfq@t-online.de gcc-bugzilla@gcc.gnu.org
Tue Nov 27 17:51:00 GMT 2018


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

G. Steinmetz <gscfq@t-online.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gscfq@t-online.de

--- Comment #8 from G. Steinmetz <gscfq@t-online.de> ---

Update, renewing some insights from above. Also related to pr40678.


$ cat z1.f90
program p
contains
   subroutine testargs
      x = g !()
   end
   real function g()
      g = 3.0
   end
end


$ cat z2.f90
program p   ! reversed order
contains
   real function g()
      g = 3.0
   end
   subroutine testargs
      x = g !()
   end
end


$ gfortran-9-20181125 -c z2.f90
z2.f90:7:12:
    7 |       x = g !()
      |            1
Error: Function 'g' requires an argument list at (1)


$ gfortran-9-20181125-chk -c z1.f90   # with --enable-checking=yes
z1.f90:3:0:
    3 |    subroutine testargs
      |
Error: invalid types in conversion to floating point
real(kind=4)
real(kind=4) (*<T5be>) (void)
x = (real(kind=4)) g;
z1.f90:3:0: internal compiler error: verify_gimple failed
0xcce85d verify_gimple_in_seq(gimple*)
        ../../gcc/tree-cfg.c:5082
0x9e2235 gimplify_body(tree_node*, bool)
        ../../gcc/gimplify.c:13636
0x9e2524 gimplify_function_tree(tree_node*)
        ../../gcc/gimplify.c:13726
0xd3816f gimplify_all_functions
        ../../gcc/tree-nested.c:3410
0xd3815f gimplify_all_functions
        ../../gcc/tree-nested.c:3413
0xd41e9e lower_nested_functions(tree_node*)
        ../../gcc/tree-nested.c:3430
0x82c560 cgraph_node::analyze()
        ../../gcc/cgraphunit.c:673
0x82f9e9 analyze_functions
        ../../gcc/cgraphunit.c:1126
0x830ac2 symbol_table::finalize_compilation_unit()
        ../../gcc/cgraphunit.c:2835


More information about the Gcc-bugs mailing list