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

            Bug ID: 82952
           Summary: Hang compiling with g++ -fsanitize=undefined
                    -Wduplicated-branches
           Product: gcc
           Version: 7.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ahmad at a3f dot at
  Target Milestone: ---

I ran into this while building Wireshark with g++ 7.2.1 revision 253932 on
openSUSE Tumbleweed x86_64. Running:
g++ -c hangs.cpp -std=c++11 -fsanitize=undefined -Wduplicated-branches

hangs for at least 25 minutes.

hangs.cpp is based off ui/qt/widgets/capture_filter_edit.cpp of commit
9d49e1316689ae05d31efc866f04ac12cd051085 in the Wireshark source tree.

The stack trace shows 340+ nested calls to inchash::add_expr, abbreviated to
... here:

#0  0x00000000013d0046 in iterative_hash ()
#1  0x000000000125cd00 in inchash::add_expr(tree_node const*, inchash::hash&,
unsigned int) ()
...
#344 0x000000000125cdfb in inchash::add_expr(tree_node const*, inchash::hash&,
unsigned int) ()
#345 0x00000000009b7dc3 in ?? ()
#346 0x000000000125cda7 in inchash::add_expr(tree_node const*, inchash::hash&,
unsigned int) ()
#347 0x000000000069dfb8 in do_warn_duplicated_branches_r(tree_node**, int*,
void*) ()
#348 0x0000000001260437 in walk_tree_1(tree_node**, tree_node* (*)(tree_node**,
int*, void*), void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*)) ()
#349 0x0000000001260374 in walk_tree_without_duplicates_1(tree_node**,
tree_node* (*)(tree_node**, int*, void*), void*, tree_node* (*)(tree_node**,
int*, tree_node* (*)(tree_node**, int*, void*), void*, hash_set<tree_node*,
default_hash_traits<tree_node*> >*)) ()
#350 0x00000000006837d2 in ?? ()
#351 0x0000000000659d83 in ?? ()
#352 0x0000000000dfd701 in finish_function(int) ()
#353 0x00000000005ecd97 in ?? ()
#354 0x000000000143bd59 in ?? ()
#355 0x0000000000dd63da in toplev::main(int, char**) ()
#356 0x0000000000dd7c7b in main ()

Compiler info:

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/7/lto-wrapper
OFFLOAD_TARGET_NAMES=hsa:nvptx-none
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64
--enable-languages=c,c++,objc,fortran,obj-c++,ada,go
--enable-offload-targets=hsa,nvptx-none=/usr/nvptx-none, --without-cuda-driver
--enable-checking=release --disable-werror
--with-gxx-include-dir=/usr/include/c++/7 --enable-ssp --disable-libssp
--disable-libvtv --disable-libcc1 --enable-plugin
--with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux'
--with-slibdir=/lib64 --with-system-zlib --enable-__cxa_atexit
--enable-libstdcxx-allocator=new --disable-libstdcxx-pch
--enable-version-specific-runtime-libs --with-gcc-major-version-only
--enable-linker-build-id --enable-linux-futex --enable-gnu-indirect-function
--program-suffix=-7 --without-system-libunwind --enable-multilib
--with-arch-32=x86-64 --with-tune=generic --build=x86_64-suse-linux
--host=x86_64-suse-linux
Thread model: posix
gcc version 7.2.1 20171020 [gcc-7-branch revision 253932] (SUSE Linux)

Reply via email to