Bug 1177066 - clang++ 3.5.0 miscompile with boost/thread.hpp and -march option
Summary: clang++ 3.5.0 miscompile with boost/thread.hpp and -march option
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: boost
Version: 21
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Petr Machata
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-24 02:59 UTC by EyalBD
Modified: 2015-05-05 01:38 UTC (History)
5 users (show)

Fixed In Version: boost-1.55.0-6.fc21
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-01-13 00:01:39 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description EyalBD 2014-12-24 02:59:53 UTC
Description of problem:
boost headers (and web page) support up to 3.4. 

When compiling a simple C++ file with clang++-3.5 that includes boost/thread.hpp and uses the -march compilation options the compilation fails


Version-Release number of selected component (if applicable):
boost-1.55 from frdora 21
clang 3.5.0 from fedora 21

How reproducible:
Always (see simple source code below)

== source ==

#include <iostream>  
#include <boost/thread.hpp>   
#include <boost/date_time.hpp>       

using namespace std;

void workerFunc()                                
{                                                                                   boost::posix_time::seconds workTime(3);
    cout << "Worker: running" << endl;
    boost::this_thread::sleep(workTime);
    cout << "Worker: finished" << endl;
}    
      
int main(int argc, char* argv[])
{
   cout << "main: startup" << endl;
   boost::thread workerThread(workerFunc);

   cout << "main: waiting for thread" << endl;
   workerThread.join();

   cout << "main: done" << endl;
   return 0;
}

=== compilation ===

clang++ thr1.cpp -o thr -lboost_thread  ==> OK
clang++ -march=core2 thr1.cpp -o thr -lboost_thread  ==> FAIL
clang++ -march=native thr1.cpp -o thr -lboost_thread  ==> FAIL

== workaround == 

Add -DBOOST_HAS_INT128 since clang 3.5.0 actually has it

clang++ -march=native -DBOOST_HAS_INT128 thr1.cpp -o thr1 -lboost_thread ==> OK

== Note == 

compilation with clang 3.4 (before upgrade) was OK
compilation with gcc is of course OK

Comment 1 EyalBD 2014-12-24 12:28:47 UTC
See more here (+ patch)

https://trac.macports.org/ticket/42282

Comment 2 Petr Machata 2015-01-02 11:58:30 UTC
Arguably this is a clang problem (lack of full support for 128-bit integers), but since there are patches, we might as well backport them.  Per the macports ticket, 6bb71fdd8f7cc and e4bde20f2eec0 contain the fixes.  I don't see more commits upstream for the same issue.

Comment 3 Petr Machata 2015-01-02 12:02:36 UTC
Ah, now I see.  The problem is that Boost does not realize that 128-bit integers are actually supported.

Comment 4 Fedora Update System 2015-01-02 15:55:49 UTC
boost-1.55.0-6.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/boost-1.55.0-6.fc21

Comment 5 Fedora Update System 2015-01-03 19:03:15 UTC
Package boost-1.55.0-6.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing boost-1.55.0-6.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-0063/boost-1.55.0-6.fc21
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2015-01-13 00:01:39 UTC
boost-1.55.0-6.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.