This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR other/16820 (struct-layout-1 failures on non-I
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: sje at cup dot hp dot com (Steve Ellcey)
- Cc: jakub at redhat dot com, gcc-patches at gcc dot gnu dot org
- Date: Mon, 27 Sep 2004 12:44:34 -0400 (EDT)
- Subject: Re: [PATCH] Fix PR other/16820 (struct-layout-1 failures on non-I
> > > I looked into why this test gets a runtime failures on HPPA even after
> > > the compile time fixes have been made. The failure I saw was because
> > > the test was checking to see if a structure had 16-byte alignment and it
> > > looks to me like HPPA only supports 8 byte alignment.
> >
> > That's the case for uninitialized common data on the PA. The linker only
> > supports alignment to a maximum of 8 bytes. If the -fno-common option is
> > used with the tests, all but one passes. It's failing for a different
> > reason (it also fails on x86).
>
> So is there someway to force -fno-common to be used with this test or
> has that already been done? It looked to me like the compile time patch
>
> http://gcc.gnu.org/ml/gcc-patches/2004-07/msg02654.html
>
> to remove the use of complex.h still hadn't been checked in and I
> thought maybe it was because of this runtime problem.
I think it was because Jakub's patch wasn't reviewed. The enclosed
change shows how I added -fno-common. The `-DDBG' was just added
for debugging. It should be possible to only add this option on
hppa*-*-hpux* but I didn't fully work out how to do that.
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
Index: gcc.dg/compat/struct-layout-1.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/compat/struct-layout-1.h,v
retrieving revision 1.1
diff -u -3 -p -r1.1 struct-layout-1.h
--- gcc.dg/compat/struct-layout-1.h 23 Jul 2004 22:36:46 -0000 1.1
+++ gcc.dg/compat/struct-layout-1.h 27 Sep 2004 16:37:35 -0000
@@ -1,9 +1,7 @@
-#include <complex.h>
#include <limits.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdlib.h>
-#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "compat-common.h"
Index: gcc.dg/compat/struct-layout-1_generate.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/compat/struct-layout-1_generate.c,v
retrieving revision 1.1
diff -u -3 -p -r1.1 struct-layout-1_generate.c
--- gcc.dg/compat/struct-layout-1_generate.c 23 Jul 2004 22:36:46 -0000 1.1
+++ gcc.dg/compat/struct-layout-1_generate.c 27 Sep 2004 16:37:35 -0000
@@ -549,7 +549,7 @@ switchfiles (int fields)
exit (1);
}
fprintf (outfile, "\
-/* { dg-options \"-I%s\" } */\n\
+/* { dg-options \"-DDBG -fno-common -I%s\" } */\n\
#include \"struct-layout-1.h\"\n\
\n\
#define TX(n, type, attrs, fields, ops) extern void test##n (void);\n\
@@ -571,7 +571,7 @@ int main (void)\n\
if (outfile == NULL)
goto fail;
fprintf (outfile, "\
-/* { dg-options \"-w -I%s\" } */\n\
+/* { dg-options \"-DDBG -fno-common -w -I%s\" } */\n\
#include \"struct-layout-1_x1.h\"\n\
#include \"t%03d_test.h\"\n\
#include \"struct-layout-1_x2.h\"\n\
@@ -582,7 +582,7 @@ int main (void)\n\
if (outfile == NULL)
goto fail;
fprintf (outfile, "\
-/* { dg-options \"-w -I%s\" } */\n\
+/* { dg-options \"-DDBG -fno-common -w -I%s\" } */\n\
#include \"struct-layout-1_y1.h\"\n\
#include \"t%03d_test.h\"\n\
#include \"struct-layout-1_y2.h\"\n\
Index: gcc.dg/compat/struct-layout-1_x1.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/compat/struct-layout-1_x1.h,v
retrieving revision 1.1
diff -u -3 -p -r1.1 struct-layout-1_x1.h
--- gcc.dg/compat/struct-layout-1_x1.h 23 Jul 2004 22:36:46 -0000 1.1
+++ gcc.dg/compat/struct-layout-1_x1.h 27 Sep 2004 16:37:35 -0000
@@ -56,7 +56,7 @@ void test##n (void) \
info.als = __alignof__ (s##n); \
info.ala0 = __alignof__ (a##n[0]); \
info.ala3 = __alignof__ (a##n[3]); \
- if (((uintptr_t) &a##n[3]) & (info.als - 1)) \
+ if (((long) &a##n[3]) & (info.als - 1)) \
FAIL (n, 1); \
i = 0; j = 0; \
ops \