re PR c/70852 (ice in warn_for_memset)

PR c/70852
	* c-common.c (warn_for_memset): Check domain before accessing it.

	* gcc.dg/pr70852.c: New test.

From-SVN: r235638
This commit is contained in:
Marek Polacek 2016-04-29 12:39:25 +00:00 committed by Marek Polacek
parent 500ecf4abd
commit 2fff3db89f
4 changed files with 20 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2016-04-29 Marek Polacek <polacek@redhat.com>
PR c/70852
* c-common.c (warn_for_memset): Check domain before accessing it.
2016-04-29 Dominik Vogt <vogt@linux.vnet.ibm.com>
PR/69089

View File

@ -11796,6 +11796,7 @@ warn_for_memset (location_t loc, tree arg0, tree arg2,
tree elt_type = TREE_TYPE (type);
tree domain = TYPE_DOMAIN (type);
if (!integer_onep (TYPE_SIZE_UNIT (elt_type))
&& domain != NULL_TREE
&& TYPE_MAXVAL (domain)
&& TYPE_MINVAL (domain)
&& integer_zerop (TYPE_MINVAL (domain))

View File

@ -3,6 +3,9 @@
PR sanitizer/70342
* g++.dg/ubsan/null-7.C: New test.
PR c/70852
* gcc.dg/pr70852.c: New test.
2016-04-29 Dominik Vogt <vogt@linux.vnet.ibm.com>
PR/69089

View File

@ -0,0 +1,11 @@
/* PR c/70852 */
/* { dg-do compile } */
/* { dg-options "-Wall" } */
extern void *memset (void *, int, __SIZE_TYPE__);
extern int A[];
void
fn1 (void)
{
memset (A, 0, 1);
}