[Bug c/37822] New: Code deficiency in function fold

wuhui1973 at 21cn dot com gcc-bugzilla@gcc.gnu.org
Tue Oct 14 05:06:00 GMT 2008


in function fold, we can find following code snippet:

5547        else if (TREE_CODE_CLASS (code) == '<'
5548             && TREE_CODE (arg0) == COMPOUND_EXPR)
5549          return build (COMPOUND_EXPR, type, TREE_OPERAND (arg0, 0),
5550                 fold (build (code, type, TREE_OPERAND (arg0, 1), arg1)));
5551        else if (TREE_CODE_CLASS (code) == '<'
5552              && TREE_CODE (arg1) == COMPOUND_EXPR)
5553          return build (COMPOUND_EXPR, type, TREE_OPERAND (arg1, 0),
5554                 fold (build (code, type, arg0, TREE_OPERAND (arg1, 1))));

These lines of code can be removed, as following code fragement covers the
case. And what's more the condition at line 5552 is not correct, the correct
condition should include TREE_OPERAND (arg1, 0) and arg0 without side-effect.
This deficiency is not present v4.3.0


-- 
           Summary: Code deficiency in function fold
           Product: gcc
           Version: 3.4.6
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wuhui1973 at 21cn dot com
 GCC build triplet: linux-i386
  GCC host triplet: linux-i386
GCC target triplet: linux-i386


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



More information about the Gcc-bugs mailing list