public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/34773] fwprop1 bug causing miscompilation of vfprintf_r
  2008-01-13 18:51 [Bug rtl-optimization/34773] New: fwprop1 bug causing miscompilation of vfprintf_r hp at gcc dot gnu dot org
@ 2008-01-13 18:51 ` hp at gcc dot gnu dot org
  2008-01-13 19:20 ` hp at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hp at gcc dot gnu dot org @ 2008-01-13 18:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from hp at gcc dot gnu dot org  2008-01-13 18:35 -------
Created an attachment (id=14935)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14935&action=view)
Preprocessed source corresponding to newlib vfprintf.c

Compile with -O2.


-- 


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


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

* [Bug rtl-optimization/34773]  New: fwprop1 bug causing miscompilation of vfprintf_r
@ 2008-01-13 18:51 hp at gcc dot gnu dot org
  2008-01-13 18:51 ` [Bug rtl-optimization/34773] " hp at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: hp at gcc dot gnu dot org @ 2008-01-13 18:51 UTC (permalink / raw)
  To: gcc-bugs

See attachment vf.i.
The bug manifests in code roughly corresponding to the code snippet:
union double_union
{
  double d;
  __uint32_t i[2];
};
union double_union tmp; tmp.d = value;
 if ((tmp.i[1]) & ((__uint32_t)0x80000000L)) {
  value = -value;
  *sign = '-';
 } else
  *sign = '\000';

As manifested by the 142.fwprop1 dump compared to 141.cse1 dump, fwprop1 has
changed
(note 628 627 630 101 [bb 101] NOTE_INSN_BASIC_BLOCK)
(insn 630 628 632 101 vf.i:1270 (set (reg:SI 277)
        (const_int -2147483648 [0xffffffff80000000])) 38 {*movsi_internal}
(nil))
(insn 632 630 629 101 vf.i:1270 (clobber (reg/v:DF 77 [ __x.739 ])) -1
(insn_list:REG_LIBCALL 631 (nil)))
(insn 629 632 631 101 vf.i:1270 (set (subreg:SI (reg/v:DF 77 [ __x.739 ]) 0)
        (subreg:SI (reg/v:DF 152 [ __x ]) 0)) 38 {*movsi_internal}
(expr_list:REG_NO_CONFLICT (reg/v:DF 152 [ __x ])
        (nil)))
(insn 631 629 633 101 vf.i:1270 (set (subreg:SI (reg/v:DF 77 [ __x.739 ]) 4)
        (xor:SI (subreg:SI (reg/v:DF 152 [ __x ]) 4)
            (reg:SI 277))) 155 {xorsi3} (insn_list:REG_RETVAL 632
(expr_list:REG_NO_CONFLICT (reg/v:DF 152 [ __x ])
            (nil))))

into:
(note 628 627 631 103 [bb 103] NOTE_INSN_BASIC_BLOCK)
(insn 631 628 633 103 vf.i:1270 (set (subreg:SI (reg/v:DF 77 [ __x.739 ]) 4)
        (plus:SI (subreg:SI (reg/v:DF 152 [ __x ]) 4)
            (const_int -2147483648 [0xffffffff80000000]))) 75 {*addsi3_non_v32}
(expr_list:REG_NO_CONFLICT (reg/v:DF 152 [ __x ])
        (nil)))
(insn 633 631 634 103 vf.i:1270 (set (reg/v:QI 161 [ softsign ])
        (const_int 45 [0x2d])) 47 {movqi} (nil))
(code_label 634 633 635 104 86 "" [0 uses])

thereby making the lower part of the mantissa in (reg:DF 77) undefined and the
bug manifestation depending on stack contents.
Trunk of 130734 was used for the dump above.


-- 
           Summary: fwprop1 bug causing miscompilation of vfprintf_r
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: hp at gcc dot gnu dot org
        ReportedBy: hp at gcc dot gnu dot org
GCC target triplet: cris-elf


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


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

* [Bug rtl-optimization/34773] fwprop1 bug causing miscompilation of vfprintf_r
  2008-01-13 18:51 [Bug rtl-optimization/34773] New: fwprop1 bug causing miscompilation of vfprintf_r hp at gcc dot gnu dot org
  2008-01-13 18:51 ` [Bug rtl-optimization/34773] " hp at gcc dot gnu dot org
@ 2008-01-13 19:20 ` hp at gcc dot gnu dot org
  2008-01-13 19:21 ` hp at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hp at gcc dot gnu dot org @ 2008-01-13 19:20 UTC (permalink / raw)
  To: gcc-bugs



-- 

hp at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-01-13 18:50:30
               date|                            |


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


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

* [Bug rtl-optimization/34773] fwprop1 bug causing miscompilation of vfprintf_r
  2008-01-13 18:51 [Bug rtl-optimization/34773] New: fwprop1 bug causing miscompilation of vfprintf_r hp at gcc dot gnu dot org
  2008-01-13 18:51 ` [Bug rtl-optimization/34773] " hp at gcc dot gnu dot org
  2008-01-13 19:20 ` hp at gcc dot gnu dot org
