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

            Bug ID: 122956
           Summary: [GCC16 regression] ICE caused by r16-4000 when
                    building LLVM14 with -Ofast -flto=auto
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: liuhongt at gcc dot gnu.org
  Target Milestone: ---

When building a private llvm based on LLVM14, GCC16 issued an ICE as below,
it's difficult to exract a testcase, I've bisected it r16-4000, @honza any
ideas based on backtrace?

the option I use is -Ofast -flto=auto

In function 'make_unique',
    inlined from 'allocateScheduleDataChunks' at
lib/Transforms/Vectorize/SLPVectorizer.cpp:7370:66:
/home/liuhongt/install_bisect/include/c++/16.0.0/bits/unique_ptr.h:1101:30:
warning: argument 1 value '18446744073709551615' exceeds maximum object size
9223372036854775807 [-Walloc-size-larger-than=]
 1101 |     { return unique_ptr<_Tp>(new remove_extent_t<_Tp>[__num]()); }
      |                              ^
/home/liuhongt/install_bisect/include/c++/16.0.0/new: In member function
'allocateScheduleDataChunks':
/home/liuhongt/install_bisect/include/c++/16.0.0/new:158:26: note: in a call to
allocation function 'operator new []' declared here
  158 | _GLIBCXX_NODISCARD void* operator new[](std::size_t)
      |                          ^
In function 'deallocate_buffer',
    inlined from 'deallocateBuckets' at include/llvm/ADT/DenseMap.h:1176:22,
    inlined from '__dt_base ' at include/llvm/ADT/DenseMap.h:933:22,
    inlined from 'markAliveBlocks' at lib/Transforms/Utils/Local.cpp:2419:5,
    inlined from 'removeUnreachableBlocks.constprop' at
lib/Transforms/Utils/Local.cpp:2471:33:
lib/Support/MemAlloc.cpp:25:20: warning: 'operator delete' called on a pointer
to an unallocated object '-4096B' [-Wfree-nonheap-object]
   25 |   ::operator delete(Ptr
      |                    ^
In member function 'enumeratePasses',
    inlined from 'initialize' at include/llvm/IR/LegacyPassNameParser.h:51:20,
    inlined from 'done' at include/llvm/Support/CommandLine.h:1686:22,
    inlined from '__ct ' at include/llvm/Support/CommandLine.h:1707:9,
    inlined from '__static_initialization_and_destruction_0' at
tools/opt/opt.cpp:70:73:
lib/IR/Pass.cpp:211:49: error: missing indirect call in speculative call
sequence
  211 |   PassRegistry::getPassRegistry()->enumerateWith(this);
      |                                                 ^
lib/IR/Pass.cpp:211:49: error: missing indirect call in speculative call
sequence
_ZN4llvm12PassRegistry13enumerateWithEPNS_24PassRegistrationListenerE.constprop.1/2521
(enumerateWith.constprop)
  Type: function definition analyzed
  Visibility: artificial
  References:
_ZN12_GLOBAL__N_116GetCFGOnlyPasses13passEnumerateEPKN4llvm8PassInfoE.lto_priv.0/2523
(addr) (speculative) _ZL8PassList/1640 (read) _ZL8PassList/1640 (addr)
__gxx_personality_v0/484 (addr) 
  Referring: 
  Read from file: /tmp/cchQbZtt.ltrans511.o
  Function enumerateWith.constprop/2521 is inline copy in
__static_initialization_and_destruction_0/2420
  Availability: local
  Unit id: 217
  Function flags: count:1073741824 (estimated locally) body local
only_called_at_startup executed_once
  Called by: _Z41__static_initialization_and_destruction_0v.lto_priv.341/2420
(inlined) (1073741824 (estimated locally),1.00 per call) 
  Calls: _ZN4llvm3sys12SmartRWMutexILb1EE11lock_sharedEv.isra.0/2526 (inlined)
(1073741824 (estimated locally),1.00 per call) (can throw external)
_ZN4llvm12DenseMapBaseINS_8DenseMapIPKvPKNS_8PassInfoENS_12DenseMapInfoIS3_vEENS_6detail12DenseMapPairIS3_S6_EEEES3_S6_S8_SB_E5beginEv/2531
(inlined) (1073741824 (estimated locally),1.00 per call)
_ZN4llvm12DenseMapBaseINS_8DenseMapIPKvPKNS_8PassInfoENS_12DenseMapInfoIS3_vEENS_6detail12DenseMapPairIS3_S6_EEEES3_S6_S8_SB_E3endEv/2541
(inlined) (1073741824 (estimated locally),1.00 per call)
_ZN4llvm3sys12SmartRWMutexILb1EE13unlock_sharedEv.isra.0/2545 (inlined)
(1073741824 (estimated locally),1.00 per call) (can throw external)
_ZN4llvm3sys12SmartRWMutexILb1EE13unlock_sharedEv.isra.0/2544 (0 (precise),0.00
per call) (can throw external)
_ZN4llvm14PassNameParser13passEnumerateEPKNS_8PassInfoE.constprop.0/2548
(inlined) (6602535974 (estimated locally),6.15 per call)
_ZN12_GLOBAL__N_116GetCFGOnlyPasses13passEnumerateEPKN4llvm8PassInfoE.lto_priv.0/2549
(speculative) (inlined) (2085011374 (estimated locally),1.94 per call) (can
throw external) 
during IPA pass: inline
lib/IR/Pass.cpp:211:49: internal compiler error: verify_cgraph_node failed
0x2b3cbcb internal_error(char const*, ...)
        /home/liuhongt/gcc/bisect/gcc/diagnostic-global-context.cc:786
0xf2d678 cgraph_node::verify_node()
        /home/liuhongt/gcc/bisect/gcc/cgraph.cc:4161
0xf1b034 symtab_node::verify()
        /home/liuhongt/gcc/bisect/gcc/symtab.cc:1368
0x1582e8a expand_call_inline
        /home/liuhongt/gcc/bisect/gcc/tree-inline.cc:4976
0x1585c01 gimple_expand_calls_inline
        /home/liuhongt/gcc/bisect/gcc/tree-inline.cc:5438
0x1585c01 optimize_inline_calls(tree_node*)
        /home/liuhongt/gcc/bisect/gcc/tree-inline.cc:5628
0x1203053 inline_transform(cgraph_node*)
        /home/liuhongt/gcc/bisect/gcc/ipa-inline-transform.cc:825
0x139ae7e execute_one_ipa_transform_pass
        /home/liuhongt/gcc/bisect/gcc/passes.cc:2333
0x139ae7e execute_all_ipa_transforms(bool)
        /home/liuhongt/gcc/bisect/gcc/passes.cc:2397
0xf32340 cgraph_node::expand()
        /home/liuhongt/gcc/bisect/gcc/cgraphunit.cc:1852
0xf32340 cgraph_node::expand()
        /home/liuhongt/gcc/bisect/gcc/cgraphunit.cc:1812
0xf337f1 expand_all_functions
        /home/liuhongt/gcc/bisect/gcc/cgraphunit.cc:2042
0xf337f1 symbol_table::compile()
        /home/liuhongt/gcc/bisect/gcc/cgraphunit.cc:2419
0xe6c594 lto_main()
        /home/liuhongt/gcc/bisect/gcc/lto/lto.cc:693
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
make[1]: *** [/tmp/cc7oOLfR.mk:1024: /tmp/cchQbZtt.ltrans511.ltrans.o] Error 1
make[1]: *** Waiting for unfinished jobs....
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.

Reply via email to