================
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir 
-verify %s
+
+// A `goto *p` that leaves a scope needing cleanup (here a VLA stack restore)
+// must run that cleanup on the branch.  That is not implemented yet, so it is
+// reported rather than lowered to a branch that skips the cleanup.
+int vla(int n) {
+  int a[n];
+  void *p = &&done;
+  // expected-error@+1 {{indirect goto across a cleanup scope}}
----------------
andykaylor wrote:

This message isn't quite right. This doesn't actually exit the cleanup scope in 
this case. I see that it could, for example if the VLA were inside an 'if' 
statement. Curiously, class codegen doesn't restore the stack in this case: 
https://godbolt.org/z/r4eT6Ezo1

https://github.com/llvm/llvm-project/pull/206176
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to