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

            Bug ID: 127826
           Summary: ICE: verify_cgraph_node failed (error: invalid
                    calls_comdat_local flag) with -O1 (not -O0 or -O2)
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: parona at protonmail dot com
  Target Milestone: ---

Encountered while building qtwebengine-6.140 with -O1. No ICE with -O0, -O2 or
with gcc-16.

Extracted reproducer:

$ cat qtwebengine-ice.ii 
enum {} memory_order_relaxed;
void load();
enum GrAAType { kCoverage };
static void skgpu_init_static_unique_key_once(int *) {}
struct {
  template <typename Fn, typename... Args>
  void operator()(Fn fn, Args... args) {
    load();
    if (memory_order_relaxed)
      fn(args...);
  }
} gStrokeRRectOnlyIndexBufferKey_once;
struct GrMeshDrawOp {
  GrMeshDrawOp(int);
  virtual void onPrepareDraws(int *);
};
struct GrSimpleMeshDrawOpHelper {
  GrSimpleMeshDrawOpHelper(int *, GrAAType);
};
int onPrepareDraws_gStrokeRRectOnlyIndexBufferKey_storage,
    EllipticalRRectOp_processorSet;
struct EllipticalRRectOp : GrMeshDrawOp {
  EllipticalRRectOp(float, bool)
      : GrMeshDrawOp(0), fHelper(&EllipticalRRectOp_processorSet, kCoverage) {}
  void onPrepareDraws(int *) {
    gStrokeRRectOnlyIndexBufferKey_once(
        skgpu_init_static_unique_key_once,
        &onPrepareDraws_gStrokeRRectOnlyIndexBufferKey_storage);
  }
  GrSimpleMeshDrawOpHelper fHelper;
};
bool make_rrect_op_isStrokeOnly;
float make_rrect_op_yRadius;
void make_rrect_op() {
  EllipticalRRectOp(make_rrect_op_yRadius, make_rrect_op_isStrokeOnly);
}

Crashing:

