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: Fortran patches

On Thu, Dec 06, 2018 at 08:02:43PM +0100, Thomas Koenig wrote:
> >>>         PR fortran/88139
> >>>         * dump-parse-tree.c (write_proc): Alternate return.
> >> I dissent with this patch. The introduced error is meaningless and, as
> >> mentioned by comment #3 in the PR, avoiding the ICE in dump-parse-tree
> >> is not directly the issue. The code should be rejected in parsing. In
> >> gcc-8.1 the invalid code is accepted (without an ICE) even without the
> >> -fc-prototypes flag: I haven't finished building the compiler with
> >> your changes yet to see whether that is still true afterwards, but at
> >> least the test case doesn't try this, so I strongly suspect the patch
> >> is incomplete to fix the PR.
> >   
> > Comment #3 does not contain a patch to fix the problem elsewhere.
> I know :-)
> > In F2003, 15.2.6 "Interoperability of procedures and procedure interfaces",
> > I cannot find a prohibition on an alternate return in a subroutine
> > interface with BIND(C).
> I also does not allow this, and does not offer a valid interpretation
> of what it should mean.
> If it has a meaning, it should be translatable into something prescribed
> by the standard with -fc-prototypes.
> I have assigned the error to myself, so I will not forget to fix
> it before the gcc 9 release.

I have asked on c.l.f.  It seems NAG rejects alternate return
mixed with bind(c).  FortranFan provided a complete testcase:

   subroutine foo(*) bind(C, name='f')
   end subroutine foo
program p
      subroutine bar(*) bind(C, name='f')
      end subroutine bar
   end interface
   call bar( *10 )
   print *, "Return following 'bar' invocation: jumping to 20"
   go to 20
10 print *, "THIS IS UNEXPECTED: Alternate return to 10 after bar"
20 continue
end program p

NAG rejects it.  Intel, PGI, and gfortran accept it.


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