[Bug libstdc++/58909] C++11's condition variables fail with static linking

joel at clambassador dot com gcc-bugzilla@gcc.gnu.org
Thu Feb 16 04:29:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58909

joel at clambassador dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |---

--- Comment #9 from joel at clambassador dot com ---
Wow, I had completely forgotten about the time I spent puzzled over this
behaviour in 2013.

I'm guessing that just the existence of this as a bug report for 'condition
variables static linking' is sufficient documentation for the rare time it
happens for people. As such I'll note that my unpleasant fix was to include
this in a header:

void pthread_cond_bug() {
        pthread_cond_signal((pthread_cond_t *) nullptr);
        pthread_cond_init((pthread_cond_t *) nullptr,
                          (const pthread_condattr_t *) nullptr);
        pthread_cond_destroy((pthread_cond_t *) nullptr);
        pthread_cond_timedwait((pthread_cond_t *) nullptr, (pthread_mutex_t *)
                               nullptr, (const struct timespec *) nullptr);
        pthread_cond_wait((pthread_cond_t *) nullptr, (pthread_mutex_t *)
(nullptr);
}

without actually ever calling it; iirc it links in the functions as a result.


More information about the Gcc-bugs mailing list