This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] new version of fix gcc.c-torture/execute/20010124-1 on MIPS...
Richard Henderson wrote:
On Thu, Sep 08, 2005 at 08:26:02PM -0700, David Daney wrote:
I will go out on a limb here and hazard a guess that since builtins.exp
is setup to link together two testsuite objects and that is what we need
to do, that 20010124-1 should be split into two files and put in the
execute/builtins directory even though it is not testing builtins.
Am I going down the correct path here?
Yes.
How about this new version of the patch:
It has the added benefit that the old version did not really do anything
as the entire test was optimized away at optimization levels where
unit-at-a-time was in effect.
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.
Tested on i686-pc-linux-gnu. Testing in progress for mipsel-linux-gnu.
O.K. to commit if no errors found for mipsel-linux?
David Daney
Index: gcc.c-torture/execute/20010124-1.c
===================================================================
RCS file: gcc.c-torture/execute/20010124-1.c
diff -N gcc.c-torture/execute/20010124-1.c
*** gcc.c-torture/execute/20010124-1.c 25 Jan 2001 00:16:42 -0000 1.1
--- /dev/null 1 Jan 1970 00:00:00 -0000
***************
*** 1,50 ****
- /* 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;
- }
--- 0 ----
Index: gcc.c-torture/execute/builtins/20010124-1-lib.c
===================================================================
RCS file: gcc.c-torture/execute/builtins/20010124-1-lib.c
diff -N gcc.c-torture/execute/builtins/20010124-1-lib.c
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- gcc.c-torture/execute/builtins/20010124-1-lib.c 9 Sep 2005 16:17:14 -0000
***************
*** 0 ****
--- 1,38 ----
+ /* 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;
+ };
+
+ struct S f(struct S *p)
+ {
+ return *p;
+ }
+
+ void g(union U *p)
+ {
+ }
+
+ 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;
+ }
Index: gcc.c-torture/execute/builtins/20010124-1.c
===================================================================
RCS file: gcc.c-torture/execute/builtins/20010124-1.c
diff -N gcc.c-torture/execute/builtins/20010124-1.c
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- gcc.c-torture/execute/builtins/20010124-1.c 9 Sep 2005 16:17:14 -0000
***************
*** 0 ****
--- 1,31 ----
+ /* 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;
+ };
+
+ 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);
+ }