[LLVMbugs] [Bug 8175] Destructors for stack variables not firing on goto from scope

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Sep 18 10:42:30 PDT 2010


http://llvm.org/bugs/show_bug.cgi?id=8175

John Plevyak <jplevyak at acm.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |

--- Comment #2 from John Plevyak <jplevyak at acm.org> 2010-09-18 12:42:30 CDT ---
This case still fails:

#include "stdio.h"

class L {
  public:
    int i;
    L(int j) : i(j) { printf("L(%d)\n", i); }
    ~L() { if (i != 11) printf("~L(%d)\n", i); }
};

int main(int argc, char *argv[]) {
  {
    L b(argc) ;
    printf("goto\n");
    if (!argc) goto l;
    if (argc < 10) {
      if (argc) goto l;
    } else {
      if (argc == 9) return 2;
    }
    return 1;
  }
 l:
  printf("here\n"); 
  return 5;
}

jplevyak:svn [97] % g++ x.cc ; a.out
L(1)
goto
~L(1)
here

jplevyak:svn [98] % clang++ x.cc ; a.out
L(1)
goto
here

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list