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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |NEW
      Known to work|                            |
           Keywords|                            |diagnostic
   Last reconfirmed|                            |2013-11-19
          Component|regression                  |tree-optimization
             Blocks|                            |24639
         Resolution|DUPLICATE                   |---
     Ever confirmed|0                           |1
      Known to fail|                            |

--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
PR20968 was closed, but this one is still valid in some cases. In particular
this testcase with -Os produces a warning.

int translate(int in);

int main(int argc, char* argv[])
{
  int ret;

  if (argc)
    ret = translate(5);

  if (!argc || !ret)
    ret = 1;

  return ret;
}

The reason is that with -Os, the check "if (!argc || !ret)" is transformed
into:

  # ret_1 = PHI <ret_5(D)(2), [pr19085.c : 8:9] ret_8(3)>
  # .MEM_3 = PHI <.MEM_6(D)(2), .MEM_7(3)>
  [pr19085.c : 10:7] # RANGE [0, 1]
  _9 = argc_4(D) == 0;
  [pr19085.c : 10:16] # RANGE [0, 1]
  _10 = ret_1 == 0;
  [pr19085.c : 10:13] # RANGE [0, 1]
  _11 = _10 | _9;
  [pr19085.c : 10:6] if (_11 != 0)

Reply via email to