https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65712
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- I think this is invalid as pthread_self is marked as const or pure which means it does not change with respect of function calls. If anything is a deficiency in POSIX.