Hi!

This got committed to trunk as r206477; one small nit:

On Tue, 10 Dec 2013 12:38:34 +0100, Jakub Jelinek <ja...@redhat.com> wrote:
>       * libbacktrace/Makefile.am (libsanitizer_libbacktrace_la_SOURCES): Add
>       ../../libiberty/cp-demangle.c.

Trying to build trunk r207180 with C*FLAGS='-Og -ggdb', a compiler
warning in cp-demangle.c (as seen for other instances of cp-demangle.c
being built) is promoted to a hard error in the libsanitizer context, due
to -Werror usage:

    libtool: compile:  [...]/build/./gcc/xgcc -B[...]/build/./gcc/ 
-B[...]/install/x86_64-unknown-linux-gnu/bin/ 
-B[...]/install/x86_64-unknown-linux-gnu/lib/ -isystem 
[...]/install/x86_64-unknown-linux-gnu/include -isystem 
[...]/install/x86_64-unknown-linux-gnu/sys-include -DHAVE_CONFIG_H -I. 
-I../../../../source/libsanitizer/libbacktrace -I.. -I 
../../../../source/libsanitizer/../include -I 
../../../../source/libsanitizer/../libgcc -I ../../libgcc -I .. -I 
../../../../source/libsanitizer -I 
../../../../source/libsanitizer/../libbacktrace -W -Wall -Wwrite-strings 
-Wmissing-format-attribute -Wcast-qual -Werror -Wstrict-prototypes 
-Wmissing-prototypes -Wold-style-definition -g -O2 -Og -ggdb -MT cp-demangle.lo 
-MD -MP -MF .deps/cp-demangle.Tpo -c 
../../../../source/libsanitizer/libbacktrace/../../libiberty/cp-demangle.c  
-fPIC -DPIC -o .libs/cp-demangle.o
    ../../../../source/libsanitizer/libbacktrace/../../libiberty/cp-demangle.c: 
In function 'd_demangle_callback':
    
../../../../source/libsanitizer/libbacktrace/../../libiberty/cp-demangle.c:5842:14:
 error: 'dc' may be used uninitialized in this function 
[-Werror=maybe-uninitialized]
                  : 0;
                  ^
    cc1: all warnings being treated as errors
    make[4]: *** [cp-demangle.lo] Error 1
    make[4]: Leaving directory 
`[...]/build/x86_64-unknown-linux-gnu/libsanitizer/libbacktrace'

GCC fails to track that all the possible values for enum type indeed have
been covered, and so dc must have been initialized.  As the warning/error
does not appear with -O0, is this in fact a -Og bug?  If not, solve this
by initializing dc to NULL (lame...) ;-), or maybe as follows?

Avoid "'dc' may be uninitialized" warning.

        libiberty/
        * cp-demangle.c (d_demangle_callback): Put __builtin_unreachable
        in place, to help the compiler.

--- libiberty/cp-demangle.c
+++ libiberty/cp-demangle.c
@@ -5824,6 +5824,8 @@ d_demangle_callback (const char *mangled, int options,
                          NULL);
        d_advance (&di, strlen (d_str (&di)));
        break;
+      default:
+       __builtin_unreachable ();
       }
 
     /* If DMGL_PARAMS is set, then if we didn't consume the entire


Grüße,
 Thomas

Attachment: pgpuBx50ylTWK.pgp
Description: PGP signature

Reply via email to