NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
port-amd64/58784: gcc -pg with pthread causes segmentation fault
>Number: 58784
>Category: port-amd64
>Synopsis: gcc -pg with pthread causes segmentation fault
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: port-amd64-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Oct 29 00:30:00 +0000 2024
>Originator: Furkan Onder
>Release: NetBSD 10.0
>Organization:
>Environment:
NetBSD home.localhost 10.0 NetBSD 10.0 (GENERIC) #0: Thu Mar 28 08:33:33 UTC 2024 mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
I am experiencing segmentation faults on NetBSD when using the -pg flag with GCC in conjunction with pthreads, specifically when configuring CPython with --enable-profiling.
You can find the related issue for CPython here(https://github.com/python/cpython/issues/126099)
>How-To-Repeat:
Small Example to Reproduce:
➜ ~ cat test.c
#include <pthread.h>
#include <stdio.h>
void* run(void* arg) {
printf("Thread %ld is running.\n", (long)arg);
return NULL;
}
int main(void) {
for (long i = 0; i < 8; i++) {
pthread_t tid;
pthread_create(&tid, NULL, run, (void*)i);
pthread_detach(tid);
}
pthread_exit(NULL);
}
➜ ~ gcc -pg test.c -o test -lpthread
➜ ~ ./test
[1] 13114 segmentation fault (core dumped) ./test
To Reproduce in CPython:
➜ ~ ./configure --with-pydebug --enable-profiling --disable-ipv6 && make
➜ ~ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/lto-wrapper
Target: x86_64--netbsd
Configured with: /usr/src/tools/gcc/../../external/gpl3/gcc/dist/configure --target=x86_64--netbsd --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/support/send-pr.html --with-pkgversion='NetBSD nb2 20230710' --with-system-zlib --without-isl --enable-__cxa_atexit --enable-libstdcxx-time=rt --enable-libstdcxx-threads --with-diagnostics-color=auto-if-env --with-tune=nocona --with-default-libstdcxx-abi=new --with-mpc-lib=/var/obj/mknative/amd64-x86_64/usr/src/external/lgpl3/mpc/lib/libmpc --with-mpfr-lib=/var/obj/mknative/amd64-x86_64/usr/src/external/lgpl3/mpfr/lib/libmpfr --with-gmp-lib=/var/obj/mknative/amd64-x86_64/usr/src/external/lgpl3/gmp/lib/libgmp --with-mpc-include=/usr/src/external/lgpl3/mpc/dist/src --with-mpfr-include=/usr/src/external/lgpl3/mpfr/dist/src --with-gmp-include=/usr/src/external/lgpl3/gmp/lib/libgmp/arch/x86_64 --enable-tls --disable-multilib --disable-libstdcxx-pch --build=x86_64--netbsd --host=x86_64--netbsd --with-sysroot=/var/obj/mkna
tive/amd64-x86_64/usr/src/destdir.amd64
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.5.0 (nb3 20231008)
>Fix:
-
Home |
Main Index |
Thread Index |
Old Index