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

--- Comment #8 from Jörn Heusipp <manx-bugzilla at problemloesungsmaschine dot 
de> ---

> Note in newer versions of glibc, libpthread is all intergrated into libc and
> there is no issues again.
> 
> For Mac OS X/darwin you don't need -lm -pthread because libc has it.

Two examples where it works by chance is not sufficient to invalidate my point
about the general case.

> >gcc libstdc++ implements std::thread. So what's your point again?
> 
> Because it implements it on top of pthreads.

Yeah, so that is an implementation detail because of which I am required to
pass -pthread. Why should the user of gcc even care how std::thread is
implemented? It literally makes no sense. You are supporting my point.

> While C threads is implemented
> inside the libc.

If it was implemented in libc, I would not be seeing "c11.c:(.text+0x53):
undefined reference to `thrd_create'". Something is wrong with your argument. I
actually do not know where it is implemented. And I should not be needing to
know. Again, you are supporting my point.

> If you want __STDC_NO_THREADS defined file a bug about that but gcc will need 
> to record which versions of glibc has C11 thread defined or not.

The compiler is required to know that by the C standard.

> You could use __has_include extension which will handle that mostly for you 
> really.

That's not how the C standard specifies to do to check for thread support.

> I still think this should not be done on the GCC side as it is
> changing/fixing on the glibc side of things already.

There are more platforms that GCC targets than just glibc. glibc alone cannot
fix the general case.

> In the case of mingw, the problem is how GCC was configured:

Debian MinGW-w64 gcc is built in 2 flavours. One with Win32 and one with posix
threading model support. The version with posix threading model support uses
pthreads, and knows how to implement std::thread. Why is GCC assuming
single-threaded in that context? That seems like a broken configuration to me
that gcc should not allow to be buildable, which looks like a bug to me. (or I
am misunderstanding what you are saying)
  • [Bug driver/1... manx-bugzilla at problemloesungsmaschine dot de via Gcc-bugs
    • [Bug dri... pinskia at gcc dot gnu.org via Gcc-bugs
    • [Bug dri... pinskia at gcc dot gnu.org via Gcc-bugs
    • [Bug dri... manx-bugzilla at problemloesungsmaschine dot de via Gcc-bugs
    • [Bug dri... pinskia at gcc dot gnu.org via Gcc-bugs
    • [Bug dri... pinskia at gcc dot gnu.org via Gcc-bugs
    • [Bug dri... pinskia at gcc dot gnu.org via Gcc-bugs
    • [Bug dri... pinskia at gcc dot gnu.org via Gcc-bugs
    • [Bug dri... schwab--- via Gcc-bugs
    • [Bug dri... manx-bugzilla at problemloesungsmaschine dot de via Gcc-bugs
    • [Bug dri... redi at gcc dot gnu.org via Gcc-bugs
    • [Bug dri... redi at gcc dot gnu.org via Gcc-bugs
    • [Bug dri... pinskia at gcc dot gnu.org via Gcc-bugs
    • [Bug dri... pinskia at gcc dot gnu.org via Gcc-bugs
    • [Bug dri... manx-bugzilla at problemloesungsmaschine dot de via Gcc-bugs
    • [Bug dri... redi at gcc dot gnu.org via Gcc-bugs
    • [Bug dri... manx-bugzilla at problemloesungsmaschine dot de via Gcc-bugs
    • [Bug dri... redi at gcc dot gnu.org via Gcc-bugs
    • [Bug dri... manx-bugzilla at problemloesungsmaschine dot de via Gcc-bugs
    • [Bug dri... redi at gcc dot gnu.org via Gcc-bugs

Reply via email to