From nobody Mon Aug 28 11:43:20 2023 X-Original-To: ports-bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RZ7wm52RHz4rSZw for ; Mon, 28 Aug 2023 11:43:20 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RZ7wm2tZ3z3blY for ; Mon, 28 Aug 2023 11:43:20 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1693223000; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yZS8j4WbE/PUSQrlicpH8NNS3nCfkOV3VSDB3yw/yUk=; b=KkyP76J4ZZwYkdw6ZEi7FbaK9ak9Fn/QHnoIg8osw9Wd6hbRNeX9pQZXHJ55qxNf1+82NL ++UpakC99YQ2j1Y05dFqUlKk98VJCnx5xL598T3djEmnHSyWwSFdHWmmmh7xj/pCnGcu4E dG7Jo+D0De6kZVi4PwphwL2TGcJj9v3vFeLf36lTLQdJSTloDAUfgS3jX0+2P3xXjtEJpn ezRUkIQEXKNQYXNQAcZrWg1tWIiXJcMyc2NHfuGZZC2USMODPhamLLLOhHGYT7RchAAnv6 Vmt8j5XenaLVD+WZNoEcv+L2JKPAOa/unO2eQRmv/IDaDHT9ZGe+n576H+/A8Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1693223000; a=rsa-sha256; cv=none; b=JSjuzPbxygvacwVRRECk0FAcfA/ogew3b/t5CYaf+B18ojpcRdLMcnXd6LygcGysEPQf3e xjlZP9l0DOCVkv1t4p4ia3jYeKh9zS1UmQ08+GMjLkWqCaIU5FYrMm+gY+m4OGDgr3JFb7 E8DHy5UeQirKVXD6bfJlDnYBYxqkFaBu8cCGLoFczakL/gqYKOMQ8/bRLXCbFWeMXa2xGr JEVGRY2Ubws0sDeLIbiQnDOC58tnQeaNS+eTrfZukngvgDc4UtaFxzpC8AdqxrQo0arwGS SOnW/QhHsn5rQjsyy2TdqdZhtfQVB9d2eauVjCgouTsS7LpNeqETY7cGt+Y+Dw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RZ7wm1yPHz16g8 for ; Mon, 28 Aug 2023 11:43:20 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 37SBhKwg096699 for ; Mon, 28 Aug 2023 11:43:20 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 37SBhKnM096698 for ports-bugs@FreeBSD.org; Mon, 28 Aug 2023 11:43:20 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: ports-bugs@FreeBSD.org Subject: [Bug 273398] lang/gcc: statically linking a program with -pthread aborts Date: Mon, 28 Aug 2023 11:43:20 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: stffn.mobil@freenet.de X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: gerald@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter flagtypes.name Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Ports bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-ports-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-ports-bugs@freebsd.org X-BeenThere: freebsd-ports-bugs@freebsd.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D273398 Bug ID: 273398 Summary: lang/gcc: statically linking a program with -pthread aborts Product: Ports & Packages Version: Latest Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: Individual Port(s) Assignee: gerald@FreeBSD.org Reporter: stffn.mobil@freenet.de Flags: maintainer-feedback?(gerald@FreeBSD.org) Assignee: gerald@FreeBSD.org I have created a simple program using two C++ threads: ``` #include #include #include int num =3D 0; std::mutex mut{}; void func() { for (int i =3D 0; i < 10000; ++i) { std::lock_guard lock(mut) ++num; } } int main() { std::thread thread1 =3D std::thread(func); std::thread thread2 =3D std::thread(func); thread2.join(); thread1.join(); printf("%d\n", num); return 0; } ``` Compiling this with `g++13 -static -O3 -pthread main.cpp` and running `./a.= out` generates a core dump:=20 ``` zsh: abort (core dumped) ./a.out ``` I've tried linking with `-lthr` and `-static-libstdc++` and `-static-libgcc` but those should be implied by `g++ -static` anyways. I'm working on a project where this issue occures aswell when using the pthread.h header instead of C++ threads. Clang's static and dynammic output works as expected as well as gcc's dynam= ic executable. --=20 You are receiving this mail because: You are the assignee for the bug.=