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

Marc Glisse <glisse at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2016-03-19
     Ever confirmed|0                           |1
           Severity|normal                      |enhancement

--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
It would make the testcase a bit more convincing if you actually used those
pointers. Just taking the address is dead code. For instance, if you try to
read *p, you will get:

  D.2276 = f ();
  D.2276 ={v} {CLOBBER};
  _6 = MEM[(int *)&D.2276];

which we should diagnose in the middle-end (there are a couple PRs about it).
If you just call an unknown function on the pointer:

  D.2264 = f ();
  D.2264 ={v} {CLOBBER};
  fun (&D.2264.a);

(or if you try to write to *p instead of reading) then it looks like the
middle-end cannot do anything, as it lost the information that the memory
location is gone, not just its content, and we could have valid code (running a
destructor, then placement new) that looks the same in gimple. So it does look
like the C++ FE is the only place where we could warn.

Reply via email to