* [Bug fortran/104572] ICE in gfc_resolve_finalizers, at fortran/resolve.cc:13646
2022-02-16 17:34 [Bug fortran/104572] New: ICE in gfc_resolve_finalizers, at fortran/resolve.cc:13646 gscfq@t-online.de
@ 2022-02-16 19:49 ` kargl at gcc dot gnu.org
2023-03-21 21:02 ` anlauf at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: kargl at gcc dot gnu.org @ 2022-02-16 19:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104572
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
Ever confirmed|0 |1
Last reconfirmed| |2022-02-16
CC| |kargl at gcc dot gnu.org
Status|UNCONFIRMED |NEW
--- Comment #1 from kargl at gcc dot gnu.org ---
Self explanatory.
diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index 835a4783718..1e7c3a07d0e 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -13643,6 +13653,13 @@ gfc_resolve_finalizers (gfc_symbol* derived, bool
*finalizable)
}
arg = dummy_args->sym;
+ if (!arg)
+ {
+ gfc_error ("Argument of FINAL procedure at %L cannot be an "
+ "alternate return", &list->proc_sym->declared_at);
+ goto error;
+ }
+
/* This argument must be of our type. */
if (arg->ts.type != BT_DERIVED || arg->ts.u.derived != derived)
{
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/104572] ICE in gfc_resolve_finalizers, at fortran/resolve.cc:13646
2022-02-16 17:34 [Bug fortran/104572] New: ICE in gfc_resolve_finalizers, at fortran/resolve.cc:13646 gscfq@t-online.de
2022-02-16 19:49 ` [Bug fortran/104572] " kargl at gcc dot gnu.org
@ 2023-03-21 21:02 ` anlauf at gcc dot gnu.org
2023-03-21 21:10 ` sgk at troutmask dot apl.washington.edu
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-03-21 21:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104572
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anlauf at gcc dot gnu.org
--- Comment #2 from anlauf at gcc dot gnu.org ---
(In reply to kargl from comment #1)
> Self explanatory.
>
> diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
Yes. Either this or:
@@ -13986,6 +13995,13 @@ gfc_resolve_finalizers (gfc_symbol* derived, bool
*finalizable)
}
arg = dummy_args->sym;
+ if (!arg)
+ {
+ gfc_error ("Argument of FINAL procedure at %L must be of type %qs",
+ &list->proc_sym->declared_at, derived->name);
+ goto error;
+ }
+
if (arg->as && arg->as->type == AS_ASSUMED_RANK
&& ((list != derived->f2k_derived->finalizers) || list->next))
{
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/104572] ICE in gfc_resolve_finalizers, at fortran/resolve.cc:13646
2022-02-16 17:34 [Bug fortran/104572] New: ICE in gfc_resolve_finalizers, at fortran/resolve.cc:13646 gscfq@t-online.de
2022-02-16 19:49 ` [Bug fortran/104572] " kargl at gcc dot gnu.org
2023-03-21 21:02 ` anlauf at gcc dot gnu.org
@ 2023-03-21 21:10 ` sgk at troutmask dot apl.washington.edu
2023-03-22 18:25 ` cvs-commit at gcc dot gnu.org
2023-03-22 19:11 ` anlauf at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2023-03-21 21:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104572
--- Comment #3 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Tue, Mar 21, 2023 at 09:02:14PM +0000, anlauf at gcc dot gnu.org wrote:
> --- Comment #2 from anlauf at gcc dot gnu.org ---
> (In reply to kargl from comment #1)
> > Self explanatory.
> >
> > diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
>
> Yes. Either this or:
I'm fine with gfortran emitting either error message.
As we've both put eyes on the bug, go ahead and use
your error message and commit.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/104572] ICE in gfc_resolve_finalizers, at fortran/resolve.cc:13646
2022-02-16 17:34 [Bug fortran/104572] New: ICE in gfc_resolve_finalizers, at fortran/resolve.cc:13646 gscfq@t-online.de
` (2 preceding siblings ...)
2023-03-21 21:10 ` sgk at troutmask dot apl.washington.edu
@ 2023-03-22 18:25 ` cvs-commit at gcc dot gnu.org
2023-03-22 19:11 ` anlauf at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-03-22 18:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104572
--- Comment #4 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:3e791f45ded89626bc1f9f8013728f6e035801b2
commit r13-6812-g3e791f45ded89626bc1f9f8013728f6e035801b2
Author: Harald Anlauf <anlauf@gmx.de>
Date: Wed Mar 22 19:20:41 2023 +0100
Fortran: improve checking of FINAL subroutine arguments [PR104572]
gcc/fortran/ChangeLog:
PR fortran/104572
* resolve.cc (gfc_resolve_finalizers): Argument of a FINAL
subroutine
cannot be an alternate return.
gcc/testsuite/ChangeLog:
PR fortran/104572
* gfortran.dg/pr104572.f90: New test.
Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug fortran/104572] ICE in gfc_resolve_finalizers, at fortran/resolve.cc:13646
2022-02-16 17:34 [Bug fortran/104572] New: ICE in gfc_resolve_finalizers, at fortran/resolve.cc:13646 gscfq@t-online.de
` (3 preceding siblings ...)
2023-03-22 18:25 ` cvs-commit at gcc dot gnu.org
@ 2023-03-22 19:11 ` anlauf at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-03-22 19:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104572
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |13.0
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #5 from anlauf at gcc dot gnu.org ---
(In reply to Steve Kargl from comment #3)
> I'm fine with gfortran emitting either error message.
> As we've both put eyes on the bug, go ahead and use
> your error message and commit.
When using -std=f2018, the new testcase emits:
gcc/testsuite/gfortran.dg/pr104572.f90:12:17:
12 | subroutine s(*) ! { dg-error "Argument of FINAL procedure" }
| 1
Warning: Obsolescent feature: Alternate-return argument at (1)
gcc/testsuite/gfortran.dg/pr104572.f90:12:14:
12 | subroutine s(*) ! { dg-error "Argument of FINAL procedure" }
| 1
Error: Argument of FINAL procedure at (1) must be of type 't'
The error message is also close to that emitted by other brands.
***
Closing.
^ permalink raw reply [flat|nested] 6+ messages in thread