public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/97570] New: avr-gcc: error: 'void* memalign' redeclared as different kind of entity
@ 2020-10-25 16:24 matwey.kornilov at gmail dot com
  2020-10-26 10:49 ` [Bug libstdc++/97570] " redi at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: matwey.kornilov at gmail dot com @ 2020-10-25 16:24 UTC (permalink / raw)
  To: gcc-bugs

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

            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++ standard
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 declaration
'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=/usr --target=avr --enable-languages=c,c++
--disable-nls --disable-libssp --with-dwarf2
# make
# make install

2. Build and install avr-libc 2.0

# ../configure --prefix=/usr --build=`../config.guess` --host=avr
# make
# make install

3. Rebuild gcc with Freestanding libstdc++

# ../configure --prefix=/usr --target=avr --enable-languages=c,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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libstdc++/97570] avr-gcc: error: 'void* memalign' redeclared as different kind of entity
  2020-10-25 16:24 [Bug libstdc++/97570] New: avr-gcc: error: 'void* memalign' redeclared as different kind of entity matwey.kornilov at gmail dot com
@ 2020-10-26 10:49 ` redi at gcc dot gnu.org
  2020-10-26 12:36 ` cvs-commit at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2020-10-26 10:49 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2020-10-26

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libstdc++/97570] avr-gcc: error: 'void* memalign' redeclared as different kind of entity
  2020-10-25 16:24 [Bug libstdc++/97570] New: avr-gcc: error: 'void* memalign' redeclared as different kind of entity matwey.kornilov at gmail dot com
  2020-10-26 10:49 ` [Bug libstdc++/97570] " redi at gcc dot gnu.org
@ 2020-10-26 12:36 ` cvs-commit at gcc dot gnu.org
  2020-10-26 12:36 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-10-26 12:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:93e9a7bcd5434a24c945de33cd7fa01a25f68418

commit r11-4383-g93e9a7bcd5434a24c945de33cd7fa01a25f68418
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Oct 26 12:02:50 2020 +0000

    libstdc++: Fix declarations of memalign etc. for freestanding [PR 97570]

    libstdc++-v3/ChangeLog:

            PR libstdc++/97570
            * libsupc++/new_opa.cc: Declare size_t in global namespace.
            Remove unused header.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libstdc++/97570] avr-gcc: error: 'void* memalign' redeclared as different kind of entity
  2020-10-25 16:24 [Bug libstdc++/97570] New: avr-gcc: error: 'void* memalign' redeclared as different kind of entity matwey.kornilov at gmail dot com
  2020-10-26 10:49 ` [Bug libstdc++/97570] " redi at gcc dot gnu.org
  2020-10-26 12:36 ` cvs-commit at gcc dot gnu.org
@ 2020-10-26 12:36 ` redi at gcc dot gnu.org
  2020-10-26 12:38 ` redi at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2020-10-26 12:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Thanks for the report. It's fixed on the development trunk now, but I will also
backport it to the release branches.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libstdc++/97570] avr-gcc: error: 'void* memalign' redeclared as different kind of entity
  2020-10-25 16:24 [Bug libstdc++/97570] New: avr-gcc: error: 'void* memalign' redeclared as different kind of entity matwey.kornilov at gmail dot com
                   ` (2 preceding siblings ...)
  2020-10-26 12:36 ` redi at gcc dot gnu.org
@ 2020-10-26 12:38 ` redi at gcc dot gnu.org
  2021-04-19  9:19 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2020-10-26 12:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Matwey V. Kornilov from comment #0)
> Then gcc and libstdc++ are compiled and installed successfully without any
> further errors.

P.S. this is great news. I've been meaning to check this myself for some time,
as I'd like libstdc++ to be usable (where appropriate) for Arduino projects.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libstdc++/97570] avr-gcc: error: 'void* memalign' redeclared as different kind of entity
  2020-10-25 16:24 [Bug libstdc++/97570] New: avr-gcc: error: 'void* memalign' redeclared as different kind of entity matwey.kornilov at gmail dot com
                   ` (3 preceding siblings ...)
  2020-10-26 12:38 ` redi at gcc dot gnu.org
@ 2021-04-19  9:19 ` cvs-commit at gcc dot gnu.org
  2021-04-19  9:50 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-19  9:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:67e95b6908b842e437089e867e5eed6dbbe264f2

commit r10-9715-g67e95b6908b842e437089e867e5eed6dbbe264f2
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Oct 26 12:02:50 2020 +0000

    libstdc++: Fix declarations of memalign etc. for freestanding [PR 97570]

    libstdc++-v3/ChangeLog:

            PR libstdc++/97570
            * libsupc++/new_opa.cc: Declare size_t in global namespace.
            Remove unused header.

    (cherry picked from commit 93e9a7bcd5434a24c945de33cd7fa01a25f68418)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libstdc++/97570] avr-gcc: error: 'void* memalign' redeclared as different kind of entity
  2020-10-25 16:24 [Bug libstdc++/97570] New: avr-gcc: error: 'void* memalign' redeclared as different kind of entity matwey.kornilov at gmail dot com
                   ` (4 preceding siblings ...)
  2021-04-19  9:19 ` cvs-commit at gcc dot gnu.org
@ 2021-04-19  9:50 ` cvs-commit at gcc dot gnu.org
  2021-04-19 10:00 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-19  9:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:9a7ad8ff80dd5bb3ab178588f0ec92aea5251121

