Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

std::future regression #23098

Open Quuxplusone opened 9 years ago

Quuxplusone commented 9 years ago
Bugzilla Link PR23099
Status NEW
Importance P normal
Reported by dirk.ribbrock@mathematik.tu-dortmund.de
Reported on 2015-04-01 14:28:18 -0700
Last modified on 2015-04-06 15:22:43 -0700
Version 3.6
Hardware PC Linux
CC dgregor@apple.com, dimitry@andric.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
Since using clang 3.6.0, the following code crashes with
"Illegal instruction (core dumped)"
Whereas clang 3.5.0  returns the correct output value "1"

//file future.cpp
#include <thread>
#include <future>
#include <iostream>

int bla()
{
  return 1;
}

int main()
{
  std::future<int> f = std::async(std::launch::async, bla);
  f.wait();
  std::cout<<f.get()<<std::endl;
  return 0;
}
//end file

Build it with
clang++ --std=c++11 -lpthread future.cpp
Quuxplusone commented 9 years ago

This works fine on FreeBSD 11 (with clang 3.6.0), but we're using a relatively recent libc++ there.

Which C++ library are you using in case of the crash? Is that libstdc++ on your particular Linux instance? And which version?

Also, it would be interesting to see a debug backtrace. Is it crashing on a 'ud2' instruction, by any chance?

Quuxplusone commented 9 years ago
Hi

I'am using Ubuntu 12.04 with my own gcc 4.8.3 compiler.
The libstdc++.so.6 used by clang and the repro code is build with this gcc
compiler.
The greatest version symbol i can find in there is
GLIBCXX_3.4.19.

gdb backtraces reads as follows:

Program received signal SIGILL, Illegal instruction.
bool
std::__future_base::_State_base::_S_check<std::__future_base::_State_base>(std::shared_ptr<std::__future_base::_State_base>
const&) ()
    at /sfw/gcc/4.7.3-static-gmp-mpfr-mpc-cloog/lib64/gcc/x86_64-unknown-linux-gnu/4.7.3/../../../../include/c++/4.7.3/future:462
462           if (!static_cast<bool>(__p))
(gdb) bt
#0  bool
std::__future_base::_State_base::_S_check<std::__future_base::_State_base>(std::shared_ptr<std::__future_base::_State_base>
const&) ()
    at /sfw/gcc/4.7.3-static-gmp-mpfr-mpc-cloog/lib64/gcc/x86_64-unknown-linux-gnu/4.7.3/../../../../include/c++/4.7.3/future:462
#1  0x0000000000402b1d in
std::__basic_future<int>::__basic_future(std::shared_ptr<std::__future_base::_State_base>
const&) ()
    at /sfw/gcc/4.7.3-static-gmp-mpfr-mpc-cloog/lib64/gcc/x86_64-unknown-linux-gnu/4.7.3/../../../../include/c++/4.7.3/future:613
#2  0x0000000000402ae8 in
std::future<int>::future(std::shared_ptr<std::__future_base::_State_base>
const&) ()
    at /sfw/gcc/4.7.3-static-gmp-mpfr-mpc-cloog/lib64/gcc/x86_64-unknown-linux-gnu/4.7.3/../../../../include/c++/4.7.3/future:654
#3  0x0000000000401f48 in
_ZSt5asyncIRFivEJEESt6futureINSt9result_ofIFT_DpT0_EE4typeEESt6launchOS4_DpOS5_
()
    at /sfw/gcc/4.7.3-static-gmp-mpfr-mpc-cloog/lib64/gcc/x86_64-unknown-linux-gnu/4.7.3/../../../../include/c++/4.7.3/future:1499
#4  0x0000000000401b1b in main () at future.cpp:12

line 12 is the line with std::async.

If i can give you any further information, i'm pleased to do so.

Thanks in advance
Dirk
Quuxplusone commented 9 years ago

My fault, its gcc 4.7.3.

Quuxplusone commented 9 years ago
Consequently, the greatest glibc version symbol is
GLIBCXX_3.4.17
Quuxplusone commented 9 years ago

I will try to rebuild clang with a newer libstdc++ to get rid of the problem :)

Quuxplusone commented 9 years ago
Works fine for me with newer version of libstdc++ :)

Thanks for your help!
Dirk