]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/59776 (gcc -g -O1 ICE in expand_debug_locations, at cfgexpand.c...
authorJakub Jelinek <jakub@gcc.gnu.org>
Tue, 11 Feb 2014 17:46:34 +0000 (18:46 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 11 Feb 2014 17:46:34 +0000 (18:46 +0100)
PR debug/59776
* tree-sra.c (load_assign_lhs_subreplacements): Add VIEW_CONVERT_EXPR
around drhs if type conversion to lacc->type is not useless.

* gcc.dg/guality/pr59776.c: New test.

From-SVN: r207695

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/guality/pr59776.c [new file with mode: 0644]
gcc/tree-sra.c

index f29f94366f6f8b130de5f00bf26d871d88604cf8..2d5a09c0068b5316c3521e2a261f789a7fec9b68 100644 (file)
@@ -1,3 +1,10 @@
+2014-02-11  Richard Henderson  <rth@redhat.com>
+           Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/59776
+       * tree-sra.c (load_assign_lhs_subreplacements): Add VIEW_CONVERT_EXPR
+       around drhs if type conversion to lacc->type is not useless.
+
 2014-02-11  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * config/aarch64/aarch64-cores.def (cortex-a57): Use cortexa57
index c287b8da7723385e173337c01e2abb10907200ba..b25b15ebc345397b988a233296793c181a890f36 100644 (file)
@@ -1,3 +1,8 @@
+2014-02-11  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/59776
+       * gcc.dg/guality/pr59776.c: New test.
+
 2014-02-11  Renlin Li  <Renlin.Li@arm.com>
 
        * gcc.target/arm/fixed_float_conversion.c: Add arm_vfp3 option.
diff --git a/gcc/testsuite/gcc.dg/guality/pr59776.c b/gcc/testsuite/gcc.dg/guality/pr59776.c
new file mode 100644 (file)
index 0000000..382abb6
--- /dev/null
@@ -0,0 +1,29 @@
+/* PR debug/59776 */
+/* { dg-do run } */
+/* { dg-options "-g" } */
+
+#include "../nop.h"
+
+struct S { float f, g; };
+
+__attribute__((noinline, noclone)) void
+foo (struct S *p)
+{
+  struct S s1, s2;                     /* { dg-final { gdb-test pr59776.c:17 "s1.f" "5.0" } } */
+  s1 = *p;                             /* { dg-final { gdb-test pr59776.c:17 "s1.g" "6.0" } } */
+  s2 = s1;                             /* { dg-final { gdb-test pr59776.c:17 "s2.f" "0.0" } } */
+  *(int *) &s2.f = 0;                  /* { dg-final { gdb-test pr59776.c:17 "s2.g" "6.0" } } */
+  asm volatile (NOP : : : "memory");   /* { dg-final { gdb-test pr59776.c:20 "s1.f" "5.0" } } */
+  asm volatile (NOP : : : "memory");   /* { dg-final { gdb-test pr59776.c:20 "s1.g" "6.0" } } */
+  s2 = s1;                             /* { dg-final { gdb-test pr59776.c:20 "s2.f" "5.0" } } */
+  asm volatile (NOP : : : "memory");   /* { dg-final { gdb-test pr59776.c:20 "s2.g" "6.0" } } */
+  asm volatile (NOP : : : "memory");
+}
+
+int
+main ()
+{
+  struct S x = { 5.0f, 6.0f };
+  foo (&x);
+  return 0;
+}
index 4071274419f44d386bc7a4e3146efe0dd71dbc00..284d54448bd0d92e52292f353e14527ac29ddbc7 100644 (file)
@@ -2950,6 +2950,10 @@ load_assign_lhs_subreplacements (struct access *lacc, struct access *top_racc,
                                                  lacc);
              else
                drhs = NULL_TREE;
+             if (drhs
+                 && !useless_type_conversion_p (lacc->type, TREE_TYPE (drhs)))
+               drhs = fold_build1_loc (loc, VIEW_CONVERT_EXPR,
+                                       lacc->type, drhs);
              ds = gimple_build_debug_bind (get_access_replacement (lacc),
                                            drhs, gsi_stmt (*old_gsi));
              gsi_insert_after (new_gsi, ds, GSI_NEW_STMT);