Issue 127252 - All of AOO doesn't handle C++ exceptions properly, making Clang unusable
Summary: All of AOO doesn't handle C++ exceptions properly, making Clang unusable
Status: CONFIRMED
Alias: None
Product: Build Tools
Classification: Code
Component: code (show other issues)
Version: 4.2.0-dev
Hardware: All Other OS
: P5 (lowest) Major (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-17 14:29 UTC by damjan
Modified: 2020-03-29 10:09 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description damjan 2016-12-17 14:29:14 UTC
A lot of C++ code in AOO doesn't follow the C++ specifications when handling exceptions, for example exceptions are thrown without being declared in the function's prototype, which SHOULD result in a call to unexpected() and termination of the application.

AOO however hides this fact using the -fno-enforce-eh-specs flag to GCC on Linux (see main/solenv/gbuild/platform/linux.mk), and something similar on Windows, so those platforms and compilers don't end up in unexpected() and there is no crash. Clang, used on at least MacOS and FreeBSD, doesn't support that flag, so they will crash in cases where Windows and Linux don't, making those platforms DANGEROUSLY UNSTABLE!!!

See bug 125868 and its fix in commit 1765488 for a real world example. *Many* more cases could exist!

Unless support can be added to Clang, a thorough audit of all code in AOO will be needed to find and fix all the exception handling. Hopefully there's a way to automate it somehow.
Comment 1 Pedro Giffuni 2016-12-17 15:20:19 UTC
(In reply to damjan from comment #0)
> A lot of C++ code in AOO doesn't follow the C++ specifications when handling
> exceptions, for example exceptions are thrown without being declared in the
> function's prototype, which SHOULD result in a call to unexpected() and
> termination of the application.
> 

Interesting, thanks!

> AOO however hides this fact using the -fno-enforce-eh-specs flag to GCC on
> Linux (see main/solenv/gbuild/platform/linux.mk), and something similar on
> Windows, so those platforms and compilers don't end up in unexpected() and
> there is no crash. Clang, used on at least MacOS and FreeBSD, doesn't
> support that flag, so they will crash in cases where Windows and Linux
> don't, making those platforms DANGEROUSLY UNSTABLE!!!
> 
> See bug 125868 and its fix in commit 1765488 for a real world example.
> *Many* more cases could exist!
> 

Perhaps opengrok'ing throw(), but I see almost 7000 occurrences ?

> Unless support can be added to Clang, a thorough audit of all code in AOO
> will be needed to find and fix all the exception handling. Hopefully there's
> a way to automate it somehow.

There was a small discussion in Nov 2012 in the clang lists:

http://clang-developers.42468.n3.nabble.com/Does-clang-support-fno-enforce-eh-specs-option-of-gcc-td4028196.html

I don't think clang will be adding support for it. A clang plugin would be extremely interesting for other projects as well (but I don't know how to use them).
Comment 2 Pedro Giffuni 2016-12-17 15:46:01 UTC
For the record, according a to a discussion in the LO lists (no code included):

http://libreoffice.freedesktop.narkive.com/fN3eXlzR/exception-specifications-on-functions-useless

The following file needs to be checked:

main/vbahelper/inc/vbahelper/vbaaccesshelper.hxx
Comment 3 M Travis 2017-04-16 00:33:57 UTC
For reference, here is the encyclopedia entry for Clang
https://www.everipedia.com/Clang/
Comment 4 Interior designing software 2019-07-22 10:00:50 UTC
Find and compare interior design software. Draw the plan of your home or office, test furniture layouts and visit the results in 3D.
https://www.techjockey.com/category/interior-designing-software
Comment 5 Matthias Seidel 2019-07-22 10:07:35 UTC
(In reply to Interior designing software from comment #4)
> Find and compare interior design software. Draw the plan of your home or
> office, test furniture layouts and visit the results in 3D.
> https://www.techjockey.com/category/interior-designing-software

SPAM!
Comment 6 Lucky patcher 2019-09-25 13:58:16 UTC
Nobody like to pay for advance features of any games don't like to spend money on uc, gems and all. We so irritate if we see any ads while playing game and watching videos. So here i am with a solution of all the problem name as Lucky patcher. Lucky patcher is famous mods app till now which give you advantage to crack any game license, block ads and allow you to remove unwanted apps from your phone. Click now on <a href="https://www.fabtechie.com/change-your-gaming-experience-with-lucky-patcher/">lucky patcher</a> to download apk and tutorial how to use it.
Comment 7 Marcus 2019-09-25 18:46:48 UTC
The last comment is spam - please ignore.
Comment 8 ReviewsonTop 2020-01-24 10:50:34 UTC
Reviews on Top is the Tech Circuit for all Gadget News and Reviews. We tell you about the Latest Tech News and Reviews, Gadget News and Launches, Latest Mobile Phones, Best Selling Cars, Phone Leaks, Top 10 Selling Laptops & More. Our team brings your daily dose of all leaks and talks of Tech News.https://www.reviewsontop.com/ , Tech Circuit for Tech Leaks and News.
Comment 9 Matthias Seidel 2020-01-24 17:38:18 UTC
Spam again!
Comment 10 positivequotes45 2020-03-29 10:03:17 UTC
we must seek in life. We are the people with different Conscience but the same Consciousness and when we become identified with it, we find the connecting chords of the cosmos and get to know that we are not separate from anything in existence. Wisdom is power (subjectively), and power is best shared among us.
https://www.wordsaregod.com/
Comment 11 Matthias Seidel 2020-03-29 10:09:43 UTC
Another Spam comment!