Bug 113135 - [14 regression] ICE when building unrar (error: PHI node with wrong VUSE on edge from BB 46)
Summary: [14 regression] ICE when building unrar (error: PHI node with wrong VUSE on e...
Status: RESOLVED DUPLICATE of bug 113137
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 14.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-25 12:08 UTC by Sam James
Modified: 2024-01-12 15:32 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
unpack.ii.xz (134.65 KB, application/x-xz)
2023-12-25 12:09 UTC, Sam James
Details
reduced.ii (154 bytes, text/plain)
2023-12-25 15:04 UTC, Sam James
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sam James 2023-12-25 12:08:39 UTC
Hit this when building unrar:
```
x86_64-pc-linux-gnu-g++  -O3 -pipe -march=znver2 -fdiagnostics-color=always -fPIC -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DRAR_SMP -DRARDLL -c ../unpack.cpp
In file included from ../unpack.cpp:14:
../unpack30.cpp: In member function ‘bool Unpack::ReadTables30()’:
../unpack30.cpp:628:6: error: PHI node with wrong VUSE on edge from BB 46
  628 | bool Unpack::ReadTables30()
      |      ^~~~~~
.MEM_409 = PHI <.MEM_214(46)>
expected .MEM_200
../unpack30.cpp:628:6: error: multiple virtual PHI nodes in BB 81
.MEM_283 = PHI <.MEM_200(47)>
.MEM_408 = PHI <.MEM_214(47)>
../unpack30.cpp:628:6: error: PHI node with wrong VUSE on edge from BB 81
.MEM_281 = PHI <.MEM_408(81), .MEM_409(86)>
expected .MEM_283
../unpack30.cpp:628:6: error: PHI node with wrong VUSE on edge from BB 14
.MEM_411 = PHI <.MEM_209(14)>
expected .MEM_387
../unpack30.cpp:628:6: error: multiple virtual PHI nodes in BB 91
.MEM_332 = PHI <.MEM_387(15)>
.MEM_410 = PHI <.MEM_209(15)>
../unpack30.cpp:628:6: error: PHI node with wrong VUSE on edge from BB 91
.MEM_334 = PHI <.MEM_410(91), .MEM_411(96)>
expected .MEM_332
during GIMPLE pass: vect
../unpack30.cpp:628:6: internal compiler error: verify_ssa failed
0x55c82dd33df8 verify_ssa(bool, bool)
        /usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/tree-ssa.cc:1203
0x55c82d93f39d execute_function_todo
        /usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/passes.cc:2095
0x55c82d93f830 execute_todo
        /usr/src/debug/sys-devel/gcc-14.0.0.9999/gcc-14.0.0.9999/gcc/passes.cc:2142
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.
make: *** [../makefile:132: unpack.o] Error 1
make: Leaving directory '/var/tmp/portage/app-arch/unrar-6.2.12-r1/work/unrar/build-lib'
 * ERROR: app-arch/unrar-6.2.12-r1::gentoo failed (compile phase):
```

```
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/14/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-14.0.0.9999/work/gcc-14.0.0.9999/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/14 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/14/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14 --disable-silent-rules --disable-dependency-tracking --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/14/python --enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --enable-nls --without-included-gettext --disable-libunwind-exceptions --enable-checking=yes,extra,rtl,df --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 14.0.0 p, commit 2250dc0cc8c46999ad1c1d79b9aeed9056459bb6' --with-gcc-major-version-only --enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-fixed-point --enable-targets=all --enable-libgomp --disable-libssp --disable-libada --disable-cet --disable-systemtap --disable-valgrind-annotations --disable-vtable-verify --disable-libvtv --with-zstd --without-isl --enable-default-pie --enable-host-pie --disable-host-bind-now --enable-default-ssp
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.0 20231225 (experimental) 0beeddd6b1b1cb41104c4df925323e8fc0437ba8 (Gentoo 14.0.0 p, commit 2250dc0cc8c46999ad1c1d79b9aeed9056459bb6)
```
Comment 1 Sam James 2023-12-25 12:09:22 UTC
Created attachment 56932 [details]
unpack.ii.xz
Comment 2 Sam James 2023-12-25 12:10:11 UTC
'g++ -O3 -march=znver2 -c unpack.ii' is enough to repro
Comment 3 Sam James 2023-12-25 15:04:31 UTC
Created attachment 56934 [details]
reduced.ii

Reduced.
Comment 4 Sam James 2023-12-25 15:21:38 UTC
(In reply to Sam James from comment #3)
> Created attachment 56934 [details]
> reduced.ii
> 
> Reduced.

Interestingly, it seems to ICE as C++, not as C.
Comment 5 Tamar Christina 2023-12-26 14:06:52 UTC
dup

*** This bug has been marked as a duplicate of bug 113137 ***
Comment 6 GCC Commits 2024-01-12 15:32:33 UTC
The master branch has been updated by Tamar Christina <tnfchris@gcc.gnu.org>:

https://gcc.gnu.org/g:6cb155a6cf314232248a12bdd395ed4151ae5a28

commit r14-7194-g6cb155a6cf314232248a12bdd395ed4151ae5a28
Author: Tamar Christina <tamar.christina@arm.com>
Date:   Fri Jan 12 15:24:49 2024 +0000

    middle-end: make memory analysis for early break more deterministic [PR113135]
    
    Instead of searching for where to move stores to, they should always be in
    exit belonging to the latch.  We can only ever delay stores and even if we
    pick a different exit than the latch one as the main one, effects still
    happen in program order when vectorized.  If we don't move the stores to the
    latch exit but instead to whever we pick as the "main" exit then we can
    perform incorrect memory accesses (luckily these are trapped by verify_ssa).
    
    We used to iterate over the conds and check the loads and stores inside them.
    However this relies on the conds being ordered in program order.  Additionally
    if there is a basic block between two conds we would not have analyzed it.
    
    Instead this now walks from the preds of the destination basic block up to the
    loop header and analyzes every block along the way.  As a later optimization we
    could stop as soon as we've seen all the BBs we have conds for.  For now the
    header will always contain the first cond, but this can change when we support
    arbitrary control flow.
    
    gcc/ChangeLog:
    
            PR tree-optimization/113135
            * tree-vect-data-refs.cc (vect_analyze_early_break_dependences): Rework
            dependency analysis.
    
    gcc/testsuite/ChangeLog:
    
            PR tree-optimization/113135
            * gcc.dg/vect/vect-early-break_103-pr113135.c: New test.