[PATCH] D38223: Make sure the basic block has an insertion point before dereferencing it

Marco Castelluccio via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 4 06:36:21 PDT 2017


marco-c added a comment.

> I think any invoke or cleanupret that unwinds to a catchswitch needs to look through the successors of the catchswitch. The unwind edge may be another catchswitch, which we must also look through. We should add all the non-catchswitch successors to ComplexEdgeSuccs.

The current patch is achieving this, no? All successors from all basic blocks are stored in ComplexEdgeSuccs, but then catchswitchs are skipped.

BTW, the following test case crashes at runtime (after applying this patch, otherwise it doesn't compile at all):

  #include <windows.h>
  #include <stdio.h>
  
  DWORD FilterFunction() {
    printf("1 ");
    return EXCEPTION_EXECUTE_HANDLER;
  }
  
  int main(void) {
    __try {
      __try {
        RaiseException(1, 0, 0, NULL);
      }
      __finally {
        printf("2 ");
      }
    }
    __except(FilterFunction()) {
      printf("3\n");
    }
  
    return 0;
  }


Repository:
  rL LLVM

https://reviews.llvm.org/D38223





More information about the llvm-commits mailing list