FS#50829 - [opencascade] 6.9.1-3 breaks FreeCAD

Attached to Project: Community Packages
Opened by Lukas K. (luk4s) - Monday, 19 September 2016, 09:21 GMT
Last edited by Florian Pritz (bluewind) - Saturday, 24 September 2016, 16:31 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Florian Pritz (bluewind)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Description:
With opencascade 6.9.1-3 opening documents containing STEP models in FreeCAD crashes it.
Freecad version 0.16-5

Steps to reproduce:
Open the attached document in FreeCAD with opencascade 6.9.1-3 installed. FreeCAD will crash in opencascade code.
   test.fcstd (158.6 KiB)
This task depends upon

Closed by  Florian Pritz (bluewind)
Saturday, 24 September 2016, 16:31 GMT
Reason for closing:  Fixed
Additional comments about closing:  opencascade 6.9.1-7
Comment by Ross Whitfield (rew) - Monday, 19 September 2016, 15:08 GMT
I'm also seeing some crashes with some software I'm developer on related to 6.9.1-3, it works fine with 6.9.1-2

I'm seeing this after the update:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff1626c10 in BSplCLib::FirstUKnotIndex(int, TColStd_Array1OfInteger const&) () from /opt/opencascade/lib/libTKMath.so.0

6.9.1-3 added a backport patch from 7.0.0 as requested in  FS#50684  But it seems strange to diverge from the official upstream version. If this patch is really required wouldn't it make sense to just move to 7.0.0?
Comment by Sjoerd Timmer (sjoerd) - Tuesday, 20 September 2016, 16:44 GMT
I can confirm that downgrading opencascade to 6.9.1-2 solved this for me.
Comment by Florian Pritz (bluewind) - Tuesday, 20 September 2016, 19:27 GMT
And there I was hoping that a patch from the devs would work fine... Well, it did work fine for some simple fcstd file I have lying around. I'll pull it back out. Sorry for the trouble guys and thanks for reminding me that patching is a really bad idea.
Comment by Florian Pritz (bluewind) - Wednesday, 21 September 2016, 12:26 GMT
Alright so I've recompiled opencascade without the patch, but I still get a crash in freecad. This could take some more time to debug. If anyone has ideas or wants to help out, feel free to contact me on IRC (Bluewind@irc.freenode.net) or post here. I get the feeling that the crash might not be related to the patch.
Comment by Florian Pritz (bluewind) - Wednesday, 21 September 2016, 18:09 GMT
Backtrace for freecad with the test.fcstd from this report and opencascade without the patch.
Comment by Lukas K. (luk4s) - Wednesday, 21 September 2016, 21:02 GMT
Looks like gcc got smarter in the meantime and has become more aggressive about 'optimizing' null reference checks.

The culprit in this case:
../../../../src/BSplCLib/BSplCLib.cxx:321:13: warning: the compiler can assume that the address of ‘Mults’ will always evaluate to ‘true’ [-Waddress]
if (&Mults) {

Instrumenting this function with printf revealed that gcc indeed does assume that &Mults == true.
The opencascade devs fixed this problem in 7.0.0. https://tracker.dev.opencascade.org/view.php?id=26042

Options we have right now:
- Compiling with -O0 might do
- Backport the patch mentioned in the opencascade tracker
Comment by Florian Pritz (bluewind) - Thursday, 22 September 2016, 09:38 GMT
Great call! I looks like -O0 fixes the issue. I'll look into backporting the patch.
Comment by Florian Pritz (bluewind) - Friday, 23 September 2016, 14:53 GMT
I've pushed opencascade 6.9.1-7 to [community-testing]. It still includes the patch, but I've fixed the compiler issue (disabled only a few optimization instead of going full -O0). The test file opens fine for me now.

Please test if it also works for you.
Comment by Lukas K. (luk4s) - Friday, 23 September 2016, 15:02 GMT
Works for me.
Comment by Ross Whitfield (rew) - Friday, 23 September 2016, 18:25 GMT
Works for me.

Loading...