@ 2008-01-13 19:21 ` hp at gcc dot gnu dot org
  2008-01-13 21:07 ` rguenth at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hp at gcc dot gnu dot org @ 2008-01-13 19:21 UTC (permalink / raw)
  To: gcc-bugs



-- 

hp at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2008-01-13 18:50:30         |2008-01-13 18:50:56
               date|                            |


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


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

* [Bug rtl-optimization/34773] fwprop1 bug causing miscompilation of vfprintf_r
  2008-01-13 18:51 [Bug rtl-optimization/34773] New: fwprop1 bug causing miscompilation of vfprintf_r hp at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-01-13 19:21 ` hp at gcc dot gnu dot org
@ 2008-01-13 21:07 ` rguenth at gcc dot gnu dot org
  2008-01-14  9:34 ` hp at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-01-13 21:07 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
            Version|unknown                     |4.3.0


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


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

* [Bug rtl-optimization/34773] fwprop1 bug causing miscompilation of vfprintf_r
  2008-01-13 18:51 [Bug rtl-optimization/34773] New: fwprop1 bug causing miscompilation of vfprintf_r hp at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-01-13 21:07 ` rguenth at gcc dot gnu dot org
@ 2008-01-14  9:34 ` hp at gcc dot gnu dot org
  2008-01-26 22:59 ` [Bug rtl-optimization/34773] [4.3 regression] " hp at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hp at gcc dot gnu dot org @ 2008-01-14  9:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from hp at gcc dot gnu dot org  2008-01-14 08:32 -------
Created an attachment (id=14939)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14939&action=view)
Minimized executable testcase

Compile with -O2


-- 


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


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

* [Bug rtl-optimization/34773] [4.3 regression] miscompilation of vfprintf_r
  2008-01-13 18:51 [Bug rtl-optimization/34773] New: fwprop1 bug causing miscompilation of vfprintf_r hp at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2008-01-14  9:34 ` hp at gcc dot gnu dot org
@ 2008-01-26 22:59 ` hp at gcc dot gnu dot org
  2008-01-29  6:31 ` hp at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hp at gcc dot gnu dot org @ 2008-01-26 22:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from hp at gcc dot gnu dot org  2008-01-26 22:56 -------
I just checked with the gcc-4.2-20080123.tar.bz2 and the bug doesn't manifest
there with the vf.c testcase, so I'm marking this as a regression.
I also no longer think it's fwprop's error (at least not alone); the
into_cfglayout pass (really: try_optimize_cfg(CLEANUP_CFGLAYOUT)) suboptimally
changes an unconditional jump into a fallthrough to a basic block that already
has a fallthrough.  Perhaps that's meant to be cleaned up, but it isn't. 
(Neither the generic nor the cfglayout-specific verify_flow_info code tests
that a basic block has at most one predecessor edge.)


-- 

hp at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|fwprop1 bug causing         |[4.3 regression]
                   |miscompilation of vfprintf_r|miscompilation of vfprintf_r


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


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

* [Bug rtl-optimization/34773] [4.3 regression] miscompilation of vfprintf_r
  2008-01-13 18:51 [Bug rtl-optimization/34773] New: fwprop1 bug causing miscompilation of vfprintf_r hp at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2008-01-26 22:59 ` [Bug rtl-optimization/34773] [4.3 regression] " hp at gcc dot gnu dot org
@ 2008-01-29  6:31 ` hp at gcc dot gnu dot org
  2008-01-31  6:38 ` hp at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hp at gcc dot gnu dot org @ 2008-01-29  6:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from hp at gcc dot gnu dot org  2008-01-29 05:39 -------
I'm learning; first time around this new df and cfglayout stuff.  I haven't
stumbled on anything anywhere actually explicitly saying so, but the "fake"
fallthrough edges are apparently the main part of cfglayout; better to pretend
all bb can fall through wherever they need to go than having unconditional
branches.  It may be that not all parts of gcc agree on this, but I'm now
following the hypothesis that it's not as such the cause of this bug. The wrong
code (the correct code disappears) after the final "cleanup_cfg (0)" call of
fwprop1.
The original title may have been right.


-- 


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


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

* [Bug rtl-optimization/34773] [4.3 regression] miscompilation of vfprintf_r
  2008-01-13 18:51 [Bug rtl-optimization/34773] New: fwprop1 bug causing miscompilation of vfprintf_r hp at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2008-01-29  6:31 ` hp at gcc dot gnu dot org
@ 2008-01-31  6:38 ` hp at gcc dot gnu dot org
  2008-01-31 10:56 ` [Bug rtl-optimization/34773] [4.3 Regression] " rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: hp at gcc dot gnu dot org @ 2008-01-31  6:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from hp at gcc dot gnu dot org  2008-01-31 05:08 -------
The bug is that fwprop1 adds a REG_EQUAL note to an insn with a REG_RETVAL,
confusing delete_trivially_dead_insns into thinking that the REG_EQUAL note
refers to the while libcall and that a simplification thereof can make the
libcall-equivalence sequence redundant.  The combination is described that way
in optabs.c:emit_no_conflict_block, so the assumption appears valid.  Testing a
patch that teaches try_fwprop_subst about this special case. Places in gcse.c
look suspicious too, perhaps also elsewhere.


-- 


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


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

* [Bug rtl-optimization/34773] [4.3 Regression] miscompilation of vfprintf_r
  2008-01-13 18:51 [Bug rtl-optimization/34773] New: fwprop1 bug causing miscompilation of vfprintf_r hp at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2008-01-31  6:38 ` hp at gcc dot gnu dot org
