20010124-1.c: Removed and split into two new files which are ...

2005-09-09  David Daney <ddaney@avtrex.com>

	* gcc.c-torture/execute/20010124-1.c:  Removed and split into two new
	files which are ...
	* gcc.c-torture/execute/builtins/20010124-1: ... here and ...
	* gcc.c-torture/execute/builtins/20010124-1-lib.c: ... here.

From-SVN: r104116
This commit is contained in:
David Daney 2005-09-09 23:32:57 +00:00 committed by David Daney
parent a30efae8b9
commit 15336b9e67
4 changed files with 87 additions and 50 deletions

View File

@ -1,3 +1,10 @@
2005-09-09 David Daney <ddaney@avtrex.com>
* gcc.c-torture/execute/20010124-1.c: Removed and split into two new
files which are ...
* gcc.c-torture/execute/builtins/20010124-1: ... here and ...
* gcc.c-torture/execute/builtins/20010124-1-lib.c: ... here.
2005-09-09 Francois-Xavier Coudert <coudert@clipper.ens.fr>
* gfortran.dg/iostat_2.f90: New test.

View File

@ -1,50 +0,0 @@
/* Verify that structure return doesn't invoke memcpy on
overlapping objects. */
extern void abort (void);
typedef __SIZE_TYPE__ size_t;
struct S {
char stuff[1024];
};
union U {
struct {
int space;
struct S s;
} a;
struct {
struct S s;
int space;
} b;
};
static struct S f(struct S *);
static void g(union U *);
int main()
{
union U u;
u.b.s = f(&u.a.s);
u.a.s = f(&u.b.s);
g(&u);
return 0;
}
static struct S f(struct S *p)
{
return *p;
}
static void g(union U *p)
{
}
static void *memcpy(void *a, const void *b, size_t len)
{
if (a < b && a+len > b)
abort ();
if (b < a && b+len > a)
abort ();
return a;
}

View File

@ -0,0 +1,50 @@
/* Verify that structure return doesn't invoke memcpy on
overlapping objects. */
extern void abort (void);
extern int inside_main;
typedef __SIZE_TYPE__ size_t;
struct S {
char stuff[1024];
};
union U {
struct {
int space;
struct S s;
} a;
struct {
struct S s;
int space;
} b;
};
struct S f(struct S *p)
{
return *p;
}
void g(union U *p)
{
}
void *memcpy(void *a, const void *b, size_t len)
{
if (inside_main)
{
if (a < b && a+len > b)
abort ();
if (b < a && b+len > a)
abort ();
return a;
}
else
{
char *dst = (char *) a;
const char *src = (const char *) b;
while (len--)
*dst++ = *src++;
return a;
}
}

View File

@ -0,0 +1,30 @@
/* Verify that structure return doesn't invoke memcpy on
overlapping objects. */
extern void abort (void);
struct S {
char stuff[1024];
};
union U {
struct {
int space;
struct S s;
} a;
struct {
struct S s;
int space;
} b;
};
struct S f(struct S *);
void g(union U *);
void main_test(void)
{
union U u;
u.b.s = f(&u.a.s);
u.a.s = f(&u.b.s);
g(&u);
}