/* TAGS: min */ /* VERIFY_OPTS: -o nofail:malloc */ /* CC_OPTS: */ // V: safety // V: local V_OPT: --nontermination local // V: global V_OPT: --nontermination global #include #include std::atomic< int > x; int main() { pthread_t t1, t2; pthread_create( &t1, nullptr, []( void * ) -> void * { while ( true ) { ++x; --x; } return nullptr; }, nullptr ); pthread_detach( t1 ); pthread_create( &t2, nullptr, []( void * ) -> void * { while ( x == 0 ) { } return nullptr; }, nullptr ); pthread_join( t2, nullptr ); }