Bug 107128

Summary: armhf: floatn-common.h:214:9: error: multiple types in one declaration
Product: gcc Reporter: Mathieu Malaterre <malat>
Component: c++Assignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED INVALID    
Severity: normal CC: jakub, jan.wassenberg, marxin, mh+gcc, sjames
Priority: P3    
Version: 13.0   
Target Milestone: ---   
Host: Target: arm
Build: Known to work:
Known to fail: Last reconfirmed: 2022-10-03 00:00:00

Description Mathieu Malaterre 2022-10-03 08:10:45 UTC
Steps:

% cat p.cxx
#include <stdio.h>

int main() { return 0; }

Lead to:

% /usr/lib/gcc-snapshot/bin/g++ -v p.cxx
Using built-in specs.
COLLECT_GCC=/usr/lib/gcc-snapshot/bin/g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc-snapshot/libexec/gcc/arm-linux-gnueabihf/13/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Debian 20221001-1' --with-bugurl=file:///usr/share/doc/gcc-snapshot/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr/lib/gcc-snapshot --with-gcc-major-version-only --program-prefix= --enable-shared --enable-linker-build-id --disable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-sjlj-exceptions --with-arch=armv7-a+fp --with-float=hard --with-mode=thumb --disable-werror --enable-checking=yes --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.0.0 20221001 (experimental) [master r13-3010-g2555071c954] (Debian 20221001-1)
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc'  '-mfloat-abi=hard' '-mtls-dialect=gnu' '-mthumb' '-mlibarch=armv7-a+fp' '-march=armv7-a+fp' '-dumpdir' 'a-'
 /usr/lib/gcc-snapshot/libexec/gcc/arm-linux-gnueabihf/13/cc1plus -quiet -v -imultilib . -imultiarch arm-linux-gnueabihf -D_GNU_SOURCE p.cxx -quiet -dumpdir a- -dumpbase p.cxx -dumpbase-ext .cxx -mfloat-abi=hard -mtls-dialect=gnu -mthumb -mlibarch=armv7-a+fp -march=armv7-a+fp -version -o /tmp/ccjKJPO9.s
GNU C++17 (Debian 20221001-1) version 13.0.0 20221001 (experimental) [master r13-3010-g2555071c954] (arm-linux-gnueabihf)
        compiled by GNU C version 13.0.0 20221001 (experimental) [master r13-3010-g2555071c954], GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.25-GMP

GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
ignoring nonexistent directory "/usr/local/include/arm-linux-gnueabihf"
ignoring nonexistent directory "/usr/lib/gcc-snapshot/lib/gcc/arm-linux-gnueabihf/13/include-fixed/arm-linux-gnueabihf"
ignoring nonexistent directory "/usr/lib/gcc-snapshot/lib/gcc/arm-linux-gnueabihf/13/include-fixed"
ignoring nonexistent directory "/usr/lib/gcc-snapshot/lib/gcc/arm-linux-gnueabihf/13/../../../../arm-linux-gnueabihf/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc-snapshot/lib/gcc/arm-linux-gnueabihf/13/../../../../include/c++/13
 /usr/lib/gcc-snapshot/lib/gcc/arm-linux-gnueabihf/13/../../../../include/c++/13/arm-linux-gnueabihf/.
 /usr/lib/gcc-snapshot/lib/gcc/arm-linux-gnueabihf/13/../../../../include/c++/13/backward
 /usr/lib/gcc-snapshot/lib/gcc/arm-linux-gnueabihf/13/include
 /usr/local/include
 /usr/lib/gcc-snapshot/include
 /usr/include/arm-linux-gnueabihf
 /usr/include
End of search list.
GNU C++17 (Debian 20221001-1) version 13.0.0 20221001 (experimental) [master r13-3010-g2555071c954] (arm-linux-gnueabihf)
        compiled by GNU C version 13.0.0 20221001 (experimental) [master r13-3010-g2555071c954], GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.25-GMP

GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: b7ab5fecab0bff7040c765f74b83b0c1
In file included from /usr/include/arm-linux-gnueabihf/bits/floatn.h:52,
                 from /usr/include/stdio.h:430,
                 from p.cxx:1:
/usr/include/arm-linux-gnueabihf/bits/floatn-common.h:214:9: error: multiple types in one declaration
  214 | typedef float _Float32;
      |         ^~~~~
/usr/include/arm-linux-gnueabihf/bits/floatn-common.h:214:15: error: declaration does not declare anything [-fpermissive]
  214 | typedef float _Float32;
      |               ^~~~~~~~
/usr/include/arm-linux-gnueabihf/bits/floatn-common.h:238:14: error: multiple types in one declaration
  238 | typedef long double _Float64;
      |              ^~~~~~
/usr/include/arm-linux-gnueabihf/bits/floatn-common.h:238:21: error: declaration does not declare anything [-fpermissive]
  238 | typedef long double _Float64;
      |                     ^~~~~~~~
/usr/include/arm-linux-gnueabihf/bits/floatn-common.h:268:9: error: multiple types in one declaration
  268 | typedef double _Float32x;
      |         ^~~~~~
/usr/include/arm-linux-gnueabihf/bits/floatn-common.h:268:16: error: declaration does not declare anything [-fpermissive]
  268 | typedef double _Float32x;
      |                ^~~~~~~~~
Comment 1 Andrew Pinski 2022-10-03 08:27:28 UTC
Is this a packaging issue?
> ignoring nonexistent directory "/usr/lib/gcc-snapshot/lib/gcc/arm-linux-gnueabihf/13/include-fixed/arm-linux-gnueabihf"
ignoring nonexistent directory "/usr/lib/gcc-snapshot/lib/gcc/arm-linux-gnueabihf/13/include-fixed"

Gcc 13 requires some (older) glibc headers to be fixed up .
Comment 2 Mathieu Malaterre 2022-10-03 08:36:05 UTC
> Gcc 13 requires some (older) glibc headers to be fixed up .

I could not reproduce it under my Debian amd64/chroot. I'll check with doko@d.o then.



Sorry for the noise.
Comment 3 Mathieu Malaterre 2022-10-03 10:07:22 UTC
> some (older) glibc

By older what do you mean exactly ? It seems my system provides glibc 2.35:

malat@amdahl /tmp % apt-cache policy libc6-dev
libc6-dev:
  Installed: 2.35-1
  Candidate: 2.35-1
  Version table:
 *** 2.35-1 500
        500 https://deb.debian.org/debian sid/main armhf Packages
        100 /var/lib/dpkg/status