$ g++-17 -r -nostdlib -O1 -x c++ qtwebengine-ice.ii 
qtwebengine-ice.ii: In member function ‘virtual void
EllipticalRRectOp::onPrepareDraws(int*)’:
qtwebengine-ice.ii:25:8: error: invalid calls_comdat_local flag
   25 |   void onPrepareDraws(int *) {
      |        ^~~~~~~~~~~~~~
_ZN17EllipticalRRectOp14onPrepareDrawsEPi/9 (virtual void
EllipticalRRectOp::onPrepareDraws(int*))
  Type: function definition analyzed
  Visibility: externally_visible semantic_interposition public weak comdat
comdat_group:_ZN17EllipticalRRectOp14onPrepareDrawsEPi one_only virtual
  Same comdat group as: _ZL33skgpu_init_static_unique_key_oncePi/2
  Address is taken.
  References: 
  Referring: _ZTV17EllipticalRRectOp/14 (addr) 
  Availability: available
  Function flags: count:1073741824 (estimated locally) body
  Called by: 
  Calls: _ZL33skgpu_init_static_unique_key_oncePi/2 (536870912 (estimated
locally),0.50 per call) (can throw external) _Z4loadv/20 (1073741824 (estimated
locally),1.00 per call) (can throw external) 
during IPA pass: inline
qtwebengine-ice.ii:25:8: internal compiler error: verify_cgraph_node failed
0x5573fab8cc6b internal_error(char const*, ...)
       
/usr/src/debug/sys-devel/gcc-17.0.0_p20261004/gcc-17-20261004/gcc/diagnostic-global-context.cc:787
0x5573f9241c3a cgraph_node::verify_node()
       
/usr/src/debug/sys-devel/gcc-17.0.0_p20261004/gcc-17-20261004/gcc/cgraph.cc:4505
0x5573fad65d63 symtab_node::verify()
       
/usr/src/debug/sys-devel/gcc-17.0.0_p20261004/gcc-17-20261004/gcc/symtab.cc:1377
0x5573fb0e9dbb optimize_inline_calls(tree_node*)
       
/usr/src/debug/sys-devel/gcc-17.0.0_p20261004/gcc-17-20261004/gcc/tree-inline.cc:5679
0x5573fb0aae8f inline_transform(cgraph_node*)
       
/usr/src/debug/sys-devel/gcc-17.0.0_p20261004/gcc-17-20261004/gcc/ipa-inline-transform.cc:871
0x5573fb0a5801 execute_one_ipa_transform_pass
       
/usr/src/debug/sys-devel/gcc-17.0.0_p20261004/gcc-17-20261004/gcc/passes.cc:2327
0x5573fb0a5801 execute_all_ipa_transforms(bool)
       
/usr/src/debug/sys-devel/gcc-17.0.0_p20261004/gcc-17-20261004/gcc/passes.cc:2390
0x5573fae2b484 cgraph_node::expand()
       
/usr/src/debug/sys-devel/gcc-17.0.0_p20261004/gcc-17-20261004/gcc/cgraphunit.cc:1866
0x5573fad3baf8 expand_all_functions
       
/usr/src/debug/sys-devel/gcc-17.0.0_p20261004/gcc-17-20261004/gcc/cgraphunit.cc:2056
0x5573fad3baf8 symbol_table::compile()
       
/usr/src/debug/sys-devel/gcc-17.0.0_p20261004/gcc-17-20261004/gcc/cgraphunit.cc:2434
0x5573fba29b06 symbol_table::finalize_compilation_unit()
       
/usr/src/debug/sys-devel/gcc-17.0.0_p20261004/gcc-17-20261004/gcc/cgraphunit.cc:2625
/usr/libexec/gcc/x86_64-pc-linux-gnu/17/cc1plus -quiet -D_GNU_SOURCE
qtwebengine-ice.ii -quiet -dumpdir a- -dumpbase qtwebengine-ice.ii
-dumpbase-ext .ii -mtune=generic -march=x86-64 -mtls-dialect=gnu2 -O1
-fno-stack-protector -foffload-options=-fno-stack-protector -fcf-protection
-foffload-options=-fcf-protection=none -o /tmp/ccMQEWPi.s
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.

$ g++-17 -v
Using built-in specs.
COLLECT_GCC=g++-17
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/17/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-17.0.0_p20261004/work/gcc-17-20261004/configure
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
--bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/17
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/17/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/17
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/17/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/17/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/17/include/g++-v17
--disable-silent-rules --disable-dependency-tracking
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/17/python
--enable-libphobos
--enable-languages=c,c++,d,objc,obj-c++,fortran,ada,algol68,jit
--enable-obsolete --enable-secureplt --disable-werror --with-system-zlib
--enable-nls --without-included-gettext --disable-libunwind-exceptions
--enable-checking=yes,extra --with-bugurl=https://bugs.gentoo.org/
--with-pkgversion='Gentoo 17.0.0_p20261004 p14' --with-gcc-major-version-only
--enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch
--enable-linker-build-id --enable-libada --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --with-tls=gnu2 --enable-multilib
--with-multilib-list=m32,m64 --disable-fixed-point --enable-targets=all
--enable-offload-defaulted --enable-offload-targets=nvptx-none --enable-libgomp
--disable-libssp --enable-cet --disable-systemtap
--disable-valgrind-annotations --disable-valgrind-interop
--disable-vtable-verify --disable-libvtv --with-zstd --without-isl
--enable-default-pie --enable-host-pie --enable-host-bind-now
--enable-default-ssp --disable-fixincludes
--with-gxx-libcxx-include-dir=/usr/include/c++/v1 --enable-host-shared
--enable-linker-build-id --enable-linker-build-id --enable-linker-build-id
--enable-linker-build-id --with-build-config='bootstrap-O3 bootstrap-lto
bootstrap-cet'
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 17.0.0 20261004 (experimental) (Gentoo 17.0.0_p20261004 p14)

Reply via email to