This is the mail archive of the gcc-bugs@gcc.gnu.org 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]

[Bug go/60728] New: recover() should not work in recursive deferred fucntions


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60728

            Bug ID: 60728
           Summary: recover() should not work in recursive deferred
                    fucntions
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: go
          Assignee: ian at airs dot com
          Reporter: vogt at linux dot vnet.ibm.com

>From an email discussion between me and with Ian Lance Taylor about the
function statements.cc:build_thunk():

Ian Lance Taylor wrote:
> On Fri, Mar 28, 2014 at 3:37 AM, Dominik Vogt <vogt@linux.vnet.ibm.com> wrote:
> > (First note that I think there's a bug in the current code with
> > recursive calls of functions with recover.  Consider this:
> >
> >   func f() {
> >     defer g(0);
> >     ...
> >   }
> >
> >   func g(n int) {
> >     if n == 0 {
> >       g(1)
> >     } else {
> >       recover()
> >     }
> >   }
> >
> > With the current logic the recursive call of g() would recover
> > (__go_gan_recover returns true), but it shouldn't because it's not
> > called directly.  The following sketch takes care of that
> > situation.)
>
> Good point.


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