This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/66146] call_once not C++11-compliant on ppc64le


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_);
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]