Commit b69b6c68 by Rask Ingemann Lambertsen Committed by Rask Ingemann Lambertsen

limits-blockid.c: Reduce testcase size to 10000 for targets where "int" can't hold at least 100000.

	* gcc.c-torture/compile/limits-blockid.c: Reduce testcase size to
	10000 for targets where "int" can't hold at least 100000.
	* gcc.c-torture/compile/limits-enumconst.c: Likewise.
	* gcc.dg/fold-eqandshift-1.c (INT_BITS): New.
	(test5)(test6): Use it.
	* gcc.dg/pr30744-1.c (r): Use pointer sized integer.
	* gcc.dg/tree-ssa/foldaddr-1.c (foo): Likewise.
	* gcc.dg/tree-ssa/loadpre6.c (main): Likewise.
	* gcc.dg/tls/opt-5.c (__gen_tempname): Avoid overflowing 16-bit	int.
	* gcc.dg/attr-alloc_size.c (test): Likewise.

From-SVN: r127870
parent c2acde1e
2007-08-28 Rask Ingemann Lambertsen <rask@sygehus.dk>
* gcc.c-torture/compile/limits-blockid.c: Reduce testcase size to
10000 for targets where "int" can't hold at least 100000.
* gcc.c-torture/compile/limits-enumconst.c: Likewise.
* gcc.dg/fold-eqandshift-1.c (INT_BITS): New.
(test5)(test6): Use it.
* gcc.dg/pr30744-1.c (r): Use pointer sized integer.
* gcc.dg/tree-ssa/foldaddr-1.c (foo): Likewise.
* gcc.dg/tree-ssa/loadpre6.c (main): Likewise.
* gcc.dg/tls/opt-5.c (__gen_tempname): Avoid overflowing 16-bit int.
* gcc.dg/attr-alloc_size.c (test): Likewise.
2007-08-28 Paolo Carlini <pcarlini@suse.de>
PR c++/33209
......@@ -14,5 +14,9 @@
void q9_func(void)
{
#if __INT_MAX__ >= 100000
LIM5(char t)
#else
LIM4(char t)
#endif
}
......@@ -14,5 +14,9 @@
enum q21_enum
{
#if __INT_MAX__ >= 100000
LIM5 (e)
#else
LIM4 (e)
#endif
};
......@@ -23,13 +23,13 @@ test (void)
p = malloc1 (6);
strcpy (p, "Hello");
strcpy (p, "Hello World"); /* { dg-warning "will always overflow" "strcpy" } */
p = malloc2 (424242, 6);
p = malloc2 (__INT_MAX__ >= 1700000 ? 424242 : __INT_MAX__ / 4, 6);
strcpy (p, "World");
strcpy (p, "Hello World"); /* { dg-warning "will always overflow" "strcpy" } */
p = calloc1 (2, 5);
strcpy (p, "World");
strcpy (p, "Hello World"); /* { dg-warning "will always overflow" "strcpy" } */
p = calloc2 (2, 424242, 5);
p = calloc2 (2, __INT_MAX__ >= 1700000 ? 424242 : __INT_MAX__ / 4, 5);
strcpy (p, "World");
strcpy (p, "Hello World"); /* { dg-warning "will always overflow" "strcpy" } */
}
......
......@@ -25,15 +25,25 @@ int test4(int d)
return (d >> 3) & 4;
}
#if __INT_MAX__ == 32767
#define INT_BITS 16
#elif __INT_MAX__ == 2147483647
#define INT_BITS 32
#elif __INT_MAX__ == 9223372036854775807
#define INT_BITS 64
#else
#error Please add support for your target here.
#endif
void test5(int e)
{
if ((e >> 31) & 64)
if ((e >> (INT_BITS - 1)) & 64)
foo();
}
void test6(unsigned int f)
{
if ((f >> 31) & 64)
if ((f >> (INT_BITS - 1)) & 64)
foo();
}
......
/* { dg-do compile } */
/* { dg-options "-O2" } */
#include <stddef.h>
typedef struct {
unsigned long unique;
ptrdiff_t unique;
} G;
void r(G* n)
{
unsigned long p;
if (((G *) ((void *)((~(unsigned long)(p))))) != ((void *)0)) {
((G *) ((void *)((~(unsigned long)(p)))))->unique = n->unique;
ptrdiff_t p;
if (((G *) ((void *)((~(ptrdiff_t)(p))))) != ((void *)0)) {
((G *) ((void *)((~(ptrdiff_t)(p)))))->unique = n->unique;
}
}
......@@ -34,12 +34,12 @@ __gen_tempname (char *tmpl, int kind)
char *XXXXXX;
static uint64_t value;
uint64_t random_time_bits;
unsigned int count;
unsigned long count;
int fd = -1;
int save_errno = __libc_errno;
struct stat64 st;
unsigned int attempts_min = 62 * 62 * 62;
unsigned int attempts = attempts_min < 238328 ? 238328 : attempts_min;
unsigned long attempts_min = 62L * 62L * 62L;
unsigned long attempts = attempts_min < 238328 ? 238328 : attempts_min;
len = strlen (tmpl);
if (len < 6 || strcmp(&tmpl[len - 6], "XXXXXX"))
......
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-original" } */
#include <stddef.h>
char *a;
int foo(char *b)
{
return a+5+(long)b == (long)b+a;
return a+5+(ptrdiff_t)b == (ptrdiff_t)b+a;
}
/* Folding should have determined that the two addresses were
......
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-pre-stats" } */
#include <stddef.h>
union tree_node;
typedef union tree_node *tree;
......@@ -63,7 +64,7 @@ main (void)
for (i = 0; i < 2; i++)
{
unexpanded_var_list = malloc (sizeof (struct tree_list));
unexpanded_var_list->list.value = (tree) (long unsigned) (i & 1);
unexpanded_var_list->list.value = (tree) (ptrdiff_t) (i & 1);
unexpanded_var_list->common.chain = last;
last = unexpanded_var_list;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment