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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |100399
   Last reconfirmed|                            |2021-05-03
      Known to fail|                            |11.1.0
             Status|UNCONFIRMED                 |NEW
                 CC|                            |msebor at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed.  The false positive here is the result of trying to avoid other
false positives for unions and not considering that the pointer might point to
space that's larger than that.  Like the false negative in pr100307 comment 2
(AKA pr100325), this would also be prevented by running -Wplacement-new later,
when the program is in SSA form, rather than from the front end.

  if (code == COMPONENT_REF)
    {
      tree ref = TREE_OPERAND (ptr, 0);
      if (TREE_CODE (TREE_TYPE (ref)) == UNION_TYPE)
        /* In accesses through union types consider the entire unions
           rather than just their members.  */
        ostype = 0;


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100399
[Bug 100399] bogus/missing -Wplacement-new

Reply via email to