gcc

Comment 5 for bug 887377

Revision history for this message
In , Colin Watson (cjwatson) wrote :

This is a reduced test case from a cmake test failure manifesting on Ubuntu ARM (https://bugs.launchpad.net/bugs/887377):

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.2-2ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.6.2 (Ubuntu/Linaro 4.6.2-2ubuntu1)
$ cat specs
*asm_cpu_spec:
 %{mcpu=generic-*:-march=%*; :%{mcpu=*:-mcpu=%*} %{march=*:-march=%*}}
$ gcc -specs=specs ---
gcc: fatal error: no input files
compilation terminated.
$ gcc ---
gcc: error: unrecognized option ‘---’
gcc: fatal error: no input files
compilation terminated.

cmake (which I'm not responsible for; I'm just trying to build it) has a facility to try to work out whether compiler options are valid, and apparently looks for "unrecognized option" on stderr. I'm not exactly a fan of matching human-readable error output like this, but this spec line currently has the side-effect of validating all switches, and I don't think that can possibly be its intent.

This spec line was added in this commit:

  http://gcc.gnu.org/viewcvs?view=revision&revision=178731

I think the `validate_switches' function should only mark matching switches as valid if `len' is non-zero.