classmap.db build fail does not fail libjava build

Richard Guenther rguenther@suse.de
Wed Sep 5 14:07:00 GMT 2007


because of:

## The .db file.  This rule is only used for native builds, so it is
## safe to invoke gcj-dbtool.
$(db_name): gcj-dbtool$(EXEEXT)
## In case it exists already.
        @rm -f $(db_name)
## We don't actually care if it fails -- if it does, just make an
## empty file.  This is simpler than trying to discover when mmap is
## not available.
        ./gcj-dbtool -n $(db_name) || touch $(db_name)

I think this is a bad thing as I am seeing:

make[2]: Leaving directory 
`/abuild/rguenther/obj/x86_64-unknown-linux-gnu/libjava'
./gcj-dbtool -n classmap.db || touch classmap.db
Exception during runtime initialization
/bin/sh: line 1: 16812 Aborted                 ./gcj-dbtool -n classmap.db

and lots of libjava failures that are similar.

It looks like a segfault in

0x00002af3a85f54a2 in _ZN4java4lang11ClassLoader18__U3c_clinit__U3e_EJvv 
()
    at /abuild/rguenther/trunk/libjava/java/lang/ClassLoader.java:284
284         PermissionCollection perm = Policy.getPolicy().getPermissions(cs);

of course I have no idea how to debug this ;)  The patch that will
cause this on x86_64 is the following (the tree-ssa-sccvn.c part is
the interesting part)

Richard.


2007-09-05  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/32586
	* tree-ssa-sccvn.c (simplify_binary_expression): Avoid
	folding if nothing changed.
	(simplify_unary_expression): New function.  Do tree combining
	on conversion like codes.
	(try_to_simplify): Call it.
	* builtins.c (fold_builtin_cexp): Fold the built expressions.
	* fold-const.c (fold_unary): Test result of get_callee_fndecl().

	* g++.dg/tree-ssa/pr27090.C: Remove XFAILs.
	* gcc.dg/tree-ssa/ssa-fre-1.c: Likewise.
	* gcc.dg/tree-ssa/ssa-fre-3.c: Likewise.
	* gcc.dg/tree-ssa/ssa-fre-5.c: Likewise.
	* gcc.dg/tree-ssa/ssa-fre-4.c: Likewise, remove scan for
	now obsolete simplification.

Index: gcc/tree-ssa-sccvn.c
===================================================================
*** gcc/tree-ssa-sccvn.c.orig	2007-08-27 09:55:13.000000000 +0200
--- gcc/tree-ssa-sccvn.c	2007-09-05 13:31:15.000000000 +0200
*************** simplify_binary_expression (tree rhs)
*** 1411,1416 ****
--- 1411,1421 ----
  	op1 = SSA_VAL (op1);
      }
  
+   /* Avoid folding if nothing changed.  */
+   if (op0 == TREE_OPERAND (rhs, 0)
+       && op1 == TREE_OPERAND (rhs, 1))
+     return NULL_TREE;
+ 
    result = fold_binary (TREE_CODE (rhs), TREE_TYPE (rhs), op0, op1);
  
    /* Make sure result is not a complex expression consisting
*************** simplify_binary_expression (tree rhs)
*** 1423,1428 ****
--- 1428,1469 ----
    return NULL_TREE;
  }
  
+ /* Simplify the unary expression RHS, and return the result if
+    simplified. */
+ 
+ static tree
+ simplify_unary_expression (tree rhs)
+ {
+   tree result = NULL_TREE;
+   tree op0 = TREE_OPERAND (rhs, 0);
+ 
+   if (TREE_CODE (op0) != SSA_NAME)
+     return NULL_TREE;
+ 
+   if (VN_INFO (op0)->has_constants
+       || TREE_CODE (rhs) == NOP_EXPR
+       || TREE_CODE (rhs) == CONVERT_EXPR
+       || TREE_CODE (rhs) == REALPART_EXPR
+       || TREE_CODE (rhs) == IMAGPART_EXPR)
+     op0 = VN_INFO (op0)->expr;
+   else if (SSA_VAL (op0) != op0)
+     op0 = SSA_VAL (op0);
+ 
+   /* Avoid folding if nothing changed.  */
+   if (op0 == TREE_OPERAND (rhs, 0))
+     return rhs;
+ 
+   result = fold_unary (TREE_CODE (rhs), TREE_TYPE (rhs), op0);
+   if (result)
+     {
+       STRIP_USELESS_TYPE_CONVERSION (result);
+       if (valid_gimple_expression_p (result))
+         return result;
+     }
+ 
+   return rhs;
+ }
+ 
  /* Try to simplify RHS using equivalences and constant folding.  */
  
  static tree
*************** try_to_simplify (tree stmt, tree rhs)
*** 1457,1477 ****
  	    if (result)
  	      return result;
  	  }
! 	  break;
  	  /* We could do a little more with unary ops, if they expand
  	     into binary ops, but it's debatable whether it is worth it. */
  	case tcc_unary:
! 	  {
! 	    tree result = NULL_TREE;
! 	    tree op0 = TREE_OPERAND (rhs, 0);
! 	    if (TREE_CODE (op0) == SSA_NAME && VN_INFO (op0)->has_constants)
! 	      op0 = VN_INFO (op0)->expr;
! 	    else if (TREE_CODE (op0) == SSA_NAME && SSA_VAL (op0) != op0)
! 	      op0 = SSA_VAL (op0);
! 	    result = fold_unary (TREE_CODE (rhs), TREE_TYPE (rhs), op0);
! 	    if (result)
! 	      return result;
! 	  }
  	  break;
  	case tcc_comparison:
  	case tcc_binary:
--- 1498,1511 ----
  	    if (result)
  	      return result;
  	  }
! 	  /* Fallthrough for some codes.  */
! 	  if (!(TREE_CODE (rhs) == REALPART_EXPR
! 	        || TREE_CODE (rhs) == IMAGPART_EXPR))
! 	    break;
  	  /* We could do a little more with unary ops, if they expand
  	     into binary ops, but it's debatable whether it is worth it. */
  	case tcc_unary:
! 	  return simplify_unary_expression (rhs);
  	  break;
  	case tcc_comparison:
  	case tcc_binary:
Index: gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-1.c
===================================================================
*** gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-1.c.orig	2007-08-24 18:33:22.000000000 +0200
--- gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-1.c	2007-09-05 13:24:22.000000000 +0200
*************** int f(int *a)
*** 11,16 ****
    return *c + t;
  }
  
! /* { dg-final { scan-tree-dump "Replaced \\\(int \\\*\\\) b_.*with a_" "fre" { xfail *-*-* } } } */
! /* { dg-final { scan-tree-dump "Replaced \\\*c_.*with t_" "fre" { xfail *-*-* } } } */
  /* { dg-final { cleanup-tree-dump "fre" } } */
--- 11,16 ----
    return *c + t;
  }
  
! /* { dg-final { scan-tree-dump "Replaced \\\(int \\\*\\\) b_.*with a_" "fre" } } */
! /* { dg-final { scan-tree-dump "Replaced \\\*c_.*with t_" "fre" } } */
  /* { dg-final { cleanup-tree-dump "fre" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-3.c
===================================================================
*** gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-3.c.orig	2007-08-24 18:33:22.000000000 +0200
--- gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-3.c	2007-09-05 13:24:22.000000000 +0200
*************** foo (int a, int b)
*** 11,15 ****
    return aa + bb;
  }
  
! /* { dg-final { scan-tree-dump "Replaced \\\(int\\\) aa_.*with a_" "fre" { xfail *-*-* } } } */
  /* { dg-final { cleanup-tree-dump "fre" } } */
--- 11,15 ----
    return aa + bb;
  }
  
! /* { dg-final { scan-tree-dump "Replaced \\\(int\\\) aa_.*with a_" "fre" } } */
  /* { dg-final { cleanup-tree-dump "fre" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-4.c
===================================================================
*** gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-4.c.orig	2007-08-24 18:33:23.000000000 +0200
--- gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-4.c	2007-09-05 13:24:22.000000000 +0200
*************** char bar(char f)
*** 9,14 ****
          return wrap(f);
  }
  
! /* { dg-final { scan-tree-dump "Replaced \\\(char\\\) .*with " "fre" { xfail *-*-* } } } */
! /* { dg-final { scan-tree-dump "Replaced \\\(int\\\) .*with " "fre" { xfail *-*-* } } } */
  /* { dg-final { cleanup-tree-dump "fre" } } */
--- 9,13 ----
          return wrap(f);
  }
  
! /* { dg-final { scan-tree-dump "Replaced \\\(char\\\) .*with " "fre" } } */
  /* { dg-final { cleanup-tree-dump "fre" } } */
Index: gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-5.c
===================================================================
*** gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-5.c.orig	2007-08-24 18:33:23.000000000 +0200
--- gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-5.c	2007-09-05 13:24:22.000000000 +0200
*************** bar (unsigned int t)
*** 10,14 ****
    return a == t;
  }
  
! /* { dg-final { scan-tree-dump "Replaced \\\(unsigned int\\\) a_.*with t_" "fre" { xfail *-*-* } } } */
  /* { dg-final { cleanup-tree-dump "fre" } } */
--- 10,14 ----
    return a == t;
  }
  
! /* { dg-final { scan-tree-dump "Replaced \\\(unsigned int\\\) a_.*with t_" "fre" } } */
  /* { dg-final { cleanup-tree-dump "fre" } } */
Index: gcc/builtins.c
===================================================================
*** gcc/builtins.c.orig	2007-09-05 13:34:29.000000000 +0200
--- gcc/builtins.c	2007-09-05 13:34:36.000000000 +0200
*************** fold_builtin_cexp (tree arg0, tree type)
*** 7734,7746 ****
        icall = builtin_save_expr (icall);
        rcall = build_call_expr (rfn, 1, realp);
        rcall = builtin_save_expr (rcall);
!       return build2 (COMPLEX_EXPR, type,
! 		     build2 (MULT_EXPR, rtype,
! 			     rcall,
! 			     build1 (REALPART_EXPR, rtype, icall)),
! 		     build2 (MULT_EXPR, rtype,
! 			     rcall,
! 			     build1 (IMAGPART_EXPR, rtype, icall)));
      }
  
    return NULL_TREE;
--- 7734,7746 ----
        icall = builtin_save_expr (icall);
        rcall = build_call_expr (rfn, 1, realp);
        rcall = builtin_save_expr (rcall);
!       return fold_build2 (COMPLEX_EXPR, type,
! 			  fold_build2 (MULT_EXPR, rtype,
! 				       rcall,
! 			 	       fold_build1 (REALPART_EXPR, rtype, icall)),
! 			  fold_build2 (MULT_EXPR, rtype,
! 				       rcall,
! 				       fold_build1 (IMAGPART_EXPR, rtype, icall)));
      }
  
    return NULL_TREE;
Index: gcc/testsuite/g++.dg/tree-ssa/pr27090.C
===================================================================
*** gcc/testsuite/g++.dg/tree-ssa/pr27090.C.orig	2007-07-02 13:59:16.000000000 +0200
--- gcc/testsuite/g++.dg/tree-ssa/pr27090.C	2007-09-05 15:55:15.000000000 +0200
*************** int foo(Foo& f)
*** 17,21 ****
          return f.get();
  }
  
! /* { dg-final { scan-tree-dump "return f->x;" "optimized" { xfail *-*-* } } } */
  /* { dg-final { cleanup-tree-dump "optimized" } } */
--- 17,21 ----
          return f.get();
  }
  
! /* { dg-final { scan-tree-dump "return f->x;" "optimized" } } */
  /* { dg-final { cleanup-tree-dump "optimized" } } */
Index: gcc/fold-const.c
===================================================================
*** gcc/fold-const.c.orig	2007-09-05 10:52:47.000000000 +0200
--- gcc/fold-const.c	2007-09-05 16:03:29.000000000 +0200
*************** fold_unary (enum tree_code code, tree ty
*** 8464,8470 ****
        if (TREE_CODE (arg0) == CALL_EXPR)
  	{
  	  tree fn = get_callee_fndecl (arg0);
! 	  if (DECL_BUILT_IN_CLASS (fn) == BUILT_IN_NORMAL)
  	    switch (DECL_FUNCTION_CODE (fn))
  	      {
  	      CASE_FLT_FN (BUILT_IN_CEXPI):
--- 8464,8470 ----
        if (TREE_CODE (arg0) == CALL_EXPR)
  	{
  	  tree fn = get_callee_fndecl (arg0);
! 	  if (fn && DECL_BUILT_IN_CLASS (fn) == BUILT_IN_NORMAL)
  	    switch (DECL_FUNCTION_CODE (fn))
  	      {
  	      CASE_FLT_FN (BUILT_IN_CEXPI):
*************** fold_unary (enum tree_code code, tree ty
*** 8506,8512 ****
        if (TREE_CODE (arg0) == CALL_EXPR)
  	{
  	  tree fn = get_callee_fndecl (arg0);
! 	  if (DECL_BUILT_IN_CLASS (fn) == BUILT_IN_NORMAL)
  	    switch (DECL_FUNCTION_CODE (fn))
  	      {
  	      CASE_FLT_FN (BUILT_IN_CEXPI):
--- 8506,8512 ----
        if (TREE_CODE (arg0) == CALL_EXPR)
  	{
  	  tree fn = get_callee_fndecl (arg0);
! 	  if (fn && DECL_BUILT_IN_CLASS (fn) == BUILT_IN_NORMAL)
  	    switch (DECL_FUNCTION_CODE (fn))
  	      {
  	      CASE_FLT_FN (BUILT_IN_CEXPI):



More information about the Gcc-patches mailing list