public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/103404] ICE: SIGSEGV in insert_with_costs (cse.c:1569) with custom flags
Date: Wed, 24 Nov 2021 10:39:27 +0000	[thread overview]
Message-ID: <bug-103404-4-bN4UUBhXaq@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103404-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Program received signal SIGSEGV, Segmentation fault.
0x00000000028071dc in insert_with_costs (x=0x7ffff6739090, classp=0x0, 
    hash=13, mode=E_SImode, cost=0, reg_cost=1)
    at /home/rguenther/src/gcc3/gcc/cse.c:1569
1569          if (CHEAPER (elt, classp))

where classp is NULL.  The passed in class is

#2  0x00000000028079e7 in merge_equiv_classes (class1=0x40b8700, 
    class2=0x3f0a950) at /home/rguenther/src/gcc3/gcc/cse.c:1756
1756              new_elt = insert (exp, class1, hash, mode);
(gdb) p *class1 
$4 = {exp = 0x7ffff6739090, canon_exp = 0x0, next_same_hash = 0x40b85e0, 
  prev_same_hash = 0x0, next_same_value = 0x0, prev_same_value = 0x0, 
  first_same_value = 0x0, related_value = 0x0, cost = 0, regcost = 1, 
  mode = E_SImode, in_memory = 0 '\000', is_const = 0 '\000', flag = 0 '\000'}

It seems we remove class1 from the table while processing the merge:

#0  remove_from_table (elt=0x40b8700, hash=11)
    at /home/rguenther/src/gcc3/gcc/cse.c:1354
#1  0x0000000002806cc5 in remove_pseudo_from_table (x=0x7ffff6739090, hash=11)
    at /home/rguenther/src/gcc3/gcc/cse.c:1426
#2  0x000000000280792d in merge_equiv_classes (class1=0x40b8700, 
    class2=0x3f0a950) at /home/rguenther/src/gcc3/gcc/cse.c:1747

and note it may even get re-used via the free_element_chain so it might
stay in the table but have a different purpose.  Somebody more familiar
with the equivalence code needs to look at this.  I'd try postponing
remove_pseudo_from_table until after the merge for example.

  parent reply	other threads:[~2021-11-24 10:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-24  9:47 [Bug rtl-optimization/103404] New: " zsojka at seznam dot cz
2021-11-24 10:14 ` [Bug rtl-optimization/103404] " rguenth at gcc dot gnu.org
2021-11-24 10:39 ` rguenth at gcc dot gnu.org [this message]
2021-11-24 10:52 ` marxin at gcc dot gnu.org
2021-11-24 11:27 ` tnfchris at gcc dot gnu.org
2021-11-25  3:07 ` tnfchris at gcc dot gnu.org
2021-12-06 10:16 ` cvs-commit at gcc dot gnu.org
2021-12-06 10:17 ` tnfchris 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-103404-4-bN4UUBhXaq@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).