[all-commits] [llvm/llvm-project] 66f1dc: [Windows SEH] Fix the frame-ptr of a nested-filter...

tentzen via All-commits all-commits at lists.llvm.org
Sun Jul 12 01:40:01 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 66f1dcd872dba189ee054fb016f4bff535fb5afc
      https://github.com/llvm/llvm-project/commit/66f1dcd872dba189ee054fb016f4bff535fb5afc
  Author: Ten Tzen <tentzen at microsoft.com>
  Date:   2020-07-12 (Sun, 12 Jul 2020)

  Changed paths:
    M clang/lib/CodeGen/CGException.cpp
    M clang/lib/CodeGen/CodeGenFunction.h
    A clang/test/CodeGen/windows-seh-filter-inFinally.c

  Log Message:
  -----------
  [Windows SEH] Fix the frame-ptr of a nested-filter within a _finally

This change fixed a SEH bug (exposed by test58 & test61 in MSVC test xcpt4u.c);
when an Except-filter is located inside a finally, the frame-pointer generated today
via intrinsic @llvm.eh.recoverfp is the frame-pointer of the immediate
parent _finally, not the frame-ptr of outermost host function.

The fix is to retrieve the Establisher's frame-pointer that was previously saved in
parent's frame.
The prolog of a filter inside a _finally should be like code below:

%0 = call i8* @llvm.eh.recoverfp(i8* bitcast (@"?fin$0 at 0@main@@"), i8*%frame_pointer)
%1 = call i8* @llvm.localrecover(i8* bitcast (@"?fin$0 at 0@main@@"), i8*%0, i32 0)
%2 = bitcast i8* %1 to i8**
%3 = load i8*, i8** %2, align 8

Differential Revision: https://reviews.llvm.org/D77982




More information about the All-commits mailing list