...actually attach the testcase...

Alan Lawrence wrote:
We've been seeing a bunch of new failures in the *libffi* testsuite on ARM Linux (arm-none-linux-gnueabi, arm-none-linux-gnueabihf), following this one-liner fix. I've reduced the testcase down to the attached (including removing any dependency on libffi); with gcc r221347, this prints the expected
7 8 9
whereas with gcc r221348, instead it prints
0 8 0

The action of r221348 is to change the alignment of a mem_ref, and a var_decl of b1, from 32 to 64; both have type
  type <record_type 0x2b9b8d428d20 cls_struct_16byte sizes-gimplified type_0 BLK
         size <integer_cst 0x2b9b8d3720a8 constant 192>
         unit size <integer_cst 0x2b9b8d372078 constant 24>
         align 64 symtab 0 alias set 1 canonical type 0x2b9b8d428d20
         fields <field_decl 0x2b9b8d42b098 a type <integer_type 0x2b9b8d092690 
int>
             SI file reduced.c line 12 col 7
             size <integer_cst 0x2b9b8d08eeb8 constant 32>
             unit size <integer_cst 0x2b9b8d08eed0 constant 4>
             align 32 offset_align 64
             offset <integer_cst 0x2b9b8d08eee8 constant 0>
bit offset <integer_cst 0x2b9b8d08ef48 constant 0> context <record_type 0x2b9b8d428d20 cls_struct_16byte> chain <field_decl 0x2b9b8d42b130 b>> context <translation_unit_decl 0x2b9b8d4232d0 D.6070> pointer_to_this <pointer_type 0x2b9b8d42d0a8> chain <type_decl 0x2b9b8d42b000 D.6044>>

The tree-optimized output is the same with both compilers (as this does not mention alignment); the expand output differs.

Still investigating...

--Alan


Richard Biener wrote:
This fixes a vectorizer testcase regression on powerpc where SRA
drops alignment info unnecessarily.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2015-03-11  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/65310
        * tree-sra.c (build_ref_for_offset): Also preserve larger
        alignment.

Index: gcc/tree-sra.c
===================================================================
--- gcc/tree-sra.c      (revision 221324)
+++ gcc/tree-sra.c      (working copy)
@@ -1597,7 +1597,7 @@ build_ref_for_offset (location_t loc, tr
   misalign = (misalign + offset) & (align - 1);
   if (misalign != 0)
     align = (misalign & -misalign);
-  if (align < TYPE_ALIGN (exp_type))
+  if (align != TYPE_ALIGN (exp_type))
     exp_type = build_aligned_type (exp_type, align);
mem_ref = fold_build2_loc (loc, MEM_REF, exp_type, base, off);







/* Reduced from libffi.call/cls_16byte.c
   Originator:	<andre...@gcc.gnu.org> 20030828	 */

typedef struct cls_struct_16byte {
  int a;
  double b;
  int c;
} cls_struct_16byte;

void cls_struct_16byte_gn(void** args, void *resp)
{
  struct cls_struct_16byte b1 = *(struct cls_struct_16byte*)(args[0]);

  __builtin_printf("%d %g %d\n", b1.a, b1.b, b1.c);

  // Note that commenting this line out, restores correct printing in the line above
  *(cls_struct_16byte*)resp = b1;
}

int main (void)
{
  struct cls_struct_16byte h_dbl = { 7, 8.0, 9 };
  struct cls_struct_16byte result;
  void *args = &h_dbl;
  cls_struct_16byte_gn (&args, &result);
  return 0;
}



Reply via email to