From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AFC5D3870852; Mon, 27 Jun 2022 12:03:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AFC5D3870852 From: "slyfox at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/106102] gcc/cp/mapper-resolver.cc fails to build against musl: musl-1.2.3-dev/include/sched.h:84:7: error: attempt to use poisoned "calloc" Date: Mon, 27 Jun 2022 12:03:56 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: slyfox at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2022 12:03:56 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106102 --- Comment #3 from Sergei Trofimovich --- Aha, that makes sense. In this case include chain is: - c++tools/resolver.cc -> c++tools/resolver.h -> libcody/cody.hh -> libstdc++-v3/include/memory -> libstdc++-v3/include/bits/shared_ptr.h -> ... -> libstdc++-v3/include/x86_64-unknown-linux-musl/bits/gthr-defau= lt.h -> musl-1.2.3-dev/include/pthread.h -> musl-1.2.3-dev/include/sched.h [uses calloc()] AFAIU libstdc++-v3/include are all user-facing libraries and are expected to include system headers like . It's a bit worrying that resolver.cc depends on in such an indi= rect way. Would it be fair to say "system.h" needs to include for this case = and be done with it? Does gcc do any system header wrapping by chance to minimize such leaks? I'm only asking because I noticed musl has different include order from glibc: https://github.com/NixOS/nixpkgs/issues/142066#issuecomment-1159568114. I t= ried to make include order alone closer to glibc and it did not fix the issue.=