On Tue, 24 May 2016, [email protected] wrote:

> >Synopsis:      Default OpenBSD 5.9 GCC 4.2.1 compiler segfaults when 
> >compiling a sample file
> >Category:      system amd64
> >Environment:
>         System      : OpenBSD 5.9
>         Details     : OpenBSD 5.9 (GENERIC) #1761: Fri Feb 26 01:15:04 MST 
> 2016
>                          
> [email protected]:/usr/src/sys/arch/amd64/compile/GENERIC
> 
>         Architecture: OpenBSD.amd64
>         Machine     : amd64
> >Description:
>         Default OpenBSD 5.9 GCC compiler segfaults when compiling a sample 
> file, included into the repository [1].
> 
>         [1]: https://github.com/extensibl/openbsd-gcc-4.2.1-segfault
> 
> >How-To-Repeat:
>         Follow README instructions in [1]. C sources, header files and GCC 
> -save-temps files are included.
> 
> >Fix:
>         Fix unknown. Workaround - use GCC 4.9.3 from packages.

Hi,

The gcc diff below fixes this ICE (already tested).

I don't know if GPLv3 prevents us from merging this fix... As far
as I can see, it should be from before the license change.

Here's the Bugzilla page: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32694

And the ViewVC one: 
https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=128766

Ciao!
David

Index: gnu/gcc/gcc/tree-ssa-ccp.c
===================================================================
RCS file: /cvs/src/gnu/gcc/gcc/tree-ssa-ccp.c,v
retrieving revision 1.2
diff -u -p -u -p -r1.2 tree-ssa-ccp.c
--- gnu/gcc/gcc/tree-ssa-ccp.c  28 Dec 2013 02:27:08 -0000      1.2
+++ gnu/gcc/gcc/tree-ssa-ccp.c  24 May 2016 12:46:53 -0000
@@ -2063,12 +2063,13 @@ fold_stmt_r (tree *expr_p, int *walk_sub
          tem = fold_binary (TREE_CODE (op0), TREE_TYPE (op0),
                             TREE_OPERAND (op0, 0),
                             TREE_OPERAND (op0, 1));
-         set = tem && is_gimple_condexpr (tem);
+         set = tem && set_rhs (expr_p, tem);
          fold_undefer_overflow_warnings (set, fold_stmt_r_data->stmt, 0);
          if (set)
-           TREE_OPERAND (expr, 0) = tem;
-         t = expr;
-          break;
+           {
+             t = *expr_p;
+             break;
+           }
         }
 
     default:
Index: gnu/gcc/gcc/tree-ssa-propagate.c
===================================================================
RCS file: /cvs/src/gnu/gcc/gcc/tree-ssa-propagate.c,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 tree-ssa-propagate.c
--- gnu/gcc/gcc/tree-ssa-propagate.c    15 Oct 2009 17:11:28 -0000      1.1.1.1
+++ gnu/gcc/gcc/tree-ssa-propagate.c    24 May 2016 12:46:53 -0000
@@ -571,7 +571,8 @@ set_rhs (tree *stmt_p, tree expr)
   ssa_op_iter iter;
 
   /* Verify the constant folded result is valid gimple.  */
-  if (TREE_CODE_CLASS (code) == tcc_binary)
+  if (TREE_CODE_CLASS (code) == tcc_binary
+      || TREE_CODE_CLASS (code) == tcc_comparison)
     {
       if (!is_gimple_val (TREE_OPERAND (expr, 0))
          || !is_gimple_val (TREE_OPERAND (expr, 1)))

Reply via email to