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

            Bug ID: 116460
           Summary: ppc64le: LTO ICE during GIMPLE pass: forwprop
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ales.astone at gmail dot com
  Target Milestone: ---

When recompiling https://github.com/esri/lerc on Ubuntu 24.10 with gcc-14 we
hit this LTO error:

during GIMPLE pass: forwprop
Lerc.cpp: In function 'EncodeInternal.constprop':
Lerc.cpp:606:9: internal compiler error: in build2, at tree.cc:5097
  606 | ErrCode Lerc::EncodeInternal(const T* pData, int version, int nDepth,
int nCols, int nRows, int nBands,
      |         ^
0x1074e99f internal_error(char const*, ...)
        ???:0
0x1074ead7 fancy_abort(char const*, int, char const*)
        ???:0
0x10887107 build2(tree_code, tree_node*, tree_node*, tree_node*)
        ???:0
0x10c7a91f gimple_assign_rhs_to_tree(gimple*)
        ???:0
0x10b97bd3 insert_debug_temp_for_var_def(gimple_stmt_iterator*, tree_node*)
        ???:0
0x1098a083 insert_debug_temps_for_defs(gimple_stmt_iterator*)
        ???:0
0x1098979f gsi_remove(gimple_stmt_iterator*, bool)
        ???:0
0x10a793eb simple_dce_from_worklist(bitmap_head*, bitmap_head*)
        ???:0

The command-line options required to trigger the error is: `-g -O3 -flto`. All
three must be enabled.

Steps to reproduce:
```
wget -qO- https://github.com/Esri/lerc/archive/refs/tags/v4.0.0.tar.gz | tar
xvz
cd lerc-4.0.0/src/LercLib
g++ -shared -fPIC -g -O3 -flto *.cpp Lerc1Decode/*.cpp
```

I could reproduce with the gcc-14 packages from Ubuntu 24.10 and Fedora 41.
I couldn't reproduce on any architecture but ppc64le.
It can be reproduced both on a ppc64le machine (qemu-user is good enough), or
by cross-compiling to ppc64le.

Attaching intermediate files.

Reply via email to