Here is a wiki page and git repo with an implementation of SEH that passes all the tests for x86. We're looking for feedback before putting a patch on Phabricator. https://github.com/tentzen/llvm-project https://github.com/tentzen/llvm-project/wiki On Mon, Nov 18, 2019 at 10:59 PM Gaier, Bjoern <Bjoern.Gaier at horiba.com> wrote:> Thank you for this Aaron! > > > > In our company we rely heavily on the compatibility between Clang-Cl and > the Visual Studio compiler, lately we encountered big problems with the > handling of SEH exceptions in our code, so running those tests helped us. > (Sadly we can’t move to the Visual Studio compiler) > > > > However, maybe it helps someone if I share the results from running those > tests… I imported all of the tests into separated projects, compiling them > with the same settings, with MSVC (v141) and Clang (9), then I compared the > output. The compiler settings for all those projects were: > > /permissive- /GS /GL /W3 /Gy /Zc:wchar_t /Gm- /Ox /Ob2 /sdl /Zc:inline > /fp:precise /D "_MBCS" /errorReport:prompt /GF- /WX- /Zc:forScope /Gd /Oy > /Oi /MD /FC /EHsc /nologo /Ot /diagnostics:classic > > > > The MSVC compiler only failed the following test: > > EH: > ihateeh.cxx > > > > Clang however failed multiple tests: > EH: > > ihateeh.cxx > > > > SEH: > > seh0007.c (-> Test failed; The access violation was optimized away, > leading to a random result; – forcing the access violation caused no > catching of the exception) > seh0019.c (-> No exception caught; Which makes sense because there are no > catch handler, but MSVC does catch them) > seh0055.c (-> Test failed; The result is not correct) > > sehframes.cpp (-> A certain exception was not caught) > > > > The following tests didn’t even compiled, instead they crashed the > compiler: > > seh0034.c > > seh0035.c > > seh0036.c > > seh0041.c > > seh0042.c > > seh0043.c > > seh0048.c > > seh0049.c > > seh0050.c > xcpt4u.c > > > > I hope that helped in some way – any comments or suggestions? I’m up for > it! > > > > *From:* llvm-dev <llvm-dev-bounces at lists.llvm.org> *On Behalf Of *Aaron > Smith via llvm-dev > *Sent:* 11 November 2019 23:03 > *To:* llvm-dev at lists.llvm.org > *Subject:* [llvm-dev] Exceptions on Windows & MSVC > > > > At Microsoft we open sourced some of our compiler tests for exception > handling on github. > > https://github.com/microsoft/compiler-tests > > > > We are looking into what it would take to get these to work with clang-cl. > I’m planning to share a design document on the mailing list soon. > > > > Aaron > > > > > Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, > USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert > Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Takeshi Fukushima. > Junichi Tajika >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200327/f6e4402a/attachment.html>
Oh woah! That is really really cool! I hope I can try this out soon >o< What is the Phabricator? From: Aaron Smith <aaron.lee.smith at gmail.com> Sent: 27 March 2020 21:31 To: Gaier, Bjoern <Bjoern.Gaier at horiba.com> Cc: llvm-dev at lists.llvm.org Subject: Re: [llvm-dev] Exceptions on Windows & MSVC Here is a wiki page and git repo with an implementation of SEH that passes all the tests for x86. We're looking for feedback before putting a patch on Phabricator. https://github.com/tentzen/llvm-project https://github.com/tentzen/llvm-project/wiki On Mon, Nov 18, 2019 at 10:59 PM Gaier, Bjoern <Bjoern.Gaier at horiba.com<mailto:Bjoern.Gaier at horiba.com>> wrote: Thank you for this Aaron! In our company we rely heavily on the compatibility between Clang-Cl and the Visual Studio compiler, lately we encountered big problems with the handling of SEH exceptions in our code, so running those tests helped us. (Sadly we can’t move to the Visual Studio compiler) However, maybe it helps someone if I share the results from running those tests… I imported all of the tests into separated projects, compiling them with the same settings, with MSVC (v141) and Clang (9), then I compared the output. The compiler settings for all those projects were: /permissive- /GS /GL /W3 /Gy /Zc:wchar_t /Gm- /Ox /Ob2 /sdl /Zc:inline /fp:precise /D "_MBCS" /errorReport:prompt /GF- /WX- /Zc:forScope /Gd /Oy /Oi /MD /FC /EHsc /nologo /Ot /diagnostics:classic The MSVC compiler only failed the following test: EH: ihateeh.cxx Clang however failed multiple tests: EH: ihateeh.cxx SEH: seh0007.c (-> Test failed; The access violation was optimized away, leading to a random result; – forcing the access violation caused no catching of the exception) seh0019.c (-> No exception caught; Which makes sense because there are no catch handler, but MSVC does catch them) seh0055.c (-> Test failed; The result is not correct) sehframes.cpp (-> A certain exception was not caught) The following tests didn’t even compiled, instead they crashed the compiler: seh0034.c seh0035.c seh0036.c seh0041.c seh0042.c seh0043.c seh0048.c seh0049.c seh0050.c xcpt4u.c I hope that helped in some way – any comments or suggestions? I’m up for it! From: llvm-dev <llvm-dev-bounces at lists.llvm.org<mailto:llvm-dev-bounces at lists.llvm.org>> On Behalf Of Aaron Smith via llvm-dev Sent: 11 November 2019 23:03 To: llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org> Subject: [llvm-dev] Exceptions on Windows & MSVC At Microsoft we open sourced some of our compiler tests for exception handling on github. https://github.com/microsoft/compiler-tests We are looking into what it would take to get these to work with clang-cl. I’m planning to share a design document on the mailing list soon. Aaron Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Takeshi Fukushima. Junichi Tajika Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Takeshi Fukushima. Junichi Tajika -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200401/e6b9618d/attachment.html>
Hey Aaron, I downloaded the source files from the git repo and build the LLVM and Clang with it. It is awesome to see that the SEH tests from Microsoft are working now. However Clang still crashes when trying to compile the “xcpt4u.c” source file from the SEH tests. I did a small source code modification by changing the return statement of the main to “return 0;” Is this test supposed to work? Have I misconfigured something? Kind greetings Björn From: Aaron Smith <aaron.lee.smith at gmail.com> Sent: 27 March 2020 21:31 To: Gaier, Bjoern <Bjoern.Gaier at horiba.com> Cc: llvm-dev at lists.llvm.org Subject: Re: [llvm-dev] Exceptions on Windows & MSVC Here is a wiki page and git repo with an implementation of SEH that passes all the tests for x86. We're looking for feedback before putting a patch on Phabricator. https://github.com/tentzen/llvm-project https://github.com/tentzen/llvm-project/wiki On Mon, Nov 18, 2019 at 10:59 PM Gaier, Bjoern <Bjoern.Gaier at horiba.com<mailto:Bjoern.Gaier at horiba.com>> wrote: Thank you for this Aaron! In our company we rely heavily on the compatibility between Clang-Cl and the Visual Studio compiler, lately we encountered big problems with the handling of SEH exceptions in our code, so running those tests helped us. (Sadly we can’t move to the Visual Studio compiler) However, maybe it helps someone if I share the results from running those tests… I imported all of the tests into separated projects, compiling them with the same settings, with MSVC (v141) and Clang (9), then I compared the output. The compiler settings for all those projects were: /permissive- /GS /GL /W3 /Gy /Zc:wchar_t /Gm- /Ox /Ob2 /sdl /Zc:inline /fp:precise /D "_MBCS" /errorReport:prompt /GF- /WX- /Zc:forScope /Gd /Oy /Oi /MD /FC /EHsc /nologo /Ot /diagnostics:classic The MSVC compiler only failed the following test: EH: ihateeh.cxx Clang however failed multiple tests: EH: ihateeh.cxx SEH: seh0007.c (-> Test failed; The access violation was optimized away, leading to a random result; – forcing the access violation caused no catching of the exception) seh0019.c (-> No exception caught; Which makes sense because there are no catch handler, but MSVC does catch them) seh0055.c (-> Test failed; The result is not correct) sehframes.cpp (-> A certain exception was not caught) The following tests didn’t even compiled, instead they crashed the compiler: seh0034.c seh0035.c seh0036.c seh0041.c seh0042.c seh0043.c seh0048.c seh0049.c seh0050.c xcpt4u.c I hope that helped in some way – any comments or suggestions? I’m up for it! From: llvm-dev <llvm-dev-bounces at lists.llvm.org<mailto:llvm-dev-bounces at lists.llvm.org>> On Behalf Of Aaron Smith via llvm-dev Sent: 11 November 2019 23:03 To: llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org> Subject: [llvm-dev] Exceptions on Windows & MSVC At Microsoft we open sourced some of our compiler tests for exception handling on github. https://github.com/microsoft/compiler-tests We are looking into what it would take to get these to work with clang-cl. I’m planning to share a design document on the mailing list soon. Aaron Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Takeshi Fukushima. Junichi Tajika Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Takeshi Fukushima. Junichi Tajika -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200403/bb743ab5/attachment.html>
There are five bugs (three left) that are being fixed. Test58 & Test61 were fixed in Ten's last commit. Both pass the entire SEH test suite except the following failures: -- Xcpt4u: test58 & test61: due to Nested_Finally, a missing feature of present compiler. On MSVC this feature is only valid on X64 target. -- Xcpt4u: test84 & test87: leaving an except handler must invoke _local_unwind(). -- Seh0020 (-O2 only): a present setjmp/longjmp bug. On Fri, Apr 3, 2020 at 2:26 AM Gaier, Bjoern <Bjoern.Gaier at horiba.com> wrote:> Hey Aaron, > > > > I downloaded the source files from the git repo and build the LLVM and > Clang with it. It is awesome to see that the SEH tests from Microsoft are > working now. However Clang still crashes when trying to compile the > “xcpt4u.c” source file from the SEH tests. I did a small source code > modification by changing the return statement of the main to “return 0;” > > > > Is this test supposed to work? Have I misconfigured something? > > > > Kind greetings > > Björn > > > > *From:* Aaron Smith <aaron.lee.smith at gmail.com> > *Sent:* 27 March 2020 21:31 > *To:* Gaier, Bjoern <Bjoern.Gaier at horiba.com> > *Cc:* llvm-dev at lists.llvm.org > *Subject:* Re: [llvm-dev] Exceptions on Windows & MSVC > > > > Here is a wiki page and git repo with an implementation of SEH that passes > all the tests for x86. > > We're looking for feedback before putting a patch on Phabricator. > > > https://github.com/tentzen/llvm-project > https://github.com/tentzen/llvm-project/wiki > > > > On Mon, Nov 18, 2019 at 10:59 PM Gaier, Bjoern <Bjoern.Gaier at horiba.com> > wrote: > > Thank you for this Aaron! > > > > In our company we rely heavily on the compatibility between Clang-Cl and > the Visual Studio compiler, lately we encountered big problems with the > handling of SEH exceptions in our code, so running those tests helped us. > (Sadly we can’t move to the Visual Studio compiler) > > > > However, maybe it helps someone if I share the results from running those > tests… I imported all of the tests into separated projects, compiling them > with the same settings, with MSVC (v141) and Clang (9), then I compared the > output. The compiler settings for all those projects were: > > /permissive- /GS /GL /W3 /Gy /Zc:wchar_t /Gm- /Ox /Ob2 /sdl /Zc:inline > /fp:precise /D "_MBCS" /errorReport:prompt /GF- /WX- /Zc:forScope /Gd /Oy > /Oi /MD /FC /EHsc /nologo /Ot /diagnostics:classic > > > > The MSVC compiler only failed the following test: > > EH: > ihateeh.cxx > > > > Clang however failed multiple tests: > EH: > > ihateeh.cxx > > > > SEH: > > seh0007.c (-> Test failed; The access violation was optimized away, > leading to a random result; – forcing the access violation caused no > catching of the exception) > seh0019.c (-> No exception caught; Which makes sense because there are no > catch handler, but MSVC does catch them) > seh0055.c (-> Test failed; The result is not correct) > > sehframes.cpp (-> A certain exception was not caught) > > > > The following tests didn’t even compiled, instead they crashed the > compiler: > > seh0034.c > > seh0035.c > > seh0036.c > > seh0041.c > > seh0042.c > > seh0043.c > > seh0048.c > > seh0049.c > > seh0050.c > xcpt4u.c > > > > I hope that helped in some way – any comments or suggestions? I’m up for > it! > > > > *From:* llvm-dev <llvm-dev-bounces at lists.llvm.org> *On Behalf Of *Aaron > Smith via llvm-dev > *Sent:* 11 November 2019 23:03 > *To:* llvm-dev at lists.llvm.org > *Subject:* [llvm-dev] Exceptions on Windows & MSVC > > > > At Microsoft we open sourced some of our compiler tests for exception > handling on github. > > https://github.com/microsoft/compiler-tests > > > > We are looking into what it would take to get these to work with clang-cl. > I’m planning to share a design document on the mailing list soon. > > > > Aaron > > > > > > Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, > USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert > Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Takeshi Fukushima. > Junichi Tajika > > Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, > USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert > Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Takeshi Fukushima. > Junichi Tajika >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200403/008a3ab8/attachment.html>