@ 2008-01-31 10:56 ` rguenth at gcc dot gnu dot org
  2008-02-01 21:29 ` hp at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-01-31 10:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2008-01-31 10:40 -------
Regressions should have a target milestone.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.3 regression]            |[4.3 Regression]
                   |miscompilation of vfprintf_r|miscompilation of vfprintf_r
   Target Milestone|---                         |4.3.0


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


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

* [Bug rtl-optimization/34773] [4.3 Regression] miscompilation of vfprintf_r
  2008-01-13 18:51 [Bug rtl-optimization/34773] New: fwprop1 bug causing miscompilation of vfprintf_r hp at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2008-01-31 10:56 ` [Bug rtl-optimization/34773] [4.3 Regression] " rguenth at gcc dot gnu dot org
@ 2008-02-01 21:29 ` hp at gcc dot gnu dot org
  2008-02-01 21:30 ` hp at gcc dot gnu dot org
  2008-02-01 21:31 ` hp at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: hp at gcc dot gnu dot org @ 2008-02-01 21:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from hp at gcc dot gnu dot org  2008-02-01 21:28 -------
Subject: Bug 34773

Author: hp
Date: Fri Feb  1 21:28:06 2008
New Revision: 132052

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132052
Log:
        PR rtl-optimization/34773
        * gcc.target/cris/torture/pr34773.c: New test.

Added:
    trunk/gcc/testsuite/gcc.target/cris/torture/pr34773.c
Modified:
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug rtl-optimization/34773] [4.3 Regression] miscompilation of vfprintf_r
  2008-01-13 18:51 [Bug rtl-optimization/34773] New: fwprop1 bug causing miscompilation of vfprintf_r hp at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2008-02-01 21:29 ` hp at gcc dot gnu dot org
@ 2008-02-01 21:30 ` hp at gcc dot gnu dot org
  2008-02-01 21:31 ` hp at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: hp at gcc dot gnu dot org @ 2008-02-01 21:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from hp at gcc dot gnu dot org  2008-02-01 21:29 -------
Subject: Bug 34773

Author: hp
Date: Fri Feb  1 21:28:46 2008
New Revision: 132053

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132053
Log:
        PR rtl-optimization/34773
        * reg-notes.def (EQUAL): Mention significance of combination of
        REG_EQUAL and REG_RETVAL.
        * fwprop.c (try_fwprop_subst): Don't add REG_EQUAL to an
        insn that has a REG_RETVAL.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fwprop.c
    trunk/gcc/reg-notes.def


-- 


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


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

* [Bug rtl-optimization/34773] [4.3 Regression] miscompilation of vfprintf_r
  2008-01-13 18:51 [Bug rtl-optimization/34773] New: fwprop1 bug causing miscompilation of vfprintf_r hp at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2008-02-01 21:30 ` hp at gcc dot gnu dot org
@ 2008-02-01 21:31 ` hp at gcc dot gnu dot org
  11 siblings, 0 replies; 13+ messages in thread
From: hp at gcc dot gnu dot org @ 2008-02-01 21:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from hp at gcc dot gnu dot org  2008-02-01 21:30 -------
Fixed.


-- 

hp at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2008-02-01 21:31 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-13 18:51 [Bug rtl-optimization/34773] New: fwprop1 bug causing miscompilation of vfprintf_r hp at gcc dot gnu dot org
2008-01-13 18:51 ` [Bug rtl-optimization/34773] " hp at gcc dot gnu dot org
2008-01-13 19:20 ` hp at gcc dot gnu dot org
2008-01-13 19:21 ` hp at gcc dot gnu dot org
2008-01-13 21:07 ` rguenth at gcc dot gnu dot org
2008-01-14  9:34 ` hp at gcc dot gnu dot org
2008-01-26 22:59 ` [Bug rtl-optimization/34773] [4.3 regression] " hp at gcc dot gnu dot org
2008-01-29  6:31 ` hp at gcc dot gnu dot org
2008-01-31  6:38 ` hp at gcc dot gnu dot org
2008-01-31 10:56 ` [Bug rtl-optimization/34773] [4.3 Regression] " rguenth at gcc dot gnu dot org
2008-02-01 21:29 ` hp at gcc dot gnu dot org
2008-02-01 21:30 ` hp at gcc dot gnu dot org
2008-02-01 21:31 ` hp at gcc dot gnu dot 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).