diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -528,7 +528,6 @@ this->NumInputs = NumInputs; this->NumClobbers = NumClobbers; this->NumLabels = NumLabels; - assert(!(NumOutputs && NumLabels) && "asm goto cannot have outputs"); unsigned NumExprs = NumOutputs + NumInputs + NumLabels; diff --git a/clang/test/Modules/Inputs/asm-goto/a.h b/clang/test/Modules/Inputs/asm-goto/a.h new file mode 100644 --- /dev/null +++ b/clang/test/Modules/Inputs/asm-goto/a.h @@ -0,0 +1,13 @@ +int foo(void) { + int x; + + asm goto("" + : "=r"(x) + : + : + : indirect); + x = 42; + +indirect: + return x; +} diff --git a/clang/test/Modules/Inputs/asm-goto/module.modulemap b/clang/test/Modules/Inputs/asm-goto/module.modulemap new file mode 100644 --- /dev/null +++ b/clang/test/Modules/Inputs/asm-goto/module.modulemap @@ -0,0 +1 @@ +module a { header "a.h" export * } diff --git a/clang/test/Modules/asm-goto.c b/clang/test/Modules/asm-goto.c new file mode 100644 --- /dev/null +++ b/clang/test/Modules/asm-goto.c @@ -0,0 +1,12 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fno-implicit-modules -x c -I%S/Inputs/asm-goto -emit-module %S/Inputs/asm-goto/module.modulemap -fmodule-name=a -o %t/a.pcm +// RUN: %clang_cc1 -fmodules -fno-implicit-modules -x c -I%S/Inputs/asm-goto -emit-llvm -o - %s -fmodule-file=%t/a.pcm | FileCheck %s +#include "a.h" + +// CHECK-LABEL: define i32 @foo( +// CHECK: callbr {{.*}} "=r,X,{{.*}}"(i8* blockaddress(@foo, %indirect)) +// CHECK-NEXT: to label %asm.fallthrough [label %indirect] + +int bar(void) { + return foo(); +}