@@ -35,25 +35,20 @@ merror (const char *msg)
static int
do_test (void)
{
+ /* Use volatile for compiler barriers, to avoid
+ Walloc-size-larger-than warnings. */
+ volatile unsigned long int pagesize = getpagesize ();
+ volatile int minus1 = -1;
void *p;
- unsigned long pagesize = getpagesize ();
- unsigned long ptrval;
+ unsigned long int ptrval;
int save;
errno = 0;
DIAG_PUSH_NEEDS_COMMENT;
-#if __GNUC_PREREQ (7, 0)
- /* GCC 7 warns about too-large allocations; here we want to test
- that they fail. */
- DIAG_IGNORE_NEEDS_COMMENT (7, "-Walloc-size-larger-than=");
-#endif
/* An attempt to allocate a huge value should return NULL and set
errno to ENOMEM. */
- p = memalign (sizeof (void *), -1);
-#if __GNUC_PREREQ (7, 0)
- DIAG_POP_NEEDS_COMMENT;
-#endif
+ p = memalign (sizeof (void *), minus1);
save = errno;
@@ -35,25 +35,20 @@ merror (const char *msg)
static int
do_test (void)
{
+ /* Use volatile for compiler barriers, to avoid
+ Walloc-size-larger-than warnings. */
+ volatile unsigned long int pagesize = getpagesize ();
+ volatile int minus1 = -1;
void *p;
- unsigned long pagesize = getpagesize ();
- unsigned long ptrval;
+ unsigned long int ptrval;
int save;
errno = 0;
DIAG_PUSH_NEEDS_COMMENT;
-#if __GNUC_PREREQ (7, 0)
- /* GCC 7 warns about too-large allocations; here we want to test
- that they fail. */
- DIAG_IGNORE_NEEDS_COMMENT (7, "-Walloc-size-larger-than=");
-#endif
/* An attempt to allocate a huge value should return NULL and set
errno to ENOMEM. */
- p = valloc (-1);
-#if __GNUC_PREREQ (7, 0)
- DIAG_POP_NEEDS_COMMENT;
-#endif
+ p = valloc (minus1);
save = errno;