public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vsevolod.livinskiy at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/109341] New: [13 Regression] ICE in merge, at ipa-modref-tree.cc:176
Date: Thu, 30 Mar 2023 07:05:23 +0000	[thread overview]
Message-ID: <bug-109341-4@http.gcc.gnu.org/bugzilla/> (raw)

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)

             reply	other threads:[~2023-03-30  7:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-30  7:05 vsevolod.livinskiy at gmail dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-109341-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).