From 6c353d1329c3ad6be0970cd26b114ef030ee864d Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Fri, 5 Jun 2020 13:28:01 -0400 Subject: [PATCH 203/293] FIXME: fix zlib-4.c --- gcc/testsuite/gcc.dg/analyzer/zlib-4.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gcc/testsuite/gcc.dg/analyzer/zlib-4.c b/gcc/testsuite/gcc.dg/analyzer/zlib-4.c index 08261442128..b1fe76c2408 100644 --- a/gcc/testsuite/gcc.dg/analyzer/zlib-4.c +++ b/gcc/testsuite/gcc.dg/analyzer/zlib-4.c @@ -7,14 +7,17 @@ typedef unsigned long uLong; #define Z_NULL 0 -void test () +int test () { uLong comprLen = 10000*sizeof(int); uLong uncomprLen = comprLen; Byte *compr = (Byte*)calloc((uInt)comprLen, 1); Byte *uncompr = (Byte*)calloc((uInt)uncomprLen, 1); - if (compr == Z_NULL || uncompr == Z_NULL) - exit (1); + if (compr == Z_NULL || uncompr == Z_NULL) /* { dg-warning "leak of 'uncompr'" "uncompr leak" } */ + /* { dg-warning "leak of 'compr'" "compr leak" { target *-*-* } .-1 } */ + { + return 1; + } strcpy((char*)uncompr, "garbage"); - exit (0); + return 0; /* { dg-warning "leak of 'uncompr'" } */ } -- 2.26.2