This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/77321] [7 Regression] crash in warn_for_memset
- From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 22 Aug 2016 15:20:56 +0000
- Subject: [Bug c++/77321] [7 Regression] crash in warn_for_memset
- Authentication-results: sourceware.org; auth=none
- Auto-submitted: auto-generated
- References: <bug-77321-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77321
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The fix should be just
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -11991,7 +11991,7 @@ warn_for_memset (location_t loc, tree arg0, tree arg2,
if (TREE_CODE (arg0) == ADDR_EXPR)
arg0 = TREE_OPERAND (arg0, 0);
tree type = TREE_TYPE (arg0);
- if (TREE_CODE (type) == ARRAY_TYPE)
+ if (type != NULL_TREE && TREE_CODE (type) == ARRAY_TYPE)
{
tree elt_type = TREE_TYPE (type);
tree domain = TYPE_DOMAIN (type);