FS#49898 - [intel-tbb] Crashes introduced by GCC 6, workaround via flags

Attached to Project: Arch Linux
Opened by Johannes Jordan (FoPref) - Thursday, 30 June 2016, 22:36 GMT
Last edited by Antonio Rojas (arojas) - Friday, 01 July 2016, 19:39 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Antonio Rojas (arojas)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
TBB has some erroneous code where memory is first initialized with memset, then an object is constructed within that memory. GCC 6 will optimize away the memset.
This leads to segmentation faults for example in this application: https://aur.archlinux.org/packages/gerbil-git

Here are the relevant sources from the Intel forums:
https://software.intel.com/en-us/forums/intel-threading-building-blocks/topic/641654
https://software.intel.com/en-us/forums/intel-threading-building-blocks/topic/636519


Solution:
As suggested by the upstream developers, I added the "-flifetime-dse=1" flag. This will only slightly affect GCC's optimization as explained here (https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html):
-fno-lifetime-dse
In C++ the value of an object is only affected by changes within its lifetime: when the constructor begins, the object has an indeterminate value, and any changes during the lifetime of the object are dead when the object is destroyed. Normally dead store elimination will take advantage of this; if your code relies on the value of the object storage persisting beyond the lifetime of the object, you can use this flag to disable this optimization. To preserve stores before the constructor starts (e.g. because your operator new clears the object storage) but still treat the object as dead after the destructor you, can use -flifetime-dse=1. The default behavior can be explicitly selected with -flifetime-dse=2. -flifetime-dse=0 is equivalent to -fno-lifetime-dse.

Here is the change I made to the PKGBUILD:

build() {
cd $_tag
CXXFLAGS="$CXXFLAGS -flifetime-dse=1" make
}

I suggest to implement this change until TBB fix their problem.
This task depends upon

Closed by  Antonio Rojas (arojas)
Friday, 01 July 2016, 19:39 GMT
Reason for closing:  Fixed
Additional comments about closing:  intel-tbb-4.4_20160526-2
Comment by Allan McRae (Allan) - Friday, 01 July 2016, 03:50 GMT
Unassigning myself - this is not a gcc bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71388

Loading...