This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/39904] [4.3 Regressions] Loop is completely skipped due to wrong types in SCEV const-prop



------- Comment #1 from rguenth at gcc dot gnu dot org  2009-04-26 16:49 -------
SCEV const-prop produces for m

  D.2395_7 = n.11_27 + -2147483648;
  m_19 = D.2395_7 * 2;

which has undefined signed overflow which triggers VRP to deduce wrong
value ranges.

Analyzing # of iterations of loop 1
  exit condition [1, + , 1](no_overflow) < n.11_27
  bounds on difference of bases: 0 ... 2147483646
  result:
    # of iterations (unsigned int) n.11_27 + 4294967295, bounded by 2147483646
  (set_nb_iterations_in_loop = (unsigned int) n.11_27 + 4294967295))
(chrec_apply
  (varying_loop = 1
)
  (chrec = {2, +, 2}_1)
  (x = (int) ((unsigned int) n.11_27 + 4294967295))
  (res = (n.11_27 + -2147483648) * 2))

4.4 instead uses correct types:

Analyzing # of iterations of loop 1
  exit condition [1, + , 1](no_overflow) < n.11_28
  bounds on difference of bases: 0 ... 2147483646
  result:
    # of iterations (unsigned int) n.11_28 + 0x0ffffffff, bounded by 2147483646
  (set_nb_iterations_in_loop = (unsigned int) n.11_28 + 0x0ffffffff))
(chrec_apply
  (varying_loop = 1
)
  (chrec = {2, +, 2}_1)
  (x = (int) ((unsigned int) n.11_28 + 0x0ffffffff))
  (res = (int) ((unsigned int) n.11_28 * 2)))


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-code
      Known to fail|                            |4.3.3
      Known to work|                            |4.2.4 4.4.0
   Last reconfirmed|0000-00-00 00:00:00         |2009-04-26 16:49:41
               date|                            |
            Summary|Loop is completely skipped  |[4.3 Regressions] Loop is
                   |                            |completely skipped due to
                   |                            |wrong types in SCEV const-
                   |                            |prop
   Target Milestone|---                         |4.3.4


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]