Started with r9, changed between 20190728 and 20190811 : $ cat z1.f90 function f(a) return end $ gfortran-12-20220130 -c z1.f90 -ff2c z1.f90:1:0: 1 | function f(a) | Error: non-trivial conversion in 'var_decl' real(kind=8) real(kind=4) D.4216 = __result_f; z1.f90:1:0: internal compiler error: 'verify_gimple' failed 0xeba38d verify_gimple_in_seq(gimple*) ../../gcc/tree-cfg.cc:5211 0xb40ea1 gimplify_body(tree_node*, bool) ../../gcc/gimplify.cc:16292 0xb41147 gimplify_function_tree(tree_node*) ../../gcc/gimplify.cc:16363 0x952b17 cgraph_node::analyze() ../../gcc/cgraphunit.cc:675 0x955dc6 analyze_functions ../../gcc/cgraphunit.cc:1240 0x956f9d symbol_table::finalize_compilation_unit() ../../gcc/cgraphunit.cc:2500
Started with r10-2279-ge0af8f52b10385d8.
diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc index 6493cc2f6b1..908a4c6d42e 100644 --- a/gcc/fortran/trans-decl.cc +++ b/gcc/fortran/trans-decl.cc @@ -6474,7 +6474,7 @@ gfc_generate_return (void) NULL_TREE, and a 'return' is generated without a variable. The following generates a 'return __result_XXX' where XXX is the function name. */ - if (sym == sym->result && sym->attr.function) + if (sym == sym->result && sym->attr.function && !flag_f2c) { result = gfc_get_fake_result_decl (sym, 0); result = fold_build2_loc (input_location, MODIFY_EXPR,
On Tue, Feb 01, 2022 at 03:52:51PM +0000, kargl at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104313 > > --- Comment #2 from kargl at gcc dot gnu.org --- > diff --git a/gcc/fortran/trans-decl.cc b/gcc/fortran/trans-decl.cc > index 6493cc2f6b1..908a4c6d42e 100644 > --- a/gcc/fortran/trans-decl.cc > +++ b/gcc/fortran/trans-decl.cc > @@ -6474,7 +6474,7 @@ gfc_generate_return (void) > NULL_TREE, and a 'return' is generated without a variable. > The following generates a 'return __result_XXX' where XXX is > the function name. */ > - if (sym == sym->result && sym->attr.function) > + if (sym == sym->result && sym->attr.function && !flag_f2c) > { > result = gfc_get_fake_result_decl (sym, 0); > result = fold_build2_loc (input_location, MODIFY_EXPR, > Passes regression testing.
GCC 9 branch is being closed
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
On Tue, Jun 28, 2022 at 10:47:54AM +0000, jakub at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104313 > > Jakub Jelinek <jakub at gcc dot gnu.org> changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > Target Milestone|10.4 |10.5 > > --- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- > GCC 10.4 is being released, retargeting bugs to GCC 10.5. > The patch in comment 2 fixes the issue. It was submitted 13 hours after the initial report.
(In reply to Steve Kargl from comment #6) > The patch in comment 2 fixes the issue. It was submitted > 13 hours after the initial report. Steve, if you like, I can commit your patch under your name. It's pretty obvious. How about the following testcase? ! { dg-do compile } ! { dg-additional-options "-ff2c -fdump-tree-original" } ! ! PR fortran/104313 - ICE verify_gimple failed with -ff2c ! Contributed by G.Steinmetz function f(a) return end ! { dg-final { scan-tree-dump-times "return" 1 "original" } }
(In reply to anlauf from comment #7) > (In reply to Steve Kargl from comment #6) > > The patch in comment 2 fixes the issue. It was submitted > > 13 hours after the initial report. > > Steve, if you like, I can commit your patch under your name. > It's pretty obvious. > > How about the following testcase? > > ! { dg-do compile } > ! { dg-additional-options "-ff2c -fdump-tree-original" } > ! > ! PR fortran/104313 - ICE verify_gimple failed with -ff2c > ! Contributed by G.Steinmetz > > function f(a) > return > end > > ! { dg-final { scan-tree-dump-times "return" 1 "original" } } LGTM. Whether my name appears or not isn't important to me. A working compiler is. The patch itself seems obvious, and I suspect you would have eventually found it. So commit as yo see fit.
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>: https://gcc.gnu.org/g:517fb1a78102df43f052c6934c27dd51d786aff7 commit r13-1715-g517fb1a78102df43f052c6934c27dd51d786aff7 Author: Steve Kargl <kargl@gcc.gnu.org> Date: Fri Jul 15 22:07:15 2022 +0200 Fortran: do not generate conflicting results under -ff2c [PR104313] gcc/fortran/ChangeLog: PR fortran/104313 * trans-decl.cc (gfc_generate_return): Do not generate conflicting fake results for functions with no result variable under -ff2c. gcc/testsuite/ChangeLog: PR fortran/104313 * gfortran.dg/pr104313.f: New test.
The releases/gcc-12 branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>: https://gcc.gnu.org/g:c1b0037bcc26019a87935e5634b6d448e9773193 commit r12-8572-gc1b0037bcc26019a87935e5634b6d448e9773193 Author: Steve Kargl <kargl@gcc.gnu.org> Date: Fri Jul 15 22:07:15 2022 +0200 Fortran: do not generate conflicting results under -ff2c [PR104313] gcc/fortran/ChangeLog: PR fortran/104313 * trans-decl.cc (gfc_generate_return): Do not generate conflicting fake results for functions with no result variable under -ff2c. gcc/testsuite/ChangeLog: PR fortran/104313 * gfortran.dg/pr104313.f: New test. (cherry picked from commit 517fb1a78102df43f052c6934c27dd51d786aff7)
The releases/gcc-11 branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>: https://gcc.gnu.org/g:663ac94cf02b18c9c89a2ada9d3c7cded08e29d6 commit r11-10150-g663ac94cf02b18c9c89a2ada9d3c7cded08e29d6 Author: Steve Kargl <kargl@gcc.gnu.org> Date: Fri Jul 15 22:07:15 2022 +0200 Fortran: do not generate conflicting results under -ff2c [PR104313] gcc/fortran/ChangeLog: PR fortran/104313 * trans-decl.c (gfc_generate_return): Do not generate conflicting fake results for functions with no result variable under -ff2c. gcc/testsuite/ChangeLog: PR fortran/104313 * gfortran.dg/pr104313.f: New test. (cherry picked from commit 517fb1a78102df43f052c6934c27dd51d786aff7)
The releases/gcc-10 branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>: https://gcc.gnu.org/g:168a1ae79bb86bdfe482c7c80ea742d40cc414c5 commit r10-10898-g168a1ae79bb86bdfe482c7c80ea742d40cc414c5 Author: Steve Kargl <kargl@gcc.gnu.org> Date: Fri Jul 15 22:07:15 2022 +0200 Fortran: do not generate conflicting results under -ff2c [PR104313] gcc/fortran/ChangeLog: PR fortran/104313 * trans-decl.c (gfc_generate_return): Do not generate conflicting fake results for functions with no result variable under -ff2c. gcc/testsuite/ChangeLog: PR fortran/104313 * gfortran.dg/pr104313.f: New test. (cherry picked from commit 517fb1a78102df43f052c6934c27dd51d786aff7)
Fixed. Thanks for the report!