On October 29, 2016 5:57:17 PM GMT+02:00, Jakub Jelinek <ja...@redhat.com> wrote: >On Sat, Oct 29, 2016 at 10:07:22AM +0200, Andreas Schwab wrote: >> That breaks Ada: >> >> a-teioed.adb: In function 'Ada.Text_Io.Editing.Format_Number': >> a-teioed.adb:127:4: error: alignment of array elements is greater >than element size >> a-teioed.adb:127:4: error: alignment of array elements is greater >than element size >> a-teioed.adb:127:4: error: alignment of array elements is greater >than element size >> a-teioed.adb:127:4: error: alignment of array elements is greater >than element size >> a-teioed.adb:127:4: error: alignment of array elements is greater >than element size >> a-teioed.adb:127:4: error: alignment of array elements is greater >than element size >> a-teioed.adb:127:4: error: alignment of array elements is greater >than element size >> a-teioed.adb:127:4: error: alignment of array elements is greater >than element size >> a-teioed.adb:127:4: error: alignment of array elements is greater >than element size >> a-teioed.adb: In function 'Ada.Text_Io.Editing.To_Picture': >> a-teioed.adb:2724:4: error: alignment of array elements is greater >than element size >> a-teioed.adb: In function 'Ada.Text_Io.Editing.Valid': >> a-teioed.adb:2751:4: error: alignment of array elements is greater >than element size > >The bug is the same why PR78148 testcase fails with -fcompare-debug, >build_nonstandard_integer_type return values are shared, all such calls >with the same arguments return the same types, so using SET_TYPE_ALIGN >on it >is wrong. > >As it is a bootstrap failure on primary target and the fix is obvious, >I've committed it to trunk after bootstrapping/regtesting it on >x86_64-linux >(where it fixed ada bootstrap) and i686-linux.
Whoops, sorry for not noticing during review. Richard. >2016-10-29 Jakub Jelinek <ja...@redhat.com> > > PR target/78148 > * gimple-ssa-store-merging.c > (imm_store_chain_info::output_merged_store): Use build_aligned_type > instead of SET_TYPE_ALIGN on shared integral type. > > * gcc.dg/pr78148.c: New test. > >--- gcc/gimple-ssa-store-merging.c.jj 2016-10-29 14:39:24.000000000 >+0200 >+++ gcc/gimple-ssa-store-merging.c 2016-10-29 15:09:34.650749175 +0200 >@@ -1130,7 +1130,7 @@ imm_store_chain_info::output_merged_stor > location_t loc = get_location_for_stmts (split_store->orig_stmts); > > tree int_type = build_nonstandard_integer_type (try_size, UNSIGNED); >- SET_TYPE_ALIGN (int_type, align); >+ int_type = build_aligned_type (int_type, align); > tree addr = build_fold_addr_expr (base); > tree dest = fold_build2 (MEM_REF, int_type, addr, > build_int_cst (offset_type, try_pos)); >--- gcc/testsuite/gcc.dg/pr78148.c.jj 2016-10-29 15:10:05.432358626 >+0200 >+++ gcc/testsuite/gcc.dg/pr78148.c 2016-10-29 15:09:09.000000000 +0200 >@@ -0,0 +1,31 @@ >+/* PR target/78148 */ >+/* { dg-do compile } */ >+/* { dg-options "-O2 -fcompare-debug" } */ >+ >+struct A { int a, b; }; >+struct B { char c, d; }; >+extern void bar (struct A, struct B); >+struct C { char e, f; } a; >+struct D >+{ >+ int g; >+ struct C h[4]; >+}; >+struct D *e; >+ >+struct D >+foo (void) >+{ >+ int b; >+ struct B c; >+ struct A d; >+ d.b = c.c = c.d = 0; >+ bar (d, c); >+} >+ >+void >+baz () >+{ >+ e->h[0].e = e->h[0].f = 0; >+ foo (); >+} > > Jakub