commit r9-9360-g9a7ad8ff80dd5bb3ab178588f0ec92aea5251121
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Oct 26 12:02:50 2020 +0000

    libstdc++: Fix declarations of memalign etc. for freestanding [PR 97570]

    libstdc++-v3/ChangeLog:

            PR libstdc++/97570
            * libsupc++/new_opa.cc: Declare size_t in global namespace.
            Remove unused header.

    (cherry picked from commit 93e9a7bcd5434a24c945de33cd7fa01a25f68418)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libstdc++/97570] avr-gcc: error: 'void* memalign' redeclared as different kind of entity
  2020-10-25 16:24 [Bug libstdc++/97570] New: avr-gcc: error: 'void* memalign' redeclared as different kind of entity matwey.kornilov at gmail dot com
                   ` (5 preceding siblings ...)
  2021-04-19  9:50 ` cvs-commit at gcc dot gnu.org
@ 2021-04-19 10:00 ` cvs-commit at gcc dot gnu.org
  2021-04-19 10:01 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-19 10:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-8 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:9f6c858f76983cbc76d447a06ebce43d98a1fcd2

commit r8-10850-g9f6c858f76983cbc76d447a06ebce43d98a1fcd2
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Oct 26 12:02:50 2020 +0000

    libstdc++: Fix declarations of memalign etc. for freestanding [PR 97570]

    libstdc++-v3/ChangeLog:

            PR libstdc++/97570
            * libsupc++/new_opa.cc: Declare size_t in global namespace.
            Remove unused header.

    (cherry picked from commit 93e9a7bcd5434a24c945de33cd7fa01a25f68418)

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libstdc++/97570] avr-gcc: error: 'void* memalign' redeclared as different kind of entity
  2020-10-25 16:24 [Bug libstdc++/97570] New: avr-gcc: error: 'void* memalign' redeclared as different kind of entity matwey.kornilov at gmail dot com
                   ` (6 preceding siblings ...)
  2021-04-19 10:00 ` cvs-commit at gcc dot gnu.org
@ 2021-04-19 10:01 ` redi at gcc dot gnu.org
  2021-04-19 10:40 ` redi at gcc dot gnu.org
  2021-07-22 14:25 ` redi at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2021-04-19 10:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for 8.5, 9.4 and 10.4

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libstdc++/97570] avr-gcc: error: 'void* memalign' redeclared as different kind of entity
  2020-10-25 16:24 [Bug libstdc++/97570] New: avr-gcc: error: 'void* memalign' redeclared as different kind of entity matwey.kornilov at gmail dot com
                   ` (7 preceding siblings ...)
  2021-04-19 10:01 ` redi at gcc dot gnu.org
@ 2021-04-19 10:40 ` redi at gcc dot gnu.org
  2021-07-22 14:25 ` redi at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2021-04-19 10:40 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|redi at gcc dot gnu.org            |unassigned at gcc dot gnu.org
             Status|ASSIGNED                    |NEW

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libstdc++/97570] avr-gcc: error: 'void* memalign' redeclared as different kind of entity
  2020-10-25 16:24 [Bug libstdc++/97570] New: avr-gcc: error: 'void* memalign' redeclared as different kind of entity matwey.kornilov at gmail dot com
                   ` (8 preceding siblings ...)
  2021-04-19 10:40 ` redi at gcc dot gnu.org
@ 2021-07-22 14:25 ` redi at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2021-07-22 14:25 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |8.5
         Resolution|---                         |FIXED

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-07-22 14:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-25 16:24 [Bug libstdc++/97570] New: avr-gcc: error: 'void* memalign' redeclared as different kind of entity matwey.kornilov at gmail dot com
2020-10-26 10:49 ` [Bug libstdc++/97570] " redi at gcc dot gnu.org
2020-10-26 12:36 ` cvs-commit at gcc dot gnu.org
2020-10-26 12:36 ` redi at gcc dot gnu.org
2020-10-26 12:38 ` redi at gcc dot gnu.org
2021-04-19  9:19 ` cvs-commit at gcc dot gnu.org
2021-04-19  9:50 ` cvs-commit at gcc dot gnu.org
2021-04-19 10:00 ` cvs-commit at gcc dot gnu.org
2021-04-19 10:01 ` redi at gcc dot gnu.org
2021-04-19 10:40 ` redi at gcc dot gnu.org
2021-07-22 14:25 ` redi at gcc dot gnu.org

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).