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

            Bug ID: 93772
           Summary: ICE in cgraph.c with lto when symbol not defined
           Product: gcc
           Version: 9.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: daniel.santos at pobox dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

I'm getting an ICE when I try to link while a symbol is used but not defined. 
Unfortunately, the project is closed source, so this is about as much as I can
give:

from cgraph.c:

bool
cgraph_edge::possibly_call_in_translation_unit_p (void)
{
   ...

  /* Otherwise we need to lookup prevailing symbol (symbol table is not merged,
     yet) and see if it is a definition.  In fact we may also resolve aliases,
     but that is probably not too important.  */
  symtab_node *node = callee;
  for (int n = 10; node->previous_sharing_asm_name && n ; n--)
    node = node->previous_sharing_asm_name;
  if (node->previous_sharing_asm_name)
    node = symtab_node::get_for_asmname (DECL_ASSEMBLER_NAME (callee->decl));
  gcc_assert (TREE_PUBLIC (node->decl));     /* <------ line 3825 */
  return node->get_availability () >= AVAIL_AVAILABLE;
}


soures built with:
gcc -DHAVE_CONFIG_H <some CPP flags> -O2 -march=native -g3 -flto -ansi -std=c89
-Wall -Wextra -Wno-unused-parameter -Wno-ignored-qualifiers  -Werror=implicit
-MT gpio/my_file.o -MD -MP -MF gpio/.deps/my_file.Tpo -c -o gpio/my_file.o
gpio/my_file.c

link command:
g++ -O2 -march=native -g3 -flto -std=gnu++11 -Wall -Wextra
-Wno-unused-parameter -Wno-ignored-qualifiers -flto -O2 -o my_file <object
files> -lrt -lpthread -Wl,-Bstatic -lboost_date_time -lboost_program_options
-lboost_regex -lboost_system -lboost_thread -Wl,-Bdynamic -lftdi -lusb
-lusb-1.0

during IPA pass: cp
lto1: internal compiler error: in possibly_call_in_translation_unit_p, at
cgraph.c:3825
0x583655 cgraph_edge::possibly_call_in_translation_unit_p()
/usr/src/debug/sys-devel/gcc-9.2.0-r4/gcc-9.2.0/gcc/cgraph.c:3825
0x583655 ipa_read_edge_info
/usr/src/debug/sys-devel/gcc-9.2.0-r4/gcc-9.2.0/gcc/ipa-prop.c:4378
0x583655 ipa_read_node_info
/usr/src/debug/sys-devel/gcc-9.2.0-r4/gcc-9.2.0/gcc/ipa-prop.c:4455
0x583655 ipa_prop_read_section
/usr/src/debug/sys-devel/gcc-9.2.0-r4/gcc-9.2.0/gcc/ipa-prop.c:4539
0x583655 ipa_prop_read_jump_functions()
/usr/src/debug/sys-devel/gcc-9.2.0-r4/gcc-9.2.0/gcc/ipa-prop.c:4565
0xda927f ipa_read_summaries_1
/usr/src/debug/sys-devel/gcc-9.2.0-r4/gcc-9.2.0/gcc/passes.c:2842
0xd79167 read_cgraph_and_symbols
/usr/src/debug/sys-devel/gcc-9.2.0-r4/gcc-9.2.0/gcc/lto/lto.c:2972
0xd79167 lto_main()
/usr/src/debug/sys-devel/gcc-9.2.0-r4/gcc-9.2.0/gcc/lto/lto.c:3387
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
lto-wrapper: fatal error: g++ returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld:
error: lto-wrapper failed
collect2: error: ld returned 1 exit status



$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/9.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/portage/sys-devel/gcc-9.2.0-r4/work/gcc-9.2.0/configure
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/9.2.0
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/9.2.0
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/9.2.0/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/9.2.0/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/include/g++-v9
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/9.2.0/python
--enable-languages=c,c++,d,go,fortran --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --enable-nls --without-included-gettext
--enable-checking=release --with-bugurl=https://bugs.gentoo.org/
--with-pkgversion='Gentoo 9.2.0-r4 p5' --disable-esp --enable-libstdcxx-time
--with-build-config=bootstrap-lto --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --enable-multilib
--with-multilib-list=m32,m64 --disable-altivec --disable-fixed-point
--enable-targets=all --enable-libgomp --disable-libmudflap --disable-libssp
--enable-systemtap --enable-vtable-verify --enable-lto --with-isl
--disable-isl-version-check --enable-default-pie --enable-default-ssp
Thread model: posix
gcc version 9.2.0 (Gentoo 9.2.0-r4 p5)

Reply via email to