This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, fortran] PR30236 - alternate-return subroutine in generic interface causes ice/segfault
- From: Brooks Moses <brooks dot moses at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: fortran at gcc dot gnu dot org
- Date: Mon, 18 Dec 2006 00:29:24 -0800
- Subject: Re: [Patch, fortran] PR30236 - alternate-return subroutine in generic interface causes ice/segfault
- References: <45863DD6.3090800@wanadoo.fr>
Paul Thomas wrote:
*** gcc/testsuite/gfortran.dg/generic_11.f90 (revision 0)
--- gcc/testsuite/gfortran.dg/generic_11.f90 (revision 0)
***************
*** 0 ****
--- 1,39 ----
+ ! { dg-do compile }
[...]
+ program test
+ use arswitch
+ implicit none
+ integer :: i = 0
+ 10 continue
+ call with (i, *20)
+ print *, " looping with i = ", i
+ i = 2
+ goto 10
+ 20 print *, " leaving with i = ", i
+ end
Looking at this, it seems like it might be a good idea for the testcase
not to risk infinite looping as a failure mode. Maybe something like this?
(Also, you're still calling the specific "with" name, not the generic
"gen" name, so this isn't testing the disambiguation; I changed it to
call the generic name.)
program test
use arswitch
implicit none
integer :: i = 0
call gen (i, *10)
i = 2
call gen (i, *20)
10 continue
call abort()
20 continue
end
Though, actually, I just noticed that that's not a "dg-do run" test,
even though the main program is rather longer than you'd need just for
compile testing. However, it's probably useful to have a test for
alternate returns that's run -- so far, the only one I know of
(altreturn_1.f90) is compile-only -- so changing this to dg-do run might
be a good idea. For that matter, calling this one altreturn_2.f90 might
also be a little better than generic_11.f90, since there are a lot fewer
of the former.
Meanwhile, as an unofficial review -- the rest of the patch looks good
to me, and matches the sort of thing I was finding to be the cause of PR
30235. With the above notes, I'd give the whole thing an OK.
- Brooks
P.S. let me know if you do call this one altreturn_2, and I'll rename my
pending-review one to altreturn_3. Or you can name yours altreturn_3.
Or something. :)