Hi,

On Tue, Mar 20, 2012 at 08:16:04PM +0100, Georg-Johann Lay wrote:
> Martin Jambor wrote:
> > Hi,
> > 
> > this is another iteration of my attempts to fix expansion of
> > misaligned memory accesses on strict-alignment platforms (which was
> > suggested by Richi in
> > http://gcc.gnu.org/ml/gcc-patches/2011-08/msg00931.html and my first
> > attempt was posted as
> > http://gcc.gnu.org/ml/gcc-patches/2012-01/msg00319.html).
> > 
> > This time I got further, to big extent thanks to parts of Richi's
> > fixes of PR 50444 which cleaned up expr.c considerably.  I have
> > successfully bootstrapped the combined patch on x86_64-linux,
> > i686-linux, ia64-linux (without Ada) and sparc64-linux (without Java).
> > I have run the c and c++ testsuites on individual patches on sparc64
> > and ia64 too.
> > 
> > Nevertheless, since I still lack experience in this area, there will
> > almost certainly be comments and suggestions and therefore I have
> > divided the three main changes to three different patches, so that
> > they are easier to comment on by both me and anybody reviewing them.
> > 
> > Thanks in advance for any comments,
> > 
> > Martin
> 
> Hi Martin.
> 
> The new test cases make implications on the size of int: for example
>  they crash for targets with sizeof(int) == 2
> 

Crash?  I assume the tests misaligned-expand-[12].c abort because of
the comparison with 0xdeadbeef constant, misaligned-expand-3.c should
not be affected by size of int.  If that is the case, does the
following patch fixes the issue for you?

Sorry for the inconvenience,

Martin


2012-03-21  Martin Jambor  <mjam...@suse.cz>

        * gcc.dg/misaligned-expand-1.c (cst): Cast to int.
        * gcc.dg/misaligned-expand-2.c (cst): Likewise.

Index: src/gcc/testsuite/gcc.dg/misaligned-expand-1.c
===================================================================
--- src.orig/gcc/testsuite/gcc.dg/misaligned-expand-1.c
+++ src/gcc/testsuite/gcc.dg/misaligned-expand-1.c
@@ -14,7 +14,7 @@ foo (myint *p)
   return *p;
 }
 
-#define cst 0xdeadbeef
+#define cst (int) 0xdeadbeef
 #define NUM 8
 
 struct blah
Index: src/gcc/testsuite/gcc.dg/misaligned-expand-2.c
===================================================================
--- src.orig/gcc/testsuite/gcc.dg/misaligned-expand-2.c
+++ src/gcc/testsuite/gcc.dg/misaligned-expand-2.c
@@ -14,7 +14,7 @@ foo (myint *p, unsigned int i)
   *p = i;
 }
 
-#define cst 0xdeadbeef
+#define cst (int) 0xdeadbeef
 #define NUM 8
 
 struct blah
@@ -25,8 +25,6 @@ struct blah
 
 struct blah g;
 
-#define cst 0xdeadbeef
-
 int
 main (int argc, char **argv)
 {


Reply via email to