public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/55025] New: reg_nonzero_bits_for_combine/get_last_value: missing mode check for hardware registers
@ 2012-10-22 16:25 aurelien.buhrig.gcc at gmail dot com
  2012-10-23  9:44 ` [Bug rtl-optimization/55025] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: aurelien.buhrig.gcc at gmail dot com @ 2012-10-22 16:25 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55025

             Bug #: 55025
           Summary: reg_nonzero_bits_for_combine/get_last_value: missing
                    mode check for hardware registers
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: aurelien.buhrig.gcc@gmail.com


Created attachment 28511
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28511
patch

This bug occurs with gcc 4.6.3 for a private backend (big endian), but should
occurs on trunk. The testcase is pr27364.c, compiled with -Os.

In the following RTL, the hardware register (reg:HI r2), whose natural mode is
HImode, is set to 0, but when combining insn 12 and insn 13 insn (during
combine pass), the (reg:SI r2) is computed to be equivalent to
(const_int 0), which is wrong (it is (reg:HI r2) which is (const_int 0)). 

(insn 51 9 52 3 (set (reg:HI 2 r2)
        (const_int 0 [0])) gcc.c-torture/execute/pr27364.c:5 18 {*movhi1}
     (expr_list:REG_DEAD (reg:HI 31)
        (expr_list:REG_EQUAL (const_int 0 [0])
            (nil))))

(insn 52 51 12 3 (set (reg:HI 3 r3 [orig:2+2 ] [2])
        (reg/v:HI 20 [ number_of_digits_to_use ]))
gcc.c-torture/execute/pr27364.c:5 18 {*movhi1}
     (expr_list:REG_DEAD (reg/v:HI 20 [ number_of_digits_to_use ])
        (nil)))

(insn 12 52 13 3 (set (reg:SI 0 r0)
        (const_int 3321928 [0x32b048]))
gcc.c-torture/execute/pr27364.c:5 19 {movsi}
     (nil))

(insn 13 12 16 3 (parallel [
            (set (reg:SI 0 r0)
                (mult:SI (reg:SI 2 r2)
                    (reg:SI 0 r0)))
            (clobber (reg:SI 2 r2))
        ]) gcc.c-torture/execute/pr27364.c:5 54 {*mulsi3_call}
     (expr_list:REG_EQUAL (mult:SI (reg:SI 2 r2)
            (const_int 3321928 [0x32b048]))
        (expr_list:REG_DEAD (reg:HI 3 r3)
            (expr_list:REG_UNUSED (reg:SI 2 r2)
                (nil)))))

The problem comes from a missing mode check in both
reg_nonzero_bits_for_combine and get_last_value.

See http://gcc.gnu.org/ml/gcc/2012-10/msg00263.html for more information.

Note that the problem in get_last_value has already been reported (bug 49884).

The attached patch fixes the issue in gcc-4.6.3. Not yet boostraped on trunk.


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

* [Bug rtl-optimization/55025] reg_nonzero_bits_for_combine/get_last_value: missing mode check for hardware registers
  2012-10-22 16:25 [Bug rtl-optimization/55025] New: reg_nonzero_bits_for_combine/get_last_value: missing mode check for hardware registers aurelien.buhrig.gcc at gmail dot com
@ 2012-10-23  9:44 ` rguenth at gcc dot gnu.org
  2013-11-29 16:07 ` paulo@matos-sorge.com
  2021-08-16 23:42 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-10-23  9:44 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55025

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> 2012-10-23 09:43:43 UTC ---
Please send patches to gcc-patches@gcc.gnu.org


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

* [Bug rtl-optimization/55025] reg_nonzero_bits_for_combine/get_last_value: missing mode check for hardware registers
  2012-10-22 16:25 [Bug rtl-optimization/55025] New: reg_nonzero_bits_for_combine/get_last_value: missing mode check for hardware registers aurelien.buhrig.gcc at gmail dot com
  2012-10-23  9:44 ` [Bug rtl-optimization/55025] " rguenth at gcc dot gnu.org
@ 2013-11-29 16:07 ` paulo@matos-sorge.com
  2021-08-16 23:42 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: paulo@matos-sorge.com @ 2013-11-29 16:07 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55025

Paulo J. Matos <paulo@matos-sorge.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |paulo@matos-sorge.com

--- Comment #2 from Paulo J. Matos <paulo@matos-sorge.com> ---
I think this can be closed. 4.6 is not maintained anymore and this is fixed in
current versions.


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

* [Bug rtl-optimization/55025] reg_nonzero_bits_for_combine/get_last_value: missing mode check for hardware registers
  2012-10-22 16:25 [Bug rtl-optimization/55025] New: reg_nonzero_bits_for_combine/get_last_value: missing mode check for hardware registers aurelien.buhrig.gcc at gmail dot com
  2012-10-23  9:44 ` [Bug rtl-optimization/55025] " rguenth at gcc dot gnu.org
  2013-11-29 16:07 ` paulo@matos-sorge.com
@ 2021-08-16 23:42 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-16 23:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
   Target Milestone|---                         |8.3
           Keywords|                            |wrong-code
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=85805,
                   |                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=71976
      Known to work|                            |8.3.0, 9.1.0
         Resolution|---                         |FIXED

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
reg_nonzero_bits_for_combine was fixed at r9-2022 and got backported to gcc 8.3
by r8-9084.

get_last_value was fixed at r7-2295 and backported to GCC 6.2.0 by r6-8363 and
to gcc 5.5 by r5-9832.

So fully fixed for GCC 8.3.

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

end of thread, other threads:[~2021-08-16 23:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-22 16:25 [Bug rtl-optimization/55025] New: reg_nonzero_bits_for_combine/get_last_value: missing mode check for hardware registers aurelien.buhrig.gcc at gmail dot com
2012-10-23  9:44 ` [Bug rtl-optimization/55025] " rguenth at gcc dot gnu.org
2013-11-29 16:07 ` paulo@matos-sorge.com
2021-08-16 23:42 ` pinskia 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).