efriedma added inline comments.
================ Comment at: lib/Sema/JumpDiagnostics.cpp:347 + LabelAndGotoScopes[S] = ParentScope; + Jumps.push_back(S); + } ---------------- jyu2 wrote: > efriedma wrote: > > This doesn't look right; I think we need to add it to IndirectJumps > > instead. This probably impacts a testcase like the following: > > > > ``` > > struct S { ~S(); }; > > int f() { > > { > > S s; > > asm goto(""::::BAR); > > return 1; > > } > > BAR: > > return 0; > > } > > ``` > > > > (gcc currently accepts this and skips running the destructor, but I'm > > pretty sure that's a bug.) > Hi Eli, > I see both g++ and clang++ with my change call ~S. Am I missing something? > Thanks. > > 1>clang++ j.cpp > 1>./a.out > ~S() > 1>g++ j.cpp > 1>./a.out > ~S() > > Here is the test case: > 1>cat j.cpp > extern "C" int printf (const char *,...); > struct S { ~S() {printf("~S()\n");}; }; > int f() { > { > S s; > asm goto(""::::BAR); > return 1; > } > BAR: > return 0; > } > > int main() > { > f(); > } > Oh, sorry, I wasn't paying attention to the actual contents of the asm. If you modify the asm goto slightly, to `asm goto("jmp %0"::::BAR);`, you'll see that the destructor doesn't run, at least with gcc. (This is different from the way `goto BAR;` works.) CHANGES SINCE LAST ACTION https://reviews.llvm.org/D56571/new/ https://reviews.llvm.org/D56571 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits