http://d.puremagic.com/issues/show_bug.cgi?id=5540

           Summary: Probable bug-hiding redundancies
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: bearophile_h...@eml.cc


--- Comment #0 from bearophile_h...@eml.cc 2011-02-07 12:33:29 PST ---
This is a real bug in good C++ code:

if ((p_newHeader.frame_num != m_lastSlice.frame_num) ||
    (p_newHeader.pic_parameter_set_id !=
     p_newHeader.pic_parameter_set_id) ||
    (p_newHeader.field_pic_flag != p_newHeader.field_pic_flag) ||
    (p_newHeader.bottom_field_flag != m_lastSlice.bottom_field_flag)
    ){
    return false;
}


The bug is of the kind:
if (x != x) {}

Two other similar bugs:
if (x == x) {}

auto y = x - x;


For the compiler it's easy to spot such three situations. They are correct
code, yet experience shows that often such redundancies hide bugs. So I suggest
to add to DMD warnings for such tree situations.

See also bug 3878

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to