clangir icon indicating copy to clipboard operation
clangir copied to clipboard

Three or more calls with cleanups fail

Open smeenai opened this issue 1 year ago • 0 comments

As shown in https://godbolt.org/z/hG7ch1db3, the following code:

struct has_cleanup {
  ~has_cleanup();
};
void may_throw();
void func() {
  has_cleanup cleanup;
  may_throw();
  may_throw();
  may_throw();
}

Results in an error:

loc("<source>":5:6): error: empty block: expect at least a terminator

What's interesting is that it works fine with two calls to may_throw; it's the third call (and any subsequent ones) that cause the issue.

https://godbolt.org/z/T3veaWWfv shows the emitted CIR that fails verification, and it seems like the middle call is failing to get the proper cleanup and catch blocks.

smeenai avatar Nov 13 '24 01:11 smeenai