From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 84ECD385782C; Sun, 25 Oct 2020 16:24:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 84ECD385782C From: "matwey.kornilov at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/97570] New: avr-gcc: error: 'void* memalign' redeclared as different kind of entity Date: Sun, 25 Oct 2020 16:24:03 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: matwey.kornilov at gmail dot com 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Sun, 25 Oct 2020 16:24:03 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97570 Bug ID: 97570 Summary: avr-gcc: error: 'void* memalign' redeclared as different kind of entity Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: matwey.kornilov at gmail dot com Target Milestone: --- Hi, While I am trying to build avr-gcc from master with Freestanding C++ standa= rd library on x86_64 host system, I see the following compile error: ../../../../libstdc++-v3/libsupc++/new_opa.cc:56:18: error: 'void* memalign' redeclared as different kind of entity 56 | void *memalign(size_t alignment, size_t size); | ^~~~~~ ../../../../libstdc++-v3/libsupc++/new_opa.cc:39:18: note: previous declara= tion 'void* memalign(std::size_t, std::size_t)' 39 | extern "C" void *memalign(std::size_t boundary, std::size_t size); | ^~~~~~~~ ../../../../libstdc++-v3/libsupc++/new_opa.cc:56:18: error: 'size_t' was not declared in this scope; did you mean 'std::size_t'? 56 | void *memalign(size_t alignment, size_t size); | ^~~~~~ | std::size_t In file included from ../../../../libstdc++-v3/libsupc++/new_opa.cc:26: /usr/src/gcc/avr-obj/avr/libstdc++-v3/include/avr/bits/c++config.h:280:33: note: 'std::size_t' declared here 280 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ ../../../../libstdc++-v3/libsupc++/new_opa.cc:56:36: error: 'size_t' was not declared in this scope; did you mean 'std::size_t'? 56 | void *memalign(size_t alignment, size_t size); | ^~~~~~ | std::size_t In file included from ../../../../libstdc++-v3/libsupc++/new_opa.cc:26: /usr/src/gcc/avr-obj/avr/libstdc++-v3/include/avr/bits/c++config.h:280:33: note: 'std::size_t' declared here 280 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ I use binutils 2.35 and gcc 47d13acbda9a5d8eb57ff169ba74857cd54108e4 Steps to reproduce: 1. Build and install gcc without libstdc++: # ../configure --prefix=3D/usr --target=3Davr --enable-languages=3Dc,c++ --disable-nls --disable-libssp --with-dwarf2 # make # make install 2. Build and install avr-libc 2.0 # ../configure --prefix=3D/usr --build=3D`../config.guess` --host=3Davr # make # make install 3. Rebuild gcc with Freestanding libstdc++ # ../configure --prefix=3D/usr --target=3Davr --enable-languages=3Dc,c++ --disable-nls --disable-libssp --with-dwarf2 --with-newlib --disable-__cxa_atexit --disable-threads --disable-shared --enable-static --disable-sjlj-exceptions --enable-libstdcxx --enable-lto --disable-hosted-libstdcxx # make See the error. The following simple patch fixes the issue: --- a/libstdc++-v3/libsupc++/new_opa.cc +++ b/libstdc++-v3/libsupc++/new_opa.cc @@ -53,7 +53,7 @@ extern "C" # elif _GLIBCXX_HAVE_POSIX_MEMALIGN void *posix_memalign(void **, size_t alignment, size_t size); # elif _GLIBCXX_HAVE_MEMALIGN - void *memalign(size_t alignment, size_t size); + void *memalign(std::size_t alignment, std::size_t size); # endif } #endif Then gcc and libstdc++ are compiled and installed successfully without any further errors. But I doubt that this is correct way to handle this issue.=