public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/109341] New: [13 Regression] ICE in merge, at ipa-modref-tree.cc:176
@ 2023-03-30  7:05 vsevolod.livinskiy at gmail dot com
  2023-03-30  7:24 ` [Bug ipa/109341] [12/13 " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: vsevolod.livinskiy at gmail dot com @ 2023-03-30  7:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109341
           Summary: [13 Regression] ICE in merge, at
                    ipa-modref-tree.cc:176
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vsevolod.livinskiy at gmail dot com
  Target Milestone: ---

Link to the Compiler Explorer: https://godbolt.org/z/9zY57K3Yh

GCC also warns about UB, but I think it is incorrect. The code is well-defined
if "h" is equal to "1".

Reproducer:
unsigned c;
int e, f;
void g(long h, long j[][9]) {
  for (long d = 1; d; d += -(h ?: 600000000000000000)) {
    {
      int a = j[d][d];
      f = h ?: a;
    }
    int i = f;
    {
      int a = c, b = i;
      e = b ?: a;
    }
    c = e;
  }
}

Error:
>$ g++ -O3 -c func.cpp
func.cpp: In function 'void g(long int, long int (*)[9])':
func.cpp:6:18: warning: iteration 7 invokes undefined behavior
[-Waggressive-loop-optimizations]
    6 |       int a = j[d][d];
      |                  ^
func.cpp:4:20: note: within this loop
    4 |   for (long d = 1; d; d += -(h ?: 600000000000000000)) {
      |                    ^
during GIMPLE pass: modref
func.cpp:3:6: internal compiler error: in merge, at ipa-modref-tree.cc:176
    3 | void g(long h, long j[][9]) {
      |      ^
0x84f1a9 modref_access_node::merge(modref_access_node const&, bool)
        /testing/gcc/gcc_src_master/gcc/ipa-modref-tree.cc:176
0x10147cc modref_access_node::try_merge_with(vec<modref_access_node, va_gc,
vl_embed>*&, unsigned long)
        /testing/gcc/gcc_src_master/gcc/ipa-modref-tree.cc:457
0x1016562 modref_access_node::insert(vec<modref_access_node, va_gc,
vl_embed>*&, modref_access_node, unsigned long, bool)
        /testing/gcc/gcc_src_master/gcc/ipa-modref-tree.cc:562
0x101220b modref_ref_node<int>::insert_access(modref_access_node, unsigned
long, bool)
        /testing/gcc/gcc_src_master/gcc/ipa-modref-tree.h:194
0x101220b modref_tree<int>::insert(unsigned int, unsigned int, unsigned int,
int, int, modref_access_node, bool)
        /testing/gcc/gcc_src_master/gcc/ipa-modref-tree.h:444
0x1004eac modref_tree<int>::insert(tree_node*, int, int, modref_access_node
const&, bool)
        /testing/gcc/gcc_src_master/gcc/ipa-modref-tree.h:471
0x1004eac record_access
        /testing/gcc/gcc_src_master/gcc/ipa-modref.cc:1076
0x1005958 analyze_load
        /testing/gcc/gcc_src_master/gcc/ipa-modref.cc:1707
0xf57cb4 walk_stmt_load_store_addr_ops(gimple*, void*, bool (*)(gimple*,
tree_node*, tree_node*, void*), bool (*)(gimple*, tree_node*, tree_node*,
void*), bool (*)(gimple*, tree_node*, tree_node*, void*))
        /testing/gcc/gcc_src_master/gcc/gimple-walk.cc:813
0x100ba01 analyze_stmt
        /testing/gcc/gcc_src_master/gcc/ipa-modref.cc:1788
0x100d1e9 analyze
        /testing/gcc/gcc_src_master/gcc/ipa-modref.cc:1900
0x100d1e9 analyze_function
        /testing/gcc/gcc_src_master/gcc/ipa-modref.cc:3220
0x100ecae execute
        /testing/gcc/gcc_src_master/gcc/ipa-modref.cc:4187

gcc version 13.0.1 20230329 (3be4e43a6a0f429648ea188c8e110b74268fed27)

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

* [Bug ipa/109341] [12/13 Regression] ICE in merge, at ipa-modref-tree.cc:176
  2023-03-30  7:05 [Bug tree-optimization/109341] New: [13 Regression] ICE in merge, at ipa-modref-tree.cc:176 vsevolod.livinskiy at gmail dot com
@ 2023-03-30  7:24 ` rguenth at gcc dot gnu.org
  2023-03-30  7:42 ` [Bug ipa/109341] [12/13 Regression] ICE in merge, at ipa-modref-tree.cc:176 since r12-3142-g5c85f29537662f marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-03-30  7:24 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |11.3.1
   Last reconfirmed|                            |2023-03-30
           Keywords|                            |ice-checking,
                   |                            |needs-bisection
          Component|tree-optimization           |ipa
           Priority|P3                          |P2
     Ever confirmed|0                           |1
      Known to fail|                            |12.2.1, 13.0
             Status|UNCONFIRMED                 |NEW
            Summary|[13 Regression] ICE in      |[12/13 Regression] ICE in
                   |merge, at                   |merge, at
                   |ipa-modref-tree.cc:176      |ipa-modref-tree.cc:176
                 CC|                            |hubicka at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
   Target Milestone|---                         |12.3

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed, also ICEs on the 12 branch.

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

* [Bug ipa/109341] [12/13 Regression] ICE in merge, at ipa-modref-tree.cc:176 since r12-3142-g5c85f29537662f
  2023-03-30  7:05 [Bug tree-optimization/109341] New: [13 Regression] ICE in merge, at ipa-modref-tree.cc:176 vsevolod.livinskiy at gmail dot com
  2023-03-30  7:24 ` [Bug ipa/109341] [12/13 " rguenth at gcc dot gnu.org
@ 2023-03-30  7:42 ` marxin at gcc dot gnu.org
  2023-03-30 10:25 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-03-30  7:42 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|needs-bisection             |
            Summary|[12/13 Regression] ICE in   |[12/13 Regression] ICE in
                   |merge, at                   |merge, at
                   |ipa-modref-tree.cc:176      |ipa-modref-tree.cc:176
                   |                            |since
                   |                            |r12-3142-g5c85f29537662f

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r12-3142-g5c85f29537662f.

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

* [Bug ipa/109341] [12/13 Regression] ICE in merge, at ipa-modref-tree.cc:176 since r12-3142-g5c85f29537662f
  2023-03-30  7:05 [Bug tree-optimization/109341] New: [13 Regression] ICE in merge, at ipa-modref-tree.cc:176 vsevolod.livinskiy at gmail dot com
  2023-03-30  7:24 ` [Bug ipa/109341] [12/13 " rguenth at gcc dot gnu.org
  2023-03-30  7:42 ` [Bug ipa/109341] [12/13 Regression] ICE in merge, at ipa-modref-tree.cc:176 since r12-3142-g5c85f29537662f marxin at gcc dot gnu.org
@ 2023-03-30 10:25 ` jakub at gcc dot gnu.org
  2023-03-30 11:10 ` hubicka at gcc dot gnu.org
  2023-05-08 12:26 ` [Bug ipa/109341] [12/13/14 " rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-03-30 10:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The warning is because we unswitch the loop, so we have a separate loop for h
!= 0 and separate loop for h == 0.  And the latter obviously invokes undefined
behavior (though I get it for iteration 3 rather than 7).

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

* [Bug ipa/109341] [12/13 Regression] ICE in merge, at ipa-modref-tree.cc:176 since r12-3142-g5c85f29537662f
  2023-03-30  7:05 [Bug tree-optimization/109341] New: [13 Regression] ICE in merge, at ipa-modref-tree.cc:176 vsevolod.livinskiy at gmail dot com
                   ` (2 preceding siblings ...)
  2023-03-30 10:25 ` jakub at gcc dot gnu.org
@ 2023-03-30 11:10 ` hubicka at gcc dot gnu.org
  2023-05-08 12:26 ` [Bug ipa/109341] [12/13/14 " rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: hubicka at gcc dot gnu.org @ 2023-03-30 11:10 UTC (permalink / raw)
  To: gcc-bugs

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

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

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

--- Comment #4 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
mine.

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

* [Bug ipa/109341] [12/13/14 Regression] ICE in merge, at ipa-modref-tree.cc:176 since r12-3142-g5c85f29537662f
  2023-03-30  7:05 [Bug tree-optimization/109341] New: [13 Regression] ICE in merge, at ipa-modref-tree.cc:176 vsevolod.livinskiy at gmail dot com
                   ` (3 preceding siblings ...)
  2023-03-30 11:10 ` hubicka at gcc dot gnu.org
@ 2023-05-08 12:26 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-05-08 12:26 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|12.3                        |12.4

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 12.3 is being released, retargeting bugs to GCC 12.4.

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

end of thread, other threads:[~2023-05-08 12:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-30  7:05 [Bug tree-optimization/109341] New: [13 Regression] ICE in merge, at ipa-modref-tree.cc:176 vsevolod.livinskiy at gmail dot com
2023-03-30  7:24 ` [Bug ipa/109341] [12/13 " rguenth at gcc dot gnu.org
2023-03-30  7:42 ` [Bug ipa/109341] [12/13 Regression] ICE in merge, at ipa-modref-tree.cc:176 since r12-3142-g5c85f29537662f marxin at gcc dot gnu.org
2023-03-30 10:25 ` jakub at gcc dot gnu.org
2023-03-30 11:10 ` hubicka at gcc dot gnu.org
2023-05-08 12:26 ` [Bug ipa/109341] [12/13/14 " rguenth 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).