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

            Bug ID: 117766
           Summary: Confusion over whether ARM32 -march=armv8-a implies
                    floating point support
           Product: gcc
           Version: 10.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tgl at sss dot pgh.pa.us
  Target Milestone: ---

On 32-bit ARM platforms with hard-float ABI, I observe this strange behavior:

$ touch foo.c
$ gcc -c -march=armv8-a foo.c
cc1: error: '-mfloat-abi=hard': selected processor lacks an FPU

So apparently gcc thinks this arch doesn't include FP hardware.  The gcc
documentation says the contrary, however.  Moreover, if I ask for FP support:

$ gcc -c -march=armv8-a+fp foo.c
gcc: error: 'armv8-a' does not support feature 'fp'
gcc: note: valid feature names are: crc simd crypto nocrypto nofp sb predres;
did you mean 'nofp'?

If it doesn't include FP hardware, why's there a +nofp option rather than +fp?

A workaround is to specify an FPU type explicitly:

$ gcc -c -march=armv8-a -mfpu=vfpv4 foo.c

but it doesn't seem to me I should have to.

This particular typescript was taken from a "generic" ARM32 build of NetBSD
10.0, which uses

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/lto-wrapper
Target: armv7--netbsdelf-eabihf
Configured with: /usr/src/tools/gcc/../../external/gpl3/gcc/dist/configure
--target=armv7--netbsdelf-eabihf --enable-long-long --enable-threads
--with-bugurl=http://www.NetBSD.org/support/send-pr.html
--with-pkgversion='NetBSD nb2 20230710' --with-system-zlib --without-isl
--enable-__cxa_atexit --enable-libstdcxx-time=rt --enable-libstdcxx-threads
--with-diagnostics-color=auto-if-env --with-default-libstdcxx-abi=new
--with-mpc-lib=/var/obj/mknative/evbarm-earmv7hf/usr/src/external/lgpl3/mpc/lib/libmpc
--with-mpfr-lib=/var/obj/mknative/evbarm-earmv7hf/usr/src/external/lgpl3/mpfr/lib/libmpfr
--with-gmp-lib=/var/obj/mknative/evbarm-earmv7hf/usr/src/external/lgpl3/gmp/lib/libgmp
--with-mpc-include=/usr/src/external/lgpl3/mpc/dist/src
--with-mpfr-include=/usr/src/external/lgpl3/mpfr/dist/src
--with-gmp-include=/usr/src/external/lgpl3/gmp/lib/libgmp/arch/arm --enable-tls
--enable-initfini-array --disable-multilib --disable-libstdcxx-pch
--build=armv7--netbsdelf-eabihf --host=armv7--netbsdelf-eabihf
--with-sysroot=/var/obj/mknative/evbarm-earmv7hf/usr/src/destdir.evbarm
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.5.0 (nb3 20231008) 

I have also gotten this identical behavior with the build of gcc 12.2.0
included in current (Nov 2024) Raspberry Pi OS 32-bit.  I don't have that
system booted up to give you the full gcc -v output, but my notes mention

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/12/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ... --with-arch=armv6+fp --with-float=hard ...
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (Raspbian 12.2.0-14+rpi1)

Reply via email to