This is an archive of the discontinued LLVM Phabricator instance.

[WinEH] Allocate the registration node before the catch objects
ClosedPublic

Authored by majnemer on Feb 28 2016, 12:46 AM.

Details

Summary

The CatchObjOffset is relative to the end of the EH registration node
for 32-bit x86 WinEH targets. A special sentinel value, 0, is used to
indicate that no catch object should be initialized.

This means that a catch object allocated immediately before the
registration node would be assigned a CatchObjOffset of 0, leading the
runtime to believe that a catch object should not be initialized.

To handle this, allocate the registration node prior to any other frame
object. This will ensure that catch objects will not be allocated
before the registration node.

This fixes PR26757.

Diff Detail

Repository
rL LLVM

Event Timeline

majnemer updated this revision to Diff 49312.Feb 28 2016, 12:46 AM
majnemer retitled this revision from to [WinEH] Allocate the registration node before the catch objects.
majnemer updated this object.
majnemer added a subscriber: llvm-commits.
rnk accepted this revision.Feb 29 2016, 12:52 PM
rnk edited edge metadata.

lgtm

lib/CodeGen/PrologEpilogInserter.cpp
712 ↗(On Diff #49312)

Not really this CL's problem, but we really should make something like enum { FI_Invalid = INT_MAX }; and standardize on it.

This revision is now accepted and ready to land.Feb 29 2016, 12:52 PM
This revision was automatically updated to reflect the committed changes.