public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "slyfox at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/106102] New: 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 10:05:36 +0000	[thread overview]
Message-ID: <bug-106102-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 106102
           Summary: 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"
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

For build errors like 'error: attempt to use poisoned "calloc"': is it a gcc
bug or libc bug?

At least on musl libc gcc marks calloc() as '#pragma GCC poison' but later
stumbles on '#define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))'
from musl's own sched.h.

Here is an example failure on this week's gcc:

/build/build/./prev-gcc/xg++ -B/build/build/./prev-gcc/
-B/<<NIX>>/gcc-13.0.0/x86_64-unknown-linux-musl/bin/ -nostdinc++
-B/build/build/prev-x86_64-unknown-linux-musl/libstdc++-v3/src/.libs
-B/build/build/prev-x86_64-unknown-linux-musl/libstdc++-v3/libsupc++/.libs 
-I/build/build/prev-x86_64-unknown-linux-musl/libstdc++-v3/include/x86_64-unknown-linux-musl
 -I/build/build/prev-x86_64-unknown-linux-musl/libstdc++-v3/include 
-I/build/gcc-13-20220626/libstdc++-v3/libsupc++
-L/build/build/prev-x86_64-unknown-linux-musl/libstdc++-v3/src/.libs
-L/build/build/prev-x86_64-unknown-linux-musl/libstdc++-v3/libsupc++/.libs 
-fno-PIE -c  -DIN_GCC_FRONTEND -O2 -I/<<NIX>>/musl-1.2.3-dev/include
-B/<<NIX>>/musl-1.2.3/lib/ -idirafter /<<NIX>>/musl-1.2.3-dev/include
-idirafter
/<<NIX>>/bootstrap-tools/lib/gcc/x86_64-unknown-linux-musl/7.3.0/include-fixed
-Wl,-rpath,/<<NIX>>/gcc-13.0.0-lib/lib -Wl,-L/<<NIX>>/musl-1.2.3/lib -Wl,-rpath
-Wl,/<<NIX>>/musl-1.2.3/lib
-Wl,-dynamic-linker=/<<NIX>>/musl-1.2.3/lib/ld-musl-x86_64.so.1 -fno-checking
-gtoggle -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W
-Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute
-Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros
-Wno-overlength-strings -Werror -fno-common  -DHAVE_CONFIG_H -I. -Icp
-I../../gcc-13-20220626/gcc -I../../gcc-13-20220626/gcc/cp
-I../../gcc-13-20220626/gcc/../include
-I../../gcc-13-20220626/gcc/../libcpp/include
-I../../gcc-13-20220626/gcc/../libcody
-I/<<NIX>>/gmp-with-cxx-6.2.1-dev/include -I/<<NIX>>/mpfr-4.1.0-dev/include
-I/<<NIX>>/libmpc-1.2.1/include  -I../../gcc-13-20220626/gcc/../libdecnumber
-I../../gcc-13-20220626/gcc/../libdecnumber/bid -I../libdecnumber
-I../../gcc-13-20220626/gcc/../libbacktrace -I/<<NIX>>/isl-0.20/include  -o
cp/mapper-resolver.o -MT cp/mapper-resolver.o -MMD -MP -MF
cp/.deps/mapper-resolver.TPo ../../gcc-13-20220626/gcc/cp/mapper-resolver.cc
In file included from /<<NIX>>/musl-1.2.3-dev/include/pthread.h:30,
                 from
/build/build/prev-x86_64-unknown-linux-musl/libstdc++-v3/include/x86_64-unknown-linux-musl/bits/gthr-default.h:35,
                 from
/build/build/prev-x86_64-unknown-linux-musl/libstdc++-v3/include/x86_64-unknown-linux-musl/bits/gthr.h:148,
                 from
/build/build/prev-x86_64-unknown-linux-musl/libstdc++-v3/include/ext/atomicity.h:35,
                 from
/build/build/prev-x86_64-unknown-linux-musl/libstdc++-v3/include/bits/shared_ptr_base.h:61,
                 from
/build/build/prev-x86_64-unknown-linux-musl/libstdc++-v3/include/bits/shared_ptr.h:53,
                 from
/build/build/prev-x86_64-unknown-linux-musl/libstdc++-v3/include/memory:77,
                 from ../../gcc-13-20220626/gcc/../libcody/cody.hh:24,
                 from
../../gcc-13-20220626/gcc/cp/../../c++tools/resolver.h:25,
                 from
../../gcc-13-20220626/gcc/cp/../../c++tools/resolver.cc:23,
                 from ../../gcc-13-20220626/gcc/cp/mapper-resolver.cc:32:
/<<NIX>>/musl-1.2.3-dev/include/sched.h:84:7: error: attempt to use poisoned
"calloc"
   84 | void *calloc(size_t, size_t);
      |       ^
/<<NIX>>/musl-1.2.3-dev/include/sched.h:124:36: error: attempt to use poisoned
"calloc"
  124 | #define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))
      |                                    ^
make[3]: *** [Makefile:1143: cp/mapper-resolver.o] Error 1
make[3]: *** Waiting for unfinished jobs....
rm fsf-funding.pod lto-dump.pod gfdl.pod gpl.pod cpp.pod gcc.pod gcov-tool.pod
gcov.pod gcov-dump.pod
make[3]: Leaving directory '/build/build/gcc'
make[2]: *** [Makefile:5000: all-stage2-gcc] Error 2
make[2]: Leaving directory '/build/build'
make[1]: *** [Makefile:24628: stage2-bubble] Error 2
make[1]: Leaving directory '/build/build'
make: *** [Makefile:24840: bootstrap] Error 2

gcc is configured as:

./configure --prefix=/<<NIX>>/gcc-13.0.0
--with-gmp-include=/<<NIX>>/gmp-with-cxx-6.2.1-dev/include
--with-gmp-lib=/<<NIX>>/gmp-with-cxx-6.2.1/lib
--with-mpfr-include=/<<NIX>>/mpfr-4.1.0-dev/include
--with-mpfr-lib=/<<NIX>>/mpfr-4.1.0/lib --with-mpc=/<<NIX>>/libmpc-1.2.1
--with-libelf=/<<NIX>>/libelf-0.8.13
--with-native-system-header-dir=/<<NIX>>/musl-1.2.3-dev/include
--program-prefix= --enable-lto --disable-libstdcxx-pch
--without-included-gettext --with-system-zlib --enable-static
--enable-languages=c\,c++ --disable-multilib --enable-plugin
--with-isl=/<<NIX>>/isl-0.20 --disable-libmpx --disable-libsanitizer
--disable-symvers libat_cv_have_ifunc=no --disable-gnu-indirect-function
--build=x86_64-unknown-linux-musl --host=x86_64-unknown-linux-musl
--target=x86_64-unknown-linux-musl

             reply	other threads:[~2022-06-27 10:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-27 10:05 slyfox at gcc dot gnu.org [this message]
2022-06-27 10:10 ` [Bug c++/106102] " sam at gentoo dot org
2022-06-27 10:51 ` rguenth at gcc dot gnu.org
2022-06-27 12:03 ` slyfox at gcc dot gnu.org
2022-06-27 14:50 ` slyfox at gcc dot gnu.org
2022-06-27 22:22 ` cvs-commit at gcc dot gnu.org
2022-06-27 23:00 ` slyfox at gcc dot gnu.org
2022-06-29 18:17 ` cvs-commit at gcc dot gnu.org
2022-07-02 15:22 ` cvs-commit at gcc dot gnu.org
2022-07-02 15:22 ` cvs-commit at gcc dot gnu.org
2022-07-02 15:26 ` slyfox at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-106102-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).