Comment 4 Jakub Jelinek 2022-10-03 10:14:35 UTC
By older in this case is any glibc >= 2.26 and < https://sourceware.org/git/?p=glibc.git;a=commit;h=3e5760fcb48528d48deeb60cb885a97bb731160c
(i.e. for gcc 13, you can avoid fixincludes only for very old glibc (< 2.26) or
if you have 4 or less days old glibc trunk.
Comment 5 Richard Biener 2022-10-06 10:00:46 UTC
Invalid then.
Comment 6 Mike Hommey 2022-11-18 01:56:45 UTC
I'm getting a similar error on x86-64 Debian 11 with libc6 2.31:

In file included from /usr/include/wchar.h:30,
                 from /builds/worker/fetches/gcc-objdir/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/cwchar:44,
                 from /builds/worker/fetches/gcc-objdir/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/postypes.h:40,
                 from /builds/worker/fetches/gcc-objdir/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/iosfwd:42,
                 from /builds/worker/fetches/gcc-objdir/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/shared_ptr.h:52,
                 from /builds/worker/fetches/gcc-objdir/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/memory:80,
                 from ../../gcc-source/libcody/cody.hh:24,
                 from ../../gcc-source/libcody/internal.hh:5,
                 from ../../gcc-source/libcody/packet.cc:6:
/usr/include/x86_64-linux-gnu/bits/floatn.h:87:9: error: multiple types in one declaration
   87 | typedef __float128 _Float128; 
      |         ^~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/floatn.h:87:20: error: declaration does not declare anything [-fpermissive] 
   87 | typedef __float128 _Float128; 
      |                    ^~~~~~~~~  
In file included from /usr/include/x86_64-linux-gnu/bits/floatn.h:120:
/usr/include/x86_64-linux-gnu/bits/floatn-common.h:214:9: error: multiple types in one declaration
  214 | typedef float _Float32;
      |         ^~~~~
/usr/include/x86_64-linux-gnu/bits/floatn-common.h:214:15: error: declaration does not declare anything [-fpermissive] 
  214 | typedef float _Float32;
      |               ^~~~~~~~
/usr/include/x86_64-linux-gnu/bits/floatn-common.h:251:9: error: multiple types in one declaration
  251 | typedef double _Float64;  
      |         ^~~~~~
/usr/include/x86_64-linux-gnu/bits/floatn-common.h:251:16: error: declaration does not declare anything [-fpermissive] 
  251 | typedef double _Float64;  
      |                ^~~~~~~~
/usr/include/x86_64-linux-gnu/bits/floatn-common.h:268:9: error: multiple types in one declaration
  268 | typedef double _Float32x; 
      |         ^~~~~~
/usr/include/x86_64-linux-gnu/bits/floatn-common.h:268:16: error: declaration does not declare anything [-fpermissive] 
  268 | typedef double _Float32x; 
      |                ^~~~~~~~~      
/usr/include/x86_64-linux-gnu/bits/floatn-common.h:285:14: error: multiple types in one declaration
  285 | typedef long double _Float64x;
      |              ^~~~~~
/usr/include/x86_64-linux-gnu/bits/floatn-common.h:285:21: error: declaration does not declare anything [-fpermissive] 
  285 | typedef long double _Float64x;
      |                     ^~~~~~~~~
Comment 7 Mike Hommey 2022-11-18 03:02:34 UTC
Forget my last comment, it came from the use of a sysroot with an older glibc. I wonder why the sysroot path didn't appear in those messages...
Comment 8 Andrew Pinski 2022-11-18 03:07:21 UTC
(In reply to Mike Hommey from comment #7)
> Forget my last comment, it came from the use of a sysroot with an older
> glibc. I wonder why the sysroot path didn't appear in those messages...

Can you file a new bug. Fixincludes should be happening for the sysroot but maybe a setting is wrong. Please include how you configured gcc.
Comment 9 Jakub Jelinek 2022-11-18 07:51:50 UTC
(In reply to Mike Hommey from comment #7)
> Forget my last comment, it came from the use of a sysroot with an older
> glibc. I wonder why the sysroot path didn't appear in those messages...

You need to use fixincludes with gcc 13+ unless you have very old or very fresh glibc.
Comment 10 GCC Commits 2023-03-13 20:16:54 UTC
The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:538a0d0f29b12cff05681b6de2e0a3d7b33f3ef0

commit r13-6643-g538a0d0f29b12cff05681b6de2e0a3d7b33f3ef0
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Mar 13 14:06:11 2023 -0400

    c++: handle _FloatNN redeclaration like bool [PR107128]
    
    It's been inconvenient to compile testcases preprocessed with GCC 12 or
    earlier because they break on
    
      typedef __float128 _Float128;
    
    We already had code for handling this with bool and wchar_t, it just needs
    to be extended to _FloatNN as well.
    
            PR c++/107128
    
    gcc/cp/ChangeLog:
    
            * parser.cc (cp_parser_set_decl_spec_type): Use
            redefined_builtin_type for extended_float_type_p.
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/warn/pragma-system_header6.h: New test.
            * g++.dg/warn/pragma-system_header6.C: New test.