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

Aldy Hernandez <aldyh at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aldyh at gcc dot gnu.org

--- Comment #7 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
I can't reproduce this on mainline.

I'm building:

/source/gcc/configure --host=ppc64-linux --target=i386-elf
--build=x86-64-linux-gnu

I am cheating with the cross tools by setting links to native compilers to
speed up the process.  My x86-64 build compilers are 4.6 based (gcc, g++,
x86-64-unknown-linux-gnu-gcc, etc in the list below) and do not have support
for -Wnarrowing.  My cross compiler is ppc64-linux-g* which is the system
compiler and supports -Wnarrowing:

-rwxr-xr-x. 4 aldyh aldyh 1027379 Mar 11 08:16 c++
-rwxr-xr-x. 1 aldyh aldyh 1024943 Mar 11 08:16 cpp
-rwxr-xr-x. 4 aldyh aldyh 1027379 Mar 11 08:16 g++
-rwxr-xr-x. 3 aldyh aldyh 1022232 Mar 11 08:16 gcc
-rwxr-xr-x. 1 aldyh aldyh  135016 Mar 11 08:16 gcov
lrwxrwxrwx. 1 aldyh aldyh      11 Mar 11 09:36 ppc64-linux-ar -> /usr/bin/ar
lrwxrwxrwx. 1 aldyh aldyh      11 Mar 11 09:36 ppc64-linux-as -> /usr/bin/as
lrwxrwxrwx. 1 aldyh aldyh      12 Mar 11 09:51 ppc64-linux-g++ -> /usr/bin/g++
lrwxrwxrwx. 1 aldyh aldyh      12 Mar 11 09:51 ppc64-linux-gcc -> /usr/bin/gcc
lrwxrwxrwx. 1 aldyh aldyh      11 Mar 11 09:36 ppc64-linux-ld -> /usr/bin/ld
lrwxrwxrwx. 1 aldyh aldyh      11 Mar 11 09:36 ppc64-linux-nm -> /usr/bin/nm
lrwxrwxrwx. 1 aldyh aldyh      16 Mar 11 09:36 ppc64-linux-objcopy ->
/usr/bin/objcopy
lrwxrwxrwx. 1 aldyh aldyh      16 Mar 11 09:36 ppc64-linux-objdump ->
/usr/bin/objdump
lrwxrwxrwx. 1 aldyh aldyh      15 Mar 11 09:36 ppc64-linux-ranlib ->
/usr/bin/ranlib
lrwxrwxrwx. 1 aldyh aldyh      16 Mar 11 09:36 ppc64-linux-readelf ->
/usr/bin/readelf
lrwxrwxrwx. 1 aldyh aldyh      14 Mar 11 09:36 ppc64-linux-strip ->
/usr/bin/strip
-rwxr-xr-x. 4 aldyh aldyh 1027379 Mar 11 08:16 x86_64-unknown-linux-gnu-c++
-rwxr-xr-x. 4 aldyh aldyh 1027379 Mar 11 08:16 x86_64-unknown-linux-gnu-g++
-rwxr-xr-x. 3 aldyh aldyh 1022232 Mar 11 08:16 x86_64-unknown-linux-gnu-gcc
-rwxr-xr-x. 3 aldyh aldyh 1022232 Mar 11 08:16
x86_64-unknown-linux-gnu-gcc-4.6.4

# build compiler with no support for -Wnarrowing:
reynosa:/build/gcc46/install/bin$ gcc -c -Wnarrowing a.c
cc1: error: unrecognized command line option ‘-Wnarrowing’

# cross compiler with support for -Wnarrowing:
reynosa:/build/gcc46/install/bin$ ppc64-linux-gcc -c -Wnarrowing a.c
reynosa:/build/gcc46/install/bin$ 

I see the GCC configury correctly determining that -Wnarrowing is available for
the cross compiler:

[gcc/config.log]
configure:6367: checking whether ppc64-linux-gcc supports -Wnarrowing
configure:6384: ppc64-linux-gcc -c -Wnarrowing  conftest.c >&5
configure:6384: $? = 0
configure:6393: result: yes
...
...
acx_cv_prog_cc_warning__Wnarrowing=yes

However, building build/genconstants.o with the x86-64-linux 4.6 compiler does
not use -Wno-narrowing, and is being compiled correctly:

g++ -c -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE   -DGENERATOR_FILE -I. -Ibuild
-I/s
ource/gcc/gcc -I/source/gcc/gcc/build -I/source/gcc/gcc/../include 
-I/source/gc
c/gcc/../libcpp/include  \
        -o build/genconstants.o /source/gcc/gcc/genconstants.c

Further in the build process, the cross compiler is being used correctly, but
this time with -Wno-narrowing as expected:

ppc64-linux-g++ -c  -DIN_GCC_FRONTEND -g -O2 -DIN_GCC 
-DCROSS_DIRECTORY_STRUCTURE  -fno-exceptions -fno-rtti
-fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
-Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic
-Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common 
-DHAVE_CONFIG_H -I. -Ic -I/source/gcc/gcc -I/source/gcc/gcc/c
-I/source/gcc/gcc/../include -I/source/gcc/gcc/../libcpp/include 
-I/source/gcc/gcc/../libdecnumber -I/source/gcc/gcc/../libdecnumber/dpd
-I../libdecnumber -I/source/gcc/gcc/../libbacktrace   -o c/c-parser.o -MT
c/c-parser.o -MMD -MP -MF c/.deps/c-parser.TPo /source/gcc/gcc/c/c-parser.c

This was last confirmed by Andrew Pinski on 4.8.  I am inclined to remove this
as a regression on GCC 5.

Reply via email to