public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/112940] New: ICE: verify_ssa failed: definition in block 4 does not dominate use in block 8 at -O with _BitInt()
@ 2023-12-09 14:22 zsojka at seznam dot cz
  2023-12-09 23:36 ` [Bug tree-optimization/112940] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: zsojka at seznam dot cz @ 2023-12-09 14:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112940
           Summary: ICE: verify_ssa failed: definition in block 4 does not
                    dominate use in block 8 at -O with _BitInt()
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu

Created attachment 56840
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56840&action=edit
reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-gcc -O testcase.c
testcase.c: In function 'foo':
testcase.c:4:1: error: definition in block 4 does not dominate use in block 8
    4 | foo (long x)
      | ^~~
for SSA_NAME: _15 in statement:
_14 = PHI <_10(2), _15(8)>
PHI argument
_15
for PHI node
_14 = PHI <_10(2), _15(8)>
during GIMPLE pass: bitintlower
testcase.c:4:1: internal compiler error: verify_ssa failed
0x175f8bf verify_ssa(bool, bool)
        /repo/gcc-trunk/gcc/tree-ssa.cc:1203
0x13b4355 execute_function_todo
        /repo/gcc-trunk/gcc/passes.cc:2095
0x13b47be execute_todo
        /repo/gcc-trunk/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://gcc.gnu.org/bugs/> for instructions.

$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r14-6356-20231209102837-g36be2a0e91c-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--disable-bootstrap --with-cloog --with-ppl --with-isl
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r14-6356-20231209102837-g36be2a0e91c-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.0 20231209 (experimental) (GCC)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/112940] ICE: verify_ssa failed: definition in block 4 does not dominate use in block 8 at -O with _BitInt()
  2023-12-09 14:22 [Bug tree-optimization/112940] New: ICE: verify_ssa failed: definition in block 4 does not dominate use in block 8 at -O with _BitInt() zsojka at seznam dot cz
@ 2023-12-09 23:36 ` pinskia at gcc dot gnu.org
  2023-12-12 17:58 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-12-09 23:36 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-12-09
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed with r14-6360-gc250ff90989a71 .

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/112940] ICE: verify_ssa failed: definition in block 4 does not dominate use in block 8 at -O with _BitInt()
  2023-12-09 14:22 [Bug tree-optimization/112940] New: ICE: verify_ssa failed: definition in block 4 does not dominate use in block 8 at -O with _BitInt() zsojka at seznam dot cz
  2023-12-09 23:36 ` [Bug tree-optimization/112940] " pinskia at gcc dot gnu.org
@ 2023-12-12 17:58 ` jakub at gcc dot gnu.org
  2023-12-13 10:47 ` cvs-commit at gcc dot gnu.org
  2023-12-13 11:10 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-12-12 17:58 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 56866
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56866&action=edit
gcc14-pr112940.patch

Untested fix.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/112940] ICE: verify_ssa failed: definition in block 4 does not dominate use in block 8 at -O with _BitInt()
  2023-12-09 14:22 [Bug tree-optimization/112940] New: ICE: verify_ssa failed: definition in block 4 does not dominate use in block 8 at -O with _BitInt() zsojka at seznam dot cz
  2023-12-09 23:36 ` [Bug tree-optimization/112940] " pinskia at gcc dot gnu.org
  2023-12-12 17:58 ` jakub at gcc dot gnu.org
@ 2023-12-13 10:47 ` cvs-commit at gcc dot gnu.org
  2023-12-13 11:10 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-13 10:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:07efd5668537892e1c07264455bfd96f1a99a130

commit r14-6487-g07efd5668537892e1c07264455bfd96f1a99a130
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Dec 13 11:36:27 2023 +0100

    lower-bitint: Fix lowering of non-_BitInt to _BitInt cast merged with some
wider cast [PR112940]

    The following testcase ICEs, because a PHI argument from latch edge
    uses a SSA_NAME set only in a conditionally executed block inside of the
    loop.
    This happens when we have some outer cast which lowers its operand several
    times, under some condition with variable index, under different condition
    with some constant index, otherwise something else, and then there is
    an inner cast from non-_BitInt integer (or small/middle one).  Such cast
    in certain conditions is emitted by initializing some SSA_NAMEs in the
    initialization statements before loops (say for casts from <= limb size
    precision by computing a SSA_NAME for the first limb and then extension
    of it for the later limbs) and uses the prepare_data_in_out function
    to create a PHI node.  Such function is passed the value (constant or
    SSA_NAME) to use in the PHI argument from the pre-header edge, but for
    the latch edge it always created a new SSA_NAME and then caller emitted
    in the following 3 spots an extra assignment to set that SSA_NAME to
    whatever value we want from the latch edge.  In all these 3 cases
    the argument from the latch edge is known already before the loop though,
    either constant or SSA_NAME computed in pre-header as well.
    But the need to emit an assignment combined with the handle_operand done
    in a conditional basic block results in the SSA verification failure.

    The following patch fixes it by extending the prpare_data_in_out method,
    so that when the latch edge argument is known before (constant or computed
    in pre-header), we can just use it directly and avoid the extra assignment
    that would normally be hopefully optimized away later to what we now emit
    directly.

    2023-12-13  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/112940
            * gimple-lower-bitint.cc (struct bitint_large_huge): Add another
            argument to prepare_data_in_out method defaulted to NULL_TREE.
            (bitint_large_huge::handle_operand): Pass another argument to
            prepare_data_in_out instead of emitting an assignment to set it.
            (bitint_large_huge::prepare_data_in_out): Add VAL_OUT argument.
            If non-NULL, use it as PHI argument instead of creating a new
            SSA_NAME.
            (bitint_large_huge::handle_cast): Pass rext as another argument
            to 2 prepare_data_in_out calls instead of emitting assignments
            to set them.

            * gcc.dg/bitint-53.c: New test.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/112940] ICE: verify_ssa failed: definition in block 4 does not dominate use in block 8 at -O with _BitInt()
  2023-12-09 14:22 [Bug tree-optimization/112940] New: ICE: verify_ssa failed: definition in block 4 does not dominate use in block 8 at -O with _BitInt() zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2023-12-13 10:47 ` cvs-commit at gcc dot gnu.org
@ 2023-12-13 11:10 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-12-13 11:10 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-12-13 11:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-09 14:22 [Bug tree-optimization/112940] New: ICE: verify_ssa failed: definition in block 4 does not dominate use in block 8 at -O with _BitInt() zsojka at seznam dot cz
2023-12-09 23:36 ` [Bug tree-optimization/112940] " pinskia at gcc dot gnu.org
2023-12-12 17:58 ` jakub at gcc dot gnu.org
2023-12-13 10:47 ` cvs-commit at gcc dot gnu.org
2023-12-13 11:10 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).