[PATCH] D56571: [RFC prototype] Implementation of asm-goto support in clang

Jennifer Yu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 4 14:09:54 PST 2019


jyu2 marked 2 inline comments as done.
jyu2 added inline comments.


================
Comment at: lib/Sema/JumpDiagnostics.cpp:347
+      LabelAndGotoScopes[S] = ParentScope;
+      Jumps.push_back(S);
+    }
----------------
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();
}



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56571/new/

https://reviews.llvm.org/D56571





More information about the cfe-commits mailing list