Commit 564475d7 by Andy Hutchinson Committed by Andy Hutchinson

wo_prof_escape_substr_value.c: Limit allocation based on STACK_SIZE.

* gcc.dg/struct/wo_prof_escape_substr_value.c: Limit allocation based on STACK_SIZE.
* gcc.dg/struct/wo_prof_array_through_pointer.c: Ditto.
* gcc.dg/struct/wo_prof_escape_substr_pointer.c: Ditto.
* gcc.dg/struct/wo_prof_escape_arg_to_local.c: Limit allocation based on STACK_SIZE. Check malloc return for NULL.
* gcc.dg/struct/w_prof_local_var.c: Ditto.
* gcc.dg/struct/wo_prof_mult_field_peeling.c: Ditto.
* gcc.dg/struct/w_prof_local_array.c: Limit allocation based on STACK_SIZE. XFAIL AVR target.
* gcc.dg/struct/wo_prof_local_array.c: Ditto.
* gcc.dg/struct/w_prof_two_strs.c: Limit allocation based on STACK_SIZE. Limit random size to N.
* gcc.dg/struct/wo_prof_two_strs.c: Limit allocation based on STACK_SIZE. XFAIL AVR target. Limit random size to N.
* gcc.dg/struct/w_prof_single_str_global.c: XFAIL AVR target.
* gcc.dg/struct/wo_prof_array_field.c: Ditto.
* gcc.dg/struct/wo_prof_double_malloc.c: Ditto.
* gcc.dg/struct/wo_prof_global_array.c: Ditto.
* gcc.dg/struct/wo_prof_single_str_global.c: Ditto.
* gcc.dg/struct/wo_prof_single_str_local.c: Ditto.
* gcc.dg/struct/w_prof_global_var.c: Limit allocation based on STACK_SIZE. Check malloc return for NULL. XFAIL AVR target.
* gcc.dg/struct/wo_prof_global_var.c: Ditto.
* gcc.dg/struct/wo_prof_local_var.c: Ditto.
* gcc.dg/struct/wo_prof_malloc_size_var.c: Access only allocated space. Limit allocation based on STACK_SIZE. XFAIL AVR target.

