This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, fortran] PR30236 - alternate-return subroutine in generic interface causes ice/segfault

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

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. :)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]