This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/80806] gcc does not warn if local array is memset only


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

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

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

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
The challenge is that the DECL_READ_P flag is set indiscriminately by the front
end (in convert_lvalue_to_rvalue called from c_parser_expr_list while parsing
the argument list in the function call expression) in response to seeing the
array being passed to a function as an argument.  There's no logic that would
take into account the properties of the function is being called.  In general,
GCC also has no notion of "out" only arguments (such as memset's first), or
"in" only (such as memcpy's second).  It may be a useful concept to introduce
in the form of an attribute.  With such an attribute, this issue could then be
detected in for any function whose arguments were decorated with it.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]