https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101042

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-06-15
           Keywords|                            |missed-optimization
                 CC|                            |msebor at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
printf being treated as a possible clobber is one problem.  Another is GCC not
implementing the same optimization for calloc as for malloc/bzero (I opened PR 
101074 to track that separately).  The warning disappears when the printf call
is removed and then reappears when the second assert (assert(field->type ==
FIELD.type);) is removed.

Other than that, the warning is based on the IL below:

  <bb 7> [local count: 548457796]:
<L6>:
  _3 = field_7->D.3115.string;
  _4 = strcmp (_3, 1B);
  if (_4 == 0)
    goto <bb 9>; [99.96%]
  else
    goto <bb 8>; [0.04%]

The integer constant in the call to strcmp() is not a valid pointer (PR 99578
comment 1 explains the rationale).
  • ... ypsah+6a11ea7d-369c-4db1-b3f4-60ced987a559 at devyard dot org via Gcc-bugs
    • ... pinskia at gcc dot gnu.org via Gcc-bugs
    • ... msebor at gcc dot gnu.org via Gcc-bugs

Reply via email to