20071018-1.c: New testcase.

2007-10-19  Richard Guenther  <rguenther@suse.de>

        * gcc.c-torture/execute/20071018-1.c: New testcase.

From-SVN: r129485
This commit is contained in:
Richard Guenther 2007-10-19 11:38:55 +00:00 committed by Richard Biener
parent 1a8076fc5e
commit 0eaf8b066c
2 changed files with 35 additions and 0 deletions

View file

@ -1,3 +1,7 @@
2007-10-19 Richard Guenther <rguenther@suse.de>
* gcc.c-torture/execute/20071018-1.c: New testcase.
2007-10-19 Richard Guenther <rguenther@suse.de>
PR middle-end/32921

View file

@ -0,0 +1,31 @@
extern void abort(void);
struct foo {
int rank;
char *name;
};
struct mem {
struct foo *x[4];
};
void __attribute__((noinline)) bar(struct foo **f)
{
*f = __builtin_malloc(sizeof(struct foo));
}
struct foo * foo(int rank)
{
void *x = __builtin_malloc(sizeof(struct mem));
struct mem *as = x;
struct foo **upper = &as->x[rank * 8 - 1];
*upper = 0;
bar(upper);
return *upper;
}
int main()
{
if (foo(0) == 0)
abort ();
return 0;
}