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

Reply via email to