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

            Bug ID: 107884
           Summary: H8/300: cp-demangle.c fix warning related demangle.h
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: uaa at mx5 dot nisiq.net
  Target Milestone: ---

Created attachment 53973
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53973&action=edit
pack DMGL_* option bit within 16bit width

On building gcc-12.2.0 with newlib-4.1.0 (newlib and libgloss) and
binutils-2.36.1 on Debian-11.5/amd64.

gcc/config/h8300/t-h8300 is modified with:

    MULTILIB_OPTIONS = ms/msx mint32
    MULTILIB_DIRNAMES = h8300s h8sx int32

to disable building H8 normal mode library.

gcc configuration is:

    ../configure --target=h8300-unknown-elf --enable-languages=c,c++ \
    --prefix=/home/uaa/h8300 --with-newlib --disable-nls --disable-libssp \
    --disable-libgomp --disable-libstdcxx-pch \
    --disable-libstdcxx-filesystem-ts --with-newlib --disable-wchar_t

include/demangle.h related warning occurs cross-compiled cp-demangle.c,
due to the size of int is 16bit (H8/300 default).

    bin/bash ../libtool --tag CC --tag disable-shared  --mode=compile
/home/uaa/gcc-12.2.0/h8300-unknown-elf/./gcc/xgcc
-B/home/uaa/gcc-12.2.0/h8300-unknown-elf/./gcc/ -nostdinc
-B/home/uaa/gcc-12.2.0/h8300-unknown-elf/h8300-unknown-elf/newlib/ -isystem
/home/uaa/gcc-12.2.0/h8300-unknown-elf/h8300-unknown-elf/newlib/targ-include
-isystem /home/uaa/gcc-12.2.0/newlib/libc/include
-B/home/uaa/h8300/h8300-unknown-elf/bin/
-B/home/uaa/h8300/h8300-unknown-elf/lib/ -isystem
/home/uaa/h8300/h8300-unknown-elf/include -isystem
/home/uaa/h8300/h8300-unknown-elf/sys-include    -DHAVE_CONFIG_H -I..
-I/home/uaa/gcc-12.2.0/libstdc++-v3/../libiberty
-I/home/uaa/gcc-12.2.0/libstdc++-v3/../include  
-I/home/uaa/gcc-12.2.0/h8300-unknown-elf/h8300-unknown-elf/libstdc++-v3/include/h8300-unknown-elf
-I/home/uaa/gcc-12.2.0/h8300-unknown-elf/h8300-unknown-elf/libstdc++-v3/include
-I/home/uaa/gcc-12.2.0/libstdc++-v3/libsupc++    -g -O2  -DIN_GLIBCPP_V3
-Wno-error -c cp-demangle.c
    libtool: compile:  /home/uaa/gcc-12.2.0/h8300-unknown-elf/./gcc/xgcc
-B/home/uaa/gcc-12.2.0/h8300-unknown-elf/./gcc/ -nostdinc
-B/home/uaa/gcc-12.2.0/h8300-unknown-elf/h8300-unknown-elf/newlib/ -isystem
/home/uaa/gcc-12.2.0/h8300-unknown-elf/h8300-unknown-elf/newlib/targ-include
-isystem /home/uaa/gcc-12.2.0/newlib/libc/include
-B/home/uaa/h8300/h8300-unknown-elf/bin/
-B/home/uaa/h8300/h8300-unknown-elf/lib/ -isystem
/home/uaa/h8300/h8300-unknown-elf/include -isystem
/home/uaa/h8300/h8300-unknown-elf/sys-include -DHAVE_CONFIG_H -I..
-I/home/uaa/gcc-12.2.0/libstdc++-v3/../libiberty
-I/home/uaa/gcc-12.2.0/libstdc++-v3/../include
-I/home/uaa/gcc-12.2.0/h8300-unknown-elf/h8300-unknown-elf/libstdc++-v3/include/h8300-unknown-elf
-I/home/uaa/gcc-12.2.0/h8300-unknown-elf/h8300-unknown-elf/libstdc++-v3/include
-I/home/uaa/gcc-12.2.0/libstdc++-v3/libsupc++ -g -O2 -DIN_GLIBCPP_V3 -Wno-error
-c cp-demangle.c -o cp-demangle.o
    In file included from cp-demangle.c:139:
    /home/uaa/gcc-12.2.0/libstdc++-v3/../include/demangle.h:58:29: warning:
left shift count >= width of type [-Wshift-count-overflow]
       58 | #define DMGL_DLANG       (1 << 16)
          |                             ^~
    /home/uaa/gcc-12.2.0/libstdc++-v3/../include/demangle.h:91:22: note: in
expansion of macro 'DMGL_DLANG'
       91 |   dlang_demangling = DMGL_DLANG,
          |                      ^~~~~~~~~~
    /home/uaa/gcc-12.2.0/libstdc++-v3/../include/demangle.h:59:29: warning:
left shift count >= width of type [-Wshift-count-overflow]
       59 | #define DMGL_RUST        (1 << 17)      /* Rust wraps GNU_V3 style
mangling.  */
          |                             ^~
    /home/uaa/gcc-12.2.0/libstdc++-v3/../include/demangle.h:92:21: note: in
expansion of macro 'DMGL_RUST'
       92 |   rust_demangling = DMGL_RUST
          |                     ^~~~~~~~~
    cp-demangle.c: In function 'd_function_type':
    /home/uaa/gcc-12.2.0/libstdc++-v3/../include/demangle.h:68:34: warning:
left shift count >= width of type [-Wshift-count-overflow]
       68 | #define DMGL_NO_RECURSE_LIMIT (1 << 18)
          |                                  ^~
    cp-demangle.c:2891:22: note: in expansion of macro 'DMGL_NO_RECURSE_LIMIT'
     2891 |   if ((di->options & DMGL_NO_RECURSE_LIMIT) == 0)
          |                      ^~~~~~~~~~~~~~~~~~~~~
    /home/uaa/gcc-12.2.0/libstdc++-v3/../include/demangle.h:68:34: warning:
left shift count >= width of type [-Wshift-count-overflow]
       68 | #define DMGL_NO_RECURSE_LIMIT (1 << 18)
          |                                  ^~
    cp-demangle.c:2916:22: note: in expansion of macro 'DMGL_NO_RECURSE_LIMIT'
     2916 |   if ((di->options & DMGL_NO_RECURSE_LIMIT) == 0)
          |                      ^~~~~~~~~~~~~~~~~~~~~
    cp-demangle.c: In function 'd_demangle_callback':
    /home/uaa/gcc-12.2.0/libstdc++-v3/../include/demangle.h:68:34: warning:
left shift count >= width of type [-Wshift-count-overflow]
       68 | #define DMGL_NO_RECURSE_LIMIT (1 << 18)
          |                                  ^~
    cp-demangle.c:6448:19: note: in expansion of macro 'DMGL_NO_RECURSE_LIMIT'
     6448 |   if (((options & DMGL_NO_RECURSE_LIMIT) == 0)
          |                   ^~~~~~~~~~~~~~~~~~~~~

suggested remedy is attached.

Reply via email to