This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/66146] call_once not C++11-compliant on ppc64le
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 15 May 2015 08:55:28 +0000
- Subject: [Bug libstdc++/66146] call_once not C++11-compliant on ppc64le
- Auto-submitted: auto-generated
- References: <bug-66146-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66146
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |msebor at gcc dot gnu.org
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This has nothing to do with libstdc++, the std::call_once code is identical on
x86 and ppc, and you get the same behaviour with pthreads, so it should be
reported to glibc instead.
#include <stdio.h>
#include <pthread.h>
pthread_once_t flag_ = PTHREAD_ONCE_INIT;
int call_count = 0;
extern "C" void func_() {
printf("Inside func_ call_count %d\n", call_count);
if (++call_count < 2)
throw 0;
}
int main() {
printf("Before calling call_once flag_: %d\n", *(int*)&flag_);
try {
pthread_once(&flag_, func_);
} catch(...) {
printf("Inside catch all excepton flag_: %d\n", *(int*)&flag_);
}
printf("before the 2nd call to call_once flag_: %d\n", *(int*)&flag_);
pthread_once(&flag_, func_);
}