public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gjl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/105753] [avr] ICE: in add_clobbers, at config/avr/avr-dimode.md:2705
Date: Thu, 20 Apr 2023 20:40:13 +0000	[thread overview]
Message-ID: <bug-105753-4-mhY3LSJ8oC@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105753-4@http.gcc.gnu.org/bugzilla/>

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

Georg-Johann Lay <gjl at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |rtl-optimization

--- Comment #15 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
The error is in the combine pass.

Prior to combine, we have the followng insn for divmod (from -da init-regs
dump):

(insn 9 7 11 3 (parallel [
            (set (reg:SI 50)
                (udiv:SI (reg/v:SI 47 [ n ])
                    (reg:SI 51)))
            (set (reg:SI 49)
                (umod:SI (reg/v:SI 47 [ n ])
                    (reg:SI 51)))
            (clobber (reg:SI 18 r18))
            (clobber (reg:SI 22 r22))
            (clobber (reg:HI 26 r26))
            (clobber (reg:HI 30 r30))
        ]) "bug.c":6:15 403 {udivmodsi4}
     (expr_list:REG_UNUSED (reg:HI 30 r30)
        (expr_list:REG_UNUSED (reg:HI 26 r26)
            (expr_list:REG_UNUSED (reg:SI 22 r22)
                (expr_list:REG_UNUSED (reg:SI 18 r18)
                    (nil))))))

This basically encodes a transparent libgcc call to __udivmodsi4 (insn
"*udivmodsi4_call").

The combine dump however reads:

(insn 9 7 11 3 (set (reg:SI 49)
        (umod:SI (reg/v:SI 47 [ n ])
            (reg:SI 51))) "bug.c":6:15 403 {udivmodsi4}
     (expr_list:REG_UNUSED (reg:HI 30 r30)
        (expr_list:REG_UNUSED (reg:HI 26 r26)
            (expr_list:REG_UNUSED (reg:SI 22 r22)
                (expr_list:REG_UNUSED (reg:SI 18 r18)
                    (nil))))))
(insn 11 9 14 3 (set (reg/v:SI 45 [ n ])
        (reg/v:SI 47 [ n ])) 119 {*movsi_split}
     (expr_list:REG_DEAD (reg/v:SI 47 [ n ])
        (nil)))
(insn 14 11 15 3 (set (reg/v:SI 47 [ n ])
        (udiv:SI (reg/v:SI 47 [ n ])
            (reg:SI 51))) "bug.c":7:7 119 {*movsi_split}
     (expr_list:REG_DEAD (reg:SI 50)
        (nil)))

These udiv and umod insn do not exist and are unrecognizable.  Combine should
never have split the original udivmodsi4.

I used the original test case from comment #0 with 

$ avr-gcc bug.c -S -O1 -mmcu=atmega8 -da 

where avr-gcc is from 2023-03-03 master (future v13).

With -fdisable-rtl-combine no ICE occurs.

  parent reply	other threads:[~2023-04-20 20:40 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-27 22:35 [Bug target/105753] New: " filip.hejsek at gmail dot com
2022-05-28  2:55 ` [Bug target/105753] " filip.hejsek at gmail dot com
2022-06-04 22:19 ` pinskia at gcc dot gnu.org
2022-06-12 23:41 ` filip.hejsek at gmail dot com
2022-06-12 23:48 ` pinskia at gcc dot gnu.org
2022-09-11 10:19 ` triffid.hunter at gmail dot com
2022-09-25 21:45 ` pinskia at gcc dot gnu.org
2022-10-02  8:06 ` rainer-gcc at wwad dot de
2022-12-09 14:26 ` fiesh at zefix dot tv
2022-12-09 14:31 ` fiesh at zefix dot tv
2023-01-25 18:45 ` user99627 at gmx dot com
2023-01-25 19:39 ` user99627 at gmx dot com
2023-01-31 23:26 ` user99627 at gmx dot com
2023-02-01  7:48 ` fiesh at zefix dot tv
2023-02-01 10:36 ` user99627 at gmx dot com
2023-04-20 19:55 ` gjl at gcc dot gnu.org
2023-04-20 20:40 ` gjl at gcc dot gnu.org [this message]
2023-04-21  7:47 ` [Bug rtl-optimization/105753] " gjl at gcc dot gnu.org
2023-04-21  9:00 ` gjl at gcc dot gnu.org
2023-04-23 10:58 ` gjl at gcc dot gnu.org
2023-05-20  5:53 ` cvs-commit at gcc dot gnu.org
2023-05-20  6:20 ` cvs-commit at gcc dot gnu.org
2023-05-20  6:35 ` cvs-commit at gcc dot gnu.org
2023-05-20  6:46 ` gjl 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-105753-4-mhY3LSJ8oC@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).