Hi,
The demo program:
#####################
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <mpfr.h>
void *foo( void *ptr );
int main(void) {
pthread_t thread1;
char *message1 = "precision in thread1:";
int iret1;
if(mpfr_buildopt_tls_p()) printf("mpfr was built with TLS support\n");
else printf("mpfr was NOT built with TLS support\n");
iret1 = pthread_create( &thread1, NULL, foo, (void*) message1);
pthread_join( thread1, NULL);
printf("pthread_create() returned: %d\n",iret1);
return 0;
}
void *foo( void * ptr) {
char *message;
message = (char *) ptr;
mpfr_set_default_prec(201);
printf("%s %d\n", message, mpfr_get_default_prec());
pthread_exit (NULL);
}
########################
When built using gcc-12.2.0 (or earlier) this outputs precisely what I
expect:
mpfr was built with TLS support
precision in thread1: 201
pthread_create() returned: 0
However, not so with gcc-13.0.1
I have 2 builds of gcc-13.0.1:
gcc version 13.0.1 20230406 (experimental) (GCC with MCF thread model,
built by LH_Mouse)
and
gcc version 13.0.1 20230402 (experimental) (MinGW-W64
x86_64-msvcrt-mcf-seh, built by Brecht Sanders)
When I build that demo with those 13.0.1 compilers I get:
mpfr was built with TLS support
precision in thread1: 53
pthread_create() returned: 0
That is, the "mpfr_set_default_precision(201)" call made in foo() is
apparently ignored, and the initial default precision of 53 is output.
I've run this by the mpfr developers and they don't think it's an mpfr
issue. (Neither do I.)
Those 2 gcc-13.0.1 compilers enable MCF threads and I wonder if that's part
of the problem.
If someone could point me to a 13.0.1 compiler that is not MFC thread
enabled then I might be able to clarify that.
(All of my gcc-12 and earlier compilers do not enable MCF threads.)
If it's not the MFC threads capability that's the problem, then I'm
thinking that the problem must be elsewhere in gcc-13.0.1.
Should I file a bug report about this ?
Also, is anyone in a position to be able to confirm this behaviour with
gcc-13.0.1 ?
I've established that it doesn't matter whether the gmp/mpfr libs are
static or shared.
I've also established that it doesn't matter whether the gmp/mpfr libraries
I link to were built by gcc-12.2.0 or 13.0.1.
The out[put I get seems to be solely dependent upon whether I compile the
program using gcc-13.0.1 or not.
Cheers,
Rob
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public