From: Ulrich Drepper Date: Wed, 7 Aug 2002 23:06:11 +0000 (+0000) Subject: Add tests for one or both parameters being zero. X-Git-Tag: upstream/2.20~14481 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a2e62fb1bd2a785ec3b4233fde786e2ebd1f42db;p=platform%2Fupstream%2Flinaro-glibc.git Add tests for one or both parameters being zero. --- diff --git a/malloc/tst-calloc.c b/malloc/tst-calloc.c index 94a7bb5..b3594c9 100644 --- a/malloc/tst-calloc.c +++ b/malloc/tst-calloc.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper . @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -91,6 +92,19 @@ random_test (void) } +static void +null_test (void) +{ + /* If the size is 0 the result is implementation defined. Just make + sure the program doesn't crash. */ + calloc (0, 0); + calloc (0, UINT_MAX); + calloc (UINT_MAX, 0); + calloc (0, ~((size_t) 0)); + calloc (~((size_t) 0), 0); +} + + int main (void) { @@ -106,5 +120,7 @@ main (void) random_test (); + null_test (); + return 0; }