From-SVN: r140126
parent d70ddd90
2008-09-08 Andy Hutchinson <hutchinsonandy@aim.com>
* gcc.dg/struct/wo_prof_escape_substr_value.c: Limit allocation
based on STACK_SIZE.
* gcc.dg/struct/wo_prof_array_through_pointer.c: Ditto.
* gcc.dg/struct/wo_prof_escape_substr_pointer.c: Ditto.
* gcc.dg/struct/wo_prof_escape_arg_to_local.c: Limit allocation
based on STACK_SIZE. Check malloc return for NULL.
* gcc.dg/struct/w_prof_local_var.c: Ditto.
* gcc.dg/struct/wo_prof_mult_field_peeling.c: Ditto.
* gcc.dg/struct/w_prof_local_array.c: Limit allocation based on
STACK_SIZE. XFAIL AVR target.
* gcc.dg/struct/wo_prof_local_array.c: Ditto.
* gcc.dg/struct/w_prof_two_strs.c: Limit allocation based on
STACK_SIZE. Limit random size to N.
* gcc.dg/struct/wo_prof_two_strs.c: Limit allocation based on
STACK_SIZE. XFAIL AVR target. Limit random size to N.
* gcc.dg/struct/w_prof_single_str_global.c: XFAIL AVR target.
* gcc.dg/struct/wo_prof_array_field.c: Ditto.
* gcc.dg/struct/wo_prof_double_malloc.c: Ditto.
* gcc.dg/struct/wo_prof_global_array.c: Ditto.
* gcc.dg/struct/wo_prof_single_str_global.c: Ditto.
* gcc.dg/struct/wo_prof_single_str_local.c: Ditto.
* gcc.dg/struct/w_prof_global_var.c: Limit allocation based on
STACK_SIZE. Check malloc return for NULL. XFAIL AVR target.
* gcc.dg/struct/wo_prof_global_var.c: Ditto.
* gcc.dg/struct/wo_prof_local_var.c: Ditto.
* gcc.dg/struct/wo_prof_malloc_size_var.c: Access only allocated
space. Limit allocation based on STACK_SIZE. XFAIL AVR target.
2008-09-08 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> 2008-09-08 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* g++.dg/cdce3.C: Require c99 runtime. * g++.dg/cdce3.C: Require c99 runtime.
......
...@@ -5,7 +5,15 @@ typedef struct ...@@ -5,7 +5,15 @@ typedef struct
float b; float b;
}str_t; }str_t;
#ifdef STACK_SIZE
#if STACK_SIZE > 8000
#define N 1000 #define N 1000
#else
#define N (STACK_SIZE/8)
#endif
#else
#define N 1000
#endif
str_t *p; str_t *p;
...@@ -15,7 +23,8 @@ main () ...@@ -15,7 +23,8 @@ main ()
int i, sum; int i, sum;
p = malloc (N * sizeof (str_t)); p = malloc (N * sizeof (str_t));
if (p == NULL)
return 0;
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
p[i].b = i; p[i].b = i;
...@@ -30,5 +39,5 @@ main () ...@@ -30,5 +39,5 @@ main ()
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" } } */ /* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
/* { dg-final-use { cleanup-ipa-dump "*" } } */ /* { dg-final-use { cleanup-ipa-dump "*" } } */
...@@ -5,7 +5,15 @@ typedef struct ...@@ -5,7 +5,15 @@ typedef struct
float b; float b;
}str_t; }str_t;
#ifdef STACK_SIZE
#if STACK_SIZE > 8000
#define N 1000 #define N 1000
#else
#define N (STACK_SIZE/8)
#endif
#else
#define N 1000
#endif
int int
main () main ()
...@@ -26,5 +34,5 @@ main () ...@@ -26,5 +34,5 @@ main ()
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" } } */ /* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
/* { dg-final-use { cleanup-ipa-dump "*" } } */ /* { dg-final-use { cleanup-ipa-dump "*" } } */
...@@ -5,7 +5,15 @@ typedef struct ...@@ -5,7 +5,15 @@ typedef struct
float b; float b;
}str_t; }str_t;
#ifdef STACK_SIZE
#if STACK_SIZE > 8000
#define N 1000 #define N 1000
#else
#define N (STACK_SIZE/8)
#endif
#else
#define N 1000
#endif
int int
main () main ()
...@@ -13,7 +21,8 @@ main () ...@@ -13,7 +21,8 @@ main ()
int i, sum; int i, sum;
str_t * p = malloc (N * sizeof (str_t)); str_t * p = malloc (N * sizeof (str_t));
if (p == NULL)
return 0;
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
p[i].b = i; p[i].b = i;
......
...@@ -26,6 +26,6 @@ main () ...@@ -26,6 +26,6 @@ main ()
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" } } */ /* { dg-final-use { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
/* { dg-final-use { cleanup-ipa-dump "*" } } */ /* { dg-final-use { cleanup-ipa-dump "*" } } */
...@@ -12,7 +12,15 @@ typedef struct ...@@ -12,7 +12,15 @@ typedef struct
float d; float d;
}str_t2; }str_t2;
#ifdef STACK_SIZE
#if STACK_SIZE > 16000
#define N 1000 #define N 1000
#else
#define N (STACK_SIZE/16)
#endif
#else
#define N 1000
#endif
str_t1 *p1; str_t1 *p1;
str_t2 *p2; str_t2 *p2;
...@@ -33,7 +41,7 @@ main () ...@@ -33,7 +41,7 @@ main ()
int i, r; int i, r;
r = rand (); r = rand ();
num = r > N ? N : num; num = r > N ? N : r;
p1 = malloc (num * sizeof (str_t1)); p1 = malloc (num * sizeof (str_t1));
p2 = malloc (num * sizeof (str_t2)); p2 = malloc (num * sizeof (str_t2));
......
...@@ -23,5 +23,5 @@ int main() ...@@ -23,5 +23,5 @@ int main()
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" } } */ /* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */ /* { dg-final { cleanup-ipa-dump "*" } } */
...@@ -8,7 +8,15 @@ typedef struct ...@@ -8,7 +8,15 @@ typedef struct
float b; float b;
}str_t; }str_t;
#ifdef STACK_SIZE
#if STACK_SIZE > 8000
#define N 1000 #define N 1000
#else
#define N (STACK_SIZE/8)
#endif
#else
#define N 1000
#endif
int int
main () main ()
......
...@@ -26,5 +26,5 @@ int main() ...@@ -26,5 +26,5 @@ int main()
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" } } */ /* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */ /* { dg-final { cleanup-ipa-dump "*" } } */
...@@ -9,7 +9,15 @@ struct str ...@@ -9,7 +9,15 @@ struct str
float b; float b;
}; };
#ifdef STACK_SIZE
#if STACK_SIZE > 8000
#define N 1000 #define N 1000
#else
#define N (STACK_SIZE/8)
#endif
#else
#define N 1000
#endif
int int
foo (struct str * p_str) foo (struct str * p_str)
...@@ -25,7 +33,8 @@ main () ...@@ -25,7 +33,8 @@ main ()
{ {
int i, sum; int i, sum;
struct str * p = malloc (N * sizeof (struct str)); struct str * p = malloc (N * sizeof (struct str));
if (p == NULL)
return 0;
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
sum = foo (p+i); sum = foo (p+i);
......
...@@ -8,7 +8,15 @@ typedef struct ...@@ -8,7 +8,15 @@ typedef struct
float b; float b;
}str_t; }str_t;
#ifdef STACK_SIZE
#if STACK_SIZE > 16000
#define N 1000 #define N 1000
#else
#define N (STACK_SIZE/16)
#endif
#else
#define N 1000
#endif
typedef struct typedef struct
{ {
......
...@@ -8,7 +8,16 @@ typedef struct ...@@ -8,7 +8,16 @@ typedef struct
float b; float b;
}str_t; }str_t;
#ifdef STACK_SIZE
#if STACK_SIZE > 8000
#define N 1000 #define N 1000
#else
#define N (STACK_SIZE/8)
#endif
#else
#define N 1000
#endif
typedef struct typedef struct
{ {
......
...@@ -29,5 +29,5 @@ main () ...@@ -29,5 +29,5 @@ main ()
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" } } */ /* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */ /* { dg-final { cleanup-ipa-dump "*" } } */
...@@ -8,7 +8,15 @@ typedef struct ...@@ -8,7 +8,15 @@ typedef struct
float b; float b;
}str_t; }str_t;
#ifdef STACK_SIZE
#if STACK_SIZE > 8000
#define N 1000 #define N 1000
#else
#define N (STACK_SIZE/8)
#endif
#else
#define N 1000
#endif
str_t *p; str_t *p;
...@@ -18,7 +26,8 @@ main () ...@@ -18,7 +26,8 @@ main ()
int i, sum; int i, sum;
p = malloc (N * sizeof (str_t)); p = malloc (N * sizeof (str_t));
if (p == NULL)
return 0;
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
p[i].b = i; p[i].b = i;
...@@ -33,5 +42,5 @@ main () ...@@ -33,5 +42,5 @@ main ()
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" } } */ /* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */ /* { dg-final { cleanup-ipa-dump "*" } } */
...@@ -8,7 +8,15 @@ typedef struct ...@@ -8,7 +8,15 @@ typedef struct
float b; float b;
}str_t; }str_t;
#ifdef STACK_SIZE
#if STACK_SIZE > 8000
#define N 1000 #define N 1000
#else
#define N (STACK_SIZE/8)
#endif
#else
#define N 1000
#endif
int int
main () main ()
...@@ -29,5 +37,5 @@ main () ...@@ -29,5 +37,5 @@ main ()
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" } } */ /* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */ /* { dg-final { cleanup-ipa-dump "*" } } */
...@@ -8,7 +8,15 @@ typedef struct ...@@ -8,7 +8,15 @@ typedef struct
float b; float b;
}str_t; }str_t;
#ifdef STACK_SIZE
#if STACK_SIZE > 8000
#define N 1000 #define N 1000
#else
#define N (STACK_SIZE/8)
#endif
#else
#define N 1000
#endif
int int
main () main ()
...@@ -16,7 +24,8 @@ main () ...@@ -16,7 +24,8 @@ main ()
int i, sum; int i, sum;
str_t * p = malloc (N * sizeof (str_t)); str_t * p = malloc (N * sizeof (str_t));
if (p == NULL)
return 0;
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
p[i].b = i; p[i].b = i;
...@@ -31,5 +40,5 @@ main () ...@@ -31,5 +40,5 @@ main ()
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" } } */ /* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */ /* { dg-final { cleanup-ipa-dump "*" } } */
...@@ -8,7 +8,15 @@ typedef struct ...@@ -8,7 +8,15 @@ typedef struct
float b; float b;
}str_t; }str_t;
#ifdef STACK_SIZE
#if STACK_SIZE > 8000
#define N 1000 #define N 1000
#else
#define N (STACK_SIZE/8)
#endif
#else
#define N 1000
#endif
int int
main () main ()
...@@ -16,18 +24,19 @@ main () ...@@ -16,18 +24,19 @@ main ()
int i, num; int i, num;
num = rand(); num = rand();
num = num > N ? N : num;
str_t * p = malloc (num * sizeof (str_t)); str_t * p = malloc (num * sizeof (str_t));
if (p == 0) if (p == 0)
return 0; return 0;
for (i = 0; i < N; i++) for (i = 0; i < num; i++)
p[i].b = i; p[i].b = i;
for (i = 0; i < N; i++) for (i = 0; i < num; i++)
p[i].a = p[i].b + 1; p[i].a = p[i].b + 1;
for (i = 0; i < N; i++) for (i = 0; i < num; i++)
if (p[i].a != p[i].b + 1) if (p[i].a != p[i].b + 1)
abort (); abort ();
...@@ -35,5 +44,5 @@ main () ...@@ -35,5 +44,5 @@ main ()
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" } } */ /* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */ /* { dg-final { cleanup-ipa-dump "*" } } */
...@@ -10,14 +10,23 @@ typedef struct ...@@ -10,14 +10,23 @@ typedef struct
float d; float d;
}str_t; }str_t;
#ifdef STACK_SIZE
#if STACK_SIZE > 1600
#define N 100 #define N 100
#else
#define N (STACK_SIZE/16)
#endif
#else
#define N 100
#endif
int int
main () main ()
{ {
int i; int i;
str_t *p = malloc (N * sizeof (str_t)); str_t *p = malloc (N * sizeof (str_t));
if (p == NULL)
return 0;
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
p[i].a = 5; p[i].a = 5;
......
...@@ -29,5 +29,5 @@ main () ...@@ -29,5 +29,5 @@ main ()
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" } } */ /* { dg-final { scan-ipa-dump "Number of structures to transform is 1" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */ /* { dg-final { cleanup-ipa-dump "*" } } */
...@@ -29,5 +29,5 @@ main () ...@@ -29,5 +29,5 @@ main ()
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/* { dg-final { scan-ipa-dump "No structures to transform" "ipa_struct_reorg" } } */ /* { dg-final { scan-ipa-dump "No structures to transform" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */ /* { dg-final { cleanup-ipa-dump "*" } } */
...@@ -15,7 +15,15 @@ typedef struct ...@@ -15,7 +15,15 @@ typedef struct
float d; float d;
}str_t2; }str_t2;
#ifdef STACK_SIZE
#if STACK_SIZE > 16000
#define N 1000 #define N 1000
#else
#define N (STACK_SIZE/16)
#endif
#else
#define N 1000
#endif
str_t1 *p1; str_t1 *p1;
str_t2 *p2; str_t2 *p2;
...@@ -36,7 +44,7 @@ main () ...@@ -36,7 +44,7 @@ main ()
int i, r; int i, r;
r = rand (); r = rand ();
num = r > N ? N : num; num = r > N ? N : r;
p1 = malloc (num * sizeof (str_t1)); p1 = malloc (num * sizeof (str_t1));
p2 = malloc (num * sizeof (str_t2)); p2 = malloc (num * sizeof (str_t2));
...@@ -56,5 +64,5 @@ main () ...@@ -56,5 +64,5 @@ main ()
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/* { dg-final { scan-ipa-dump "Number of structures to transform is 2" "ipa_struct_reorg" } } */ /* { dg-final { scan-ipa-dump "Number of structures to transform is 2" "ipa_struct_reorg" { xfail { "avr-*-*" } } } } */
/* { dg-final { cleanup-ipa-dump "*" } } */ /* { dg-final { cleanup-ipa-dump "*" } } */
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