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

Richard.

2016-01-13  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/69242
        * tree-ssa-sccvn.c (visit_reference_op_load): Replace bogus
        assert with a check.

        * gcc.dg/torture/pr69242.c: New testcase.

Index: gcc/tree-ssa-sccvn.c
===================================================================
*** gcc/tree-ssa-sccvn.c        (revision 232261)
--- gcc/tree-ssa-sccvn.c        (working copy)
*************** visit_reference_op_load (tree lhs, tree
*** 3221,3228 ****
              gimple_seq stmts = NULL;
              result = maybe_push_res_to_seq (rcode, TREE_TYPE (op), ops,
                                              &stmts);
!             gcc_assert (result && gimple_seq_singleton_p (stmts));
!             new_stmt = gimple_seq_first_stmt (stmts);
            }
          else
            /* The expression is already available.  */
--- 3221,3231 ----
              gimple_seq stmts = NULL;
              result = maybe_push_res_to_seq (rcode, TREE_TYPE (op), ops,
                                              &stmts);
!             if (result)
!               {
!                 gcc_assert (gimple_seq_singleton_p (stmts));
!                 new_stmt = gimple_seq_first_stmt (stmts);
!               }
            }
          else
            /* The expression is already available.  */
Index: gcc/testsuite/gcc.dg/torture/pr69242.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/pr69242.c      (revision 0)
--- gcc/testsuite/gcc.dg/torture/pr69242.c      (working copy)
***************
*** 0 ****
--- 1,15 ----
+ /* { dg-do compile } */
+ /* { dg-additional-options "-w" } */
+ 
+ int a[1];
+ void *memcpy();
+ int smx_ctx_base_factory_create_context_sized();
+ void getcontext();
+ void smx_ctx_sysv_create_context() {
+     int *b = (int *)smx_ctx_base_factory_create_context_sized();
+     getcontext();
+     memcpy(a, &b, sizeof(int));
+     switch (a[0])
+       ;
+ }
+ 

Reply via email to