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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org
           Severity|normal                      |enhancement

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Here's how I think this enhancement could work.  For every access to the first
element of an array via the -> operator the warning would look for a pointer
with a similar name that either a) points to the first element of the same
array object, or b) has the same type as the array, and trigger if it found a
match.  (a) requires data flow analysis so the warning would have be
implemented in the middle-end.  I don't think the middle-end has access to the
algorithm that compares names for similarity so it would have to move.  (b)
could be implemented in the C/C++ front ends which do have access to the
algorithm but not to data flow analysis, so the warning there would be quite
simplistic (basically limited to type and name matching) and could be prone to
false positives.

I'm not sure how often this problem comes up but given the complexities above I
suspect the RoI may not be there.

Reply via email to