namazso wrote:

> For an SEH exception that occurs within a function due to a CALL (such as a 
> bogus indirect call), the IP should point to the beginning of the CALL 
> instruction, so the IP2State tables should point to the correct region.

Yes, I was just pointing out that same-frame catch isn't supposed to be 
supported in LLVM per the docs. By that rule, this code:

```
void test1(void(*a)()) {
    __try {
        a();
    } __except(1) {
        printf("throw in call!\n");
    }
}

void test2(void(*a)()) {
    __try {
        test1(a);
    } __except (1) {
        printf("throw from call!\n");
    }
}

void int3() {
    __debugbreak();
}

int main() {
    test2(&int3);
    test2((void(*)())0x8FFFFFFFFFFFFFFF);
    return 0;
}
```

Should result in this:

```
throw in call!
throw from call!
```

Which indeed would probably work like that if the start labels were also offset 
by 1 all the time. Of course it's way different from MSVC, but it sounded at 
least *consistent* even if slightly insane. However when I tested it on the 
current LLVM release, it was not consistent at all already, so that's why I 
commented to just disregard this observation - it already didn't conform 
whatever the docs were saying, it's not going to be any more broken that it 
currently is.

>  I'd be happy to improve the state of things for SEH, as well as ensuring 
> that this PR doesn't regress support for GNU's EH support on Windows. If 
> GNU's C++ EH support is based on SEH, then I think I will need to change this 
> PR so that a CALL aligned to .seh_startepilogue always inserts a NOP call. 
> That's easy to do. Do you have pointers to any info on GNU C++ exception 
> dispatch?

Sorry, no clue on GNU EH, my observations were purely about the current state 
of SEH and the docs (incorrectly) describing the "rules" on how exactly it is 
partially supported.

https://github.com/llvm/llvm-project/pull/144745
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to