public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Ada broken on i686-linux (some progress)
@ 2004-09-12  3:56 Richard Kenner
  2004-09-12 22:12 ` Zdenek Dvorak
  0 siblings, 1 reply; 11+ messages in thread
From: Richard Kenner @ 2004-09-12  3:56 UTC (permalink / raw)
  To: rakdver; +Cc: gcc

    could you please check whether this patch helps?

I can't say for sure it if "helps" or not, but this failure is
still present:

../../xgcc -B../../ -c -g -O2      -W -Wall -gnatpg  g-regexp.adb -o g-regexp.o
g-regexp.adb: In function `GNAT.REGEXP.COMPILE.CREATE_PRIMARY_TABLE.CREATE_SIMPL
E':
g-regexp.adb:521: error: Missing definition
for SSA_NAME: k.620<D2244>_174
in statement:
#   TMT.1766<D3788>_352 = V_MAY_DEF <TMT.1766<D3788>_464>;
#   TMT.1767<D3789>_351 = V_MAY_DEF <TMT.1767<D3789>_518>;
#   TMT.1768<D3790>_340 = V_MAY_DEF <TMT.1768<D3790>_457>;
#   TMT.1769<D3791>_339 = V_MAY_DEF <TMT.1769<D3791>_529>;
#   C.617<D2240>_338 = V_MAY_DEF <C.617<D2240>_519>;
#   TMT.1771<D3793>_337 = V_MAY_DEF <TMT.1771<D3793>_416>;
#   TMT.1772<D3794>_336 = V_MAY_DEF <TMT.1772<D3794>_540>;
#   TMT.1773<D3795>_331 = V_MAY_DEF <TMT.1773<D3795>_485>;
#   TMT.1774<D3796>_326 = V_MAY_DEF <TMT.1774<D3796>_308>;
#   VUSE <T.900<D2548>_357>;
*T.898<D2546>_175 = gnat__regexp__set (T.900<D2548>, T.897<D2545>_170, k.620<D22
44>_174, T.594<D2211>_173);

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Ada broken on i686-linux (some progress)
  2004-09-12  3:56 Ada broken on i686-linux (some progress) Richard Kenner
@ 2004-09-12 22:12 ` Zdenek Dvorak
  2004-09-12 23:33   ` Ada broken on i686-linux (some more progress) Laurent GUERBY
  0 siblings, 1 reply; 11+ messages in thread
From: Zdenek Dvorak @ 2004-09-12 22:12 UTC (permalink / raw)
  To: Richard Kenner; +Cc: gcc, hubicka

Hello,

>     could you please check whether this patch helps?
> 
> I can't say for sure it if "helps" or not, but this failure is
> still present:

this turned out not to be a sharing issue, but misshandling of
array_ref_element_size and array_ref_low_bound.  The following
patch should hopefully get you at least a bit further.

Zdenek

Index: tree-ssa-loop-ivopts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-ivopts.c,v
retrieving revision 2.9
diff -c -3 -p -r2.9 tree-ssa-loop-ivopts.c
*** tree-ssa-loop-ivopts.c	10 Sep 2004 08:56:36 -0000	2.9
--- tree-ssa-loop-ivopts.c	12 Sep 2004 19:35:03 -0000
*************** dump_iv (FILE *file, struct iv *iv)
*** 305,310 ****
--- 305,314 ----
    print_generic_expr (file, iv->ssa_name, TDF_SLIM);
    fprintf (file, "\n");
  
+   fprintf (file, "  type ");
+   print_generic_expr (file, TREE_TYPE (iv->base), TDF_SLIM);
+   fprintf (file, "\n");
+ 
    if (iv->step)
      {
        fprintf (file, "  base ");
*************** dump_use (FILE *file, struct iv_use *use
*** 358,391 ****
        gcc_unreachable ();
      }
  
!    fprintf (file, "  in statement ");
!    print_generic_expr (file, use->stmt, TDF_SLIM);
!    fprintf (file, "\n");
! 
!    fprintf (file, "  at position ");
!    if (use->op_p)
!      print_generic_expr (file, *use->op_p, TDF_SLIM);
!    fprintf (file, "\n");
! 
!    if (iv->step)
!      {
!        fprintf (file, "  base ");
!        print_generic_expr (file, iv->base, TDF_SLIM);
!        fprintf (file, "\n");
! 
!        fprintf (file, "  step ");
!        print_generic_expr (file, iv->step, TDF_SLIM);
!        fprintf (file, "\n");
!      }
!    else
!      {
!        fprintf (file, "  invariant ");
!        print_generic_expr (file, iv->base, TDF_SLIM);
!        fprintf (file, "\n");
!      }
  
!    fprintf (file, "  related candidates ");
!    dump_bitmap (file, use->related_cands);
  }
  
  /* Dumps information about the uses to FILE.  */
--- 362,399 ----
        gcc_unreachable ();
      }
  
!   fprintf (file, "  in statement ");
!   print_generic_expr (file, use->stmt, TDF_SLIM);
!   fprintf (file, "\n");
! 
!   fprintf (file, "  at position ");
!   if (use->op_p)
!     print_generic_expr (file, *use->op_p, TDF_SLIM);
!   fprintf (file, "\n");
! 
!   fprintf (file, "  type ");
!   print_generic_expr (file, TREE_TYPE (iv->base), TDF_SLIM);
!   fprintf (file, "\n");
! 
!   if (iv->step)
!     {
!       fprintf (file, "  base ");
!       print_generic_expr (file, iv->base, TDF_SLIM);
!       fprintf (file, "\n");
! 
!       fprintf (file, "  step ");
!       print_generic_expr (file, iv->step, TDF_SLIM);
!       fprintf (file, "\n");
!     }
!   else
!     {
!       fprintf (file, "  invariant ");
!       print_generic_expr (file, iv->base, TDF_SLIM);
!       fprintf (file, "\n");
!     }
  
!   fprintf (file, "  related candidates ");
!   dump_bitmap (file, use->related_cands);
  }
  
  /* Dumps information about the uses to FILE.  */
*************** dump_cand (FILE *file, struct iv_cand *c
*** 438,459 ****
        break;
      }
  
!    if (iv->step)
!      {
!        fprintf (file, "  base ");
!        print_generic_expr (file, iv->base, TDF_SLIM);
!        fprintf (file, "\n");
! 
!        fprintf (file, "  step ");
!        print_generic_expr (file, iv->step, TDF_SLIM);
!        fprintf (file, "\n");
!      }
!    else
!      {
!        fprintf (file, "  invariant ");
!        print_generic_expr (file, iv->base, TDF_SLIM);
!        fprintf (file, "\n");
!      }
  }
  
  /* Returns the info for ssa version VER.  */
--- 446,471 ----
        break;
      }
  
!   fprintf (file, "  type ");
!   print_generic_expr (file, TREE_TYPE (iv->base), TDF_SLIM);
!   fprintf (file, "\n");
! 
!   if (iv->step)
!     {
!       fprintf (file, "  base ");
!       print_generic_expr (file, iv->base, TDF_SLIM);
!       fprintf (file, "\n");
! 
!       fprintf (file, "  step ");
!       print_generic_expr (file, iv->step, TDF_SLIM);
!       fprintf (file, "\n");
!     }
!   else
!     {
!       fprintf (file, "  invariant ");
!       print_generic_expr (file, iv->base, TDF_SLIM);
!       fprintf (file, "\n");
!     }
  }
  
  /* Returns the info for ssa version VER.  */
*************** idx_find_step (tree base, tree *idx, voi
*** 1150,1156 ****
  {
    struct ifs_ivopts_data *dta = data;
    struct iv *iv;
!   tree step, type, iv_type, iv_step;
    
    if (TREE_CODE (*idx) != SSA_NAME)
      return true;
--- 1162,1170 ----
  {
    struct ifs_ivopts_data *dta = data;
    struct iv *iv;
!   tree step, type, iv_type, iv_step, lbound;
!   basic_block def_bb;
!   struct loop *loop = dta->ivopts_data->current_loop;
    
    if (TREE_CODE (*idx) != SSA_NAME)
      return true;
*************** idx_find_step (tree base, tree *idx, voi
*** 1167,1173 ****
    iv_type = TREE_TYPE (iv->base);
    type = build_pointer_type (TREE_TYPE (base));
    if (TREE_CODE (base) == ARRAY_REF)
!     step = array_ref_element_size (base);
    else
      /* The step for pointer arithmetics already is 1 byte.  */
      step = build_int_cst (type, 1);
--- 1181,1210 ----
    iv_type = TREE_TYPE (iv->base);
    type = build_pointer_type (TREE_TYPE (base));
    if (TREE_CODE (base) == ARRAY_REF)
!     {
!       step = array_ref_element_size (base);
!       lbound = array_ref_low_bound (base);
! 
!       /* We only handle addresses whose step is an integer constant.  */
!       if (TREE_CODE (step) != INTEGER_CST)
! 	return false;
! 
!       /* We need the lower bound to be invariant in loop, since otherwise
! 	 we are unable to initialize a new induction variable created
! 	 in strength reduction -- we need to take the address of the
! 	 reference in front of the loop.  */
!       if (is_gimple_min_invariant (lbound))
! 	; /* Nothing to do.  */
!       else if (TREE_CODE (lbound) != SSA_NAME)
! 	return false;
!       else
! 	{
! 	  def_bb = bb_for_stmt (SSA_NAME_DEF_STMT (lbound));
! 	  if (def_bb
! 	      && flow_bb_inside_loop_p (loop, def_bb))
! 	    return false;
! 	}
!     }
    else
      /* The step for pointer arithmetics already is 1 byte.  */
      step = build_int_cst (type, 1);
*************** idx_find_step (tree base, tree *idx, voi
*** 1198,1207 ****
     object is passed to it in DATA.  */
  
  static bool
! idx_record_use (tree base ATTRIBUTE_UNUSED, tree *idx,
  		void *data)
  {
    find_interesting_uses_op (data, *idx);
    return true;
  }
  
--- 1235,1249 ----
     object is passed to it in DATA.  */
  
  static bool
! idx_record_use (tree base, tree *idx,
  		void *data)
  {
    find_interesting_uses_op (data, *idx);
+   if (TREE_CODE (base) == ARRAY_REF)
+     {
+       find_interesting_uses_op (data, array_ref_element_size (base));
+       find_interesting_uses_op (data, array_ref_low_bound (base));
+     }
    return true;
  }
  
*************** find_interesting_uses_stmt (struct ivopt
*** 1318,1329 ****
  	default: ;
  	}
  
!       if (TREE_CODE_CLASS (TREE_CODE (lhs)) == 'r')
  	{
  	  find_interesting_uses_address (data, stmt, &TREE_OPERAND (stmt, 0));
  	  find_interesting_uses_op (data, rhs);
  	  return;
  	}
      }
  
    if (TREE_CODE (stmt) == PHI_NODE
--- 1360,1381 ----
  	default: ;
  	}
  
!       /* Handle memory = gimple_val.  */
!       if (TREE_CODE_CLASS (TREE_CODE (lhs)) == 'r'
! 	  && is_gimple_val (rhs))
  	{
  	  find_interesting_uses_address (data, stmt, &TREE_OPERAND (stmt, 0));
  	  find_interesting_uses_op (data, rhs);
  	  return;
  	}
+ 
+       /* TODO -- we should also handle address uses of type
+ 
+ 	 memory = call (whatever);
+ 
+ 	 and
+ 
+ 	 call (memory).  */
      }
  
    if (TREE_CODE (stmt) == PHI_NODE
*************** static tree
*** 1995,2004 ****
  get_computation_at (struct loop *loop,
  		    struct iv_use *use, struct iv_cand *cand, tree at)
  {
!   tree ubase = unsave_expr_now (use->iv->base);
!   tree ustep = unsave_expr_now (use->iv->step);
!   tree cbase = unsave_expr_now (cand->iv->base);
!   tree cstep = unsave_expr_now (cand->iv->step);
    tree utype = TREE_TYPE (ubase), ctype = TREE_TYPE (cbase);
    tree uutype;
    tree expr, delta;
--- 2047,2056 ----
  get_computation_at (struct loop *loop,
  		    struct iv_use *use, struct iv_cand *cand, tree at)
  {
!   tree ubase = use->iv->base;
!   tree ustep = use->iv->step;
!   tree cbase = cand->iv->base;
!   tree cstep = cand->iv->step;
    tree utype = TREE_TYPE (ubase), ctype = TREE_TYPE (cbase);
    tree uutype;
    tree expr, delta;
*************** iv_value (struct iv *iv, tree niter)
*** 2905,2911 ****
    tree type = TREE_TYPE (iv->base);
  
    niter = fold_convert (type, niter);
!   val = fold (build2 (MULT_EXPR, type, iv->step, unsave_expr_now (niter)));
  
    return fold (build2 (PLUS_EXPR, type, iv->base, val));
  }
--- 2957,2963 ----
    tree type = TREE_TYPE (iv->base);
  
    niter = fold_convert (type, niter);
!   val = fold (build2 (MULT_EXPR, type, iv->step, niter));
  
    return fold (build2 (PLUS_EXPR, type, iv->base, val));
  }
*************** rewrite_use_outer (struct ivopts_data *d
*** 4125,4130 ****
--- 4177,4183 ----
  	value = get_computation_at (data->current_loop,
  				    use, cand, last_stmt (exit->src));
  
+       value = unshare_expr (value);
        op = force_gimple_operand (value, &stmts, true, SSA_NAME_VAR (tgt));
  	  
        /* If we will preserve the iv anyway and we would need to perform
Index: tree-ssa-loop-niter.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-niter.c,v
retrieving revision 2.7
diff -c -3 -p -r2.7 tree-ssa-loop-niter.c
*** tree-ssa-loop-niter.c	5 Sep 2004 15:24:15 -0000	2.7
--- tree-ssa-loop-niter.c	12 Sep 2004 19:35:03 -0000
*************** inverse (tree x, tree mask)
*** 84,105 ****
    return rslt;
  }
  
- /* Returns unsigned variant of TYPE.  */
- 
- tree
- unsigned_type_for (tree type)
- {
-   return make_unsigned_type (TYPE_PRECISION (type));
- }
- 
- /* Returns signed variant of TYPE.  */
- 
- static tree
- signed_type_for (tree type)
- {
-   return make_signed_type (TYPE_PRECISION (type));
- }
- 
  /* Determine the number of iterations according to condition (for staying
     inside loop) which compares two induction variables using comparison
     operator CODE.  The induction variable on left side of the comparison
--- 84,89 ----
Index: tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.c,v
retrieving revision 1.426
diff -c -3 -p -r1.426 tree.c
*** tree.c	11 Sep 2004 21:14:38 -0000	1.426
--- tree.c	12 Sep 2004 19:35:07 -0000
*************** tree_fold_gcd (tree a, tree b)
*** 5939,5942 ****
--- 5939,5958 ----
      }
  }
  
+ /* Returns unsigned variant of TYPE.  */
+ 
+ tree
+ unsigned_type_for (tree type)
+ {
+   return lang_hooks.types.unsigned_type (type);
+ }
+ 
+ /* Returns signed variant of TYPE.  */
+ 
+ tree
+ signed_type_for (tree type)
+ {
+   return lang_hooks.types.signed_type (type);
+ }
+ 
  #include "gt-tree.h"
Index: tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.619
diff -c -3 -p -r1.619 tree.h
*** tree.h	11 Sep 2004 21:14:39 -0000	1.619
--- tree.h	12 Sep 2004 19:35:09 -0000
*************** extern tree build_empty_stmt (void);
*** 2786,2791 ****
--- 2786,2792 ----
  
  extern tree make_signed_type (int);
  extern tree make_unsigned_type (int);
+ extern tree signed_type_for (tree);
  extern tree unsigned_type_for (tree);
  extern void initialize_sizetypes (bool);
  extern void set_sizetype (tree);

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Ada broken on i686-linux (some more progress)
  2004-09-12 22:12 ` Zdenek Dvorak
@ 2004-09-12 23:33   ` Laurent GUERBY
  0 siblings, 0 replies; 11+ messages in thread
From: Laurent GUERBY @ 2004-09-12 23:33 UTC (permalink / raw)
  To: Zdenek Dvorak; +Cc: Richard Kenner, gcc, hubicka

Thanks for looking into this, I confirm that with HEAD plus your patch
below stage2 completes, then it ICEs later while building the RTS
on some code which doesn't look loop-related.

x86:
../../xgcc -B../../ -c -g -O2 -fPIC      -W -Wall -gnatpg  g-exctra.adb -o g-exctra.o
g-exctra.adb: In function `GNAT.EXCEPTION_TRACES.DECORATOR_WRAPPER':
g-exctra.adb:69: error: Found a virtual definition for a GIMPLE register
while verifying SSA_NAME decorator_traceback_31 in statement
#   gnat__exception_traces__current_decoratorD.447_26 = V_MAY_DEF <gnat__exception_traces__current_decoratorD.447_15>;
#   D.462_30 = V_MAY_DEF <D.462_20>;
#   decorator_tracebackD.454_31 = V_MAY_DEF <decorator_tracebackD.454_14>;
#   D.464_27 = V_MAY_DEF <D.464_25>;
#   VUSE <D.461_24>;
D.464 = gnat__exception_traces__current_decorator.1_16 (D.461);

+===========================GNAT BUG DETECTED==============================+
| 4.0.0 20040912 (experimental) (i686-pc-linux-gnu) verify_ssa failed.     |
| Error detected at g-exctra.adb:127:1                                     |

backtrace:
(gdb) bt
#0  internal_error (msgid=0x1 <Address 0x1 out of bounds>) at /home/guerby/work/gcc/version-head/gcc/diagnostic.c:543
#1  0x082ebefa in verify_ssa () at /home/guerby/work/gcc/version-head/gcc/tree-ssa.c:612
#2  0x082ece45 in execute_todo (properties=604, flags=15) at /home/guerby/work/gcc/version-head/gcc/tree-optimize.c:442
#3  0x082ed08a in execute_pass_list (pass=0x8777640) at /home/guerby/work/gcc/version-head/gcc/tree-optimize.c:512
#4  0x082ed0c5 in execute_pass_list (pass=0x8777300) at /home/guerby/work/gcc/version-head/gcc/tree-optimize.c:537
#5  0x082ed361 in tree_rest_of_compilation (fndecl=0x4026a9f8, nested_p=0 '\0') at /home/guerby/work/gcc/version-head/gcc/tree-optimize.c:618
#6  0x08064f8f in gnat_expand_body (gnu_decl=0x4026a9f8) at /home/guerby/work/gcc/version-head/gcc/ada/misc.c:652
#7  0x0862521b in cgraph_expand_function (node=0x4026e244) at /home/guerby/work/gcc/version-head/gcc/cgraphunit.c:814
#8  0x08626c52 in cgraph_optimize () at /home/guerby/work/gcc/version-head/gcc/cgraphunit.c:1680
#9  0x085cb2d5 in toplev_main (argc=1, argv=0xbffff364) at /home/guerby/work/gcc/version-head/gcc/toplev.c:991
#10 0x4004c500 in __libc_start_main () from /lib/tls/libc.so.6
#11 0x08049dd1 in _start () at ../sysdeps/i386/elf/start.S:102


x86_64:
../../xgcc -B../../ -c -g -O2 -fPIC      -W -Wall -gnatpg  g-exctra.adb -o g-exctra.o
+===========================GNAT BUG DETECTED==============================+
| 4.0.0 20040912 (experimental) (x86_64-unknown-linux-gnu) GCC error:      |
| in var_ann, at tree-flow-inline.h:34                                     |
| Error detected at g-exctra.adb:127:1                                     |

Laurent

On Sun, 2004-09-12 at 21:46, Zdenek Dvorak wrote:
> Hello,
> 
> >     could you please check whether this patch helps?
> > 
> > I can't say for sure it if "helps" or not, but this failure is
> > still present:
> 
> this turned out not to be a sharing issue, but misshandling of
> array_ref_element_size and array_ref_low_bound.  The following
> patch should hopefully get you at least a bit further.
> 
> Zdenek
> 
> Index: tree-ssa-loop-ivopts.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-ivopts.c,v
> retrieving revision 2.9
> diff -c -3 -p -r2.9 tree-ssa-loop-ivopts.c
> *** tree-ssa-loop-ivopts.c	10 Sep 2004 08:56:36 -0000	2.9
> --- tree-ssa-loop-ivopts.c	12 Sep 2004 19:35:03 -0000
> *************** dump_iv (FILE *file, struct iv *iv)
> *** 305,310 ****
> --- 305,314 ----
>     print_generic_expr (file, iv->ssa_name, TDF_SLIM);
>     fprintf (file, "\n");
>   
> +   fprintf (file, "  type ");
> +   print_generic_expr (file, TREE_TYPE (iv->base), TDF_SLIM);
> +   fprintf (file, "\n");
> + 
>     if (iv->step)
>       {
>         fprintf (file, "  base ");
> *************** dump_use (FILE *file, struct iv_use *use
> *** 358,391 ****
>         gcc_unreachable ();
>       }
>   
> !    fprintf (file, "  in statement ");
> !    print_generic_expr (file, use->stmt, TDF_SLIM);
> !    fprintf (file, "\n");
> ! 
> !    fprintf (file, "  at position ");
> !    if (use->op_p)
> !      print_generic_expr (file, *use->op_p, TDF_SLIM);
> !    fprintf (file, "\n");
> ! 
> !    if (iv->step)
> !      {
> !        fprintf (file, "  base ");
> !        print_generic_expr (file, iv->base, TDF_SLIM);
> !        fprintf (file, "\n");
> ! 
> !        fprintf (file, "  step ");
> !        print_generic_expr (file, iv->step, TDF_SLIM);
> !        fprintf (file, "\n");
> !      }
> !    else
> !      {
> !        fprintf (file, "  invariant ");
> !        print_generic_expr (file, iv->base, TDF_SLIM);
> !        fprintf (file, "\n");
> !      }
>   
> !    fprintf (file, "  related candidates ");
> !    dump_bitmap (file, use->related_cands);
>   }
>   
>   /* Dumps information about the uses to FILE.  */
> --- 362,399 ----
>         gcc_unreachable ();
>       }
>   
> !   fprintf (file, "  in statement ");
> !   print_generic_expr (file, use->stmt, TDF_SLIM);
> !   fprintf (file, "\n");
> ! 
> !   fprintf (file, "  at position ");
> !   if (use->op_p)
> !     print_generic_expr (file, *use->op_p, TDF_SLIM);
> !   fprintf (file, "\n");
> ! 
> !   fprintf (file, "  type ");
> !   print_generic_expr (file, TREE_TYPE (iv->base), TDF_SLIM);
> !   fprintf (file, "\n");
> ! 
> !   if (iv->step)
> !     {
> !       fprintf (file, "  base ");
> !       print_generic_expr (file, iv->base, TDF_SLIM);
> !       fprintf (file, "\n");
> ! 
> !       fprintf (file, "  step ");
> !       print_generic_expr (file, iv->step, TDF_SLIM);
> !       fprintf (file, "\n");
> !     }
> !   else
> !     {
> !       fprintf (file, "  invariant ");
> !       print_generic_expr (file, iv->base, TDF_SLIM);
> !       fprintf (file, "\n");
> !     }
>   
> !   fprintf (file, "  related candidates ");
> !   dump_bitmap (file, use->related_cands);
>   }
>   
>   /* Dumps information about the uses to FILE.  */
> *************** dump_cand (FILE *file, struct iv_cand *c
> *** 438,459 ****
>         break;
>       }
>   
> !    if (iv->step)
> !      {
> !        fprintf (file, "  base ");
> !        print_generic_expr (file, iv->base, TDF_SLIM);
> !        fprintf (file, "\n");
> ! 
> !        fprintf (file, "  step ");
> !        print_generic_expr (file, iv->step, TDF_SLIM);
> !        fprintf (file, "\n");
> !      }
> !    else
> !      {
> !        fprintf (file, "  invariant ");
> !        print_generic_expr (file, iv->base, TDF_SLIM);
> !        fprintf (file, "\n");
> !      }
>   }
>   
>   /* Returns the info for ssa version VER.  */
> --- 446,471 ----
>         break;
>       }
>   
> !   fprintf (file, "  type ");
> !   print_generic_expr (file, TREE_TYPE (iv->base), TDF_SLIM);
> !   fprintf (file, "\n");
> ! 
> !   if (iv->step)
> !     {
> !       fprintf (file, "  base ");
> !       print_generic_expr (file, iv->base, TDF_SLIM);
> !       fprintf (file, "\n");
> ! 
> !       fprintf (file, "  step ");
> !       print_generic_expr (file, iv->step, TDF_SLIM);
> !       fprintf (file, "\n");
> !     }
> !   else
> !     {
> !       fprintf (file, "  invariant ");
> !       print_generic_expr (file, iv->base, TDF_SLIM);
> !       fprintf (file, "\n");
> !     }
>   }
>   
>   /* Returns the info for ssa version VER.  */
> *************** idx_find_step (tree base, tree *idx, voi
> *** 1150,1156 ****
>   {
>     struct ifs_ivopts_data *dta = data;
>     struct iv *iv;
> !   tree step, type, iv_type, iv_step;
>     
>     if (TREE_CODE (*idx) != SSA_NAME)
>       return true;
> --- 1162,1170 ----
>   {
>     struct ifs_ivopts_data *dta = data;
>     struct iv *iv;
> !   tree step, type, iv_type, iv_step, lbound;
> !   basic_block def_bb;
> !   struct loop *loop = dta->ivopts_data->current_loop;
>     
>     if (TREE_CODE (*idx) != SSA_NAME)
>       return true;
> *************** idx_find_step (tree base, tree *idx, voi
> *** 1167,1173 ****
>     iv_type = TREE_TYPE (iv->base);
>     type = build_pointer_type (TREE_TYPE (base));
>     if (TREE_CODE (base) == ARRAY_REF)
> !     step = array_ref_element_size (base);
>     else
>       /* The step for pointer arithmetics already is 1 byte.  */
>       step = build_int_cst (type, 1);
> --- 1181,1210 ----
>     iv_type = TREE_TYPE (iv->base);
>     type = build_pointer_type (TREE_TYPE (base));
>     if (TREE_CODE (base) == ARRAY_REF)
> !     {
> !       step = array_ref_element_size (base);
> !       lbound = array_ref_low_bound (base);
> ! 
> !       /* We only handle addresses whose step is an integer constant.  */
> !       if (TREE_CODE (step) != INTEGER_CST)
> ! 	return false;
> ! 
> !       /* We need the lower bound to be invariant in loop, since otherwise
> ! 	 we are unable to initialize a new induction variable created
> ! 	 in strength reduction -- we need to take the address of the
> ! 	 reference in front of the loop.  */
> !       if (is_gimple_min_invariant (lbound))
> ! 	; /* Nothing to do.  */
> !       else if (TREE_CODE (lbound) != SSA_NAME)
> ! 	return false;
> !       else
> ! 	{
> ! 	  def_bb = bb_for_stmt (SSA_NAME_DEF_STMT (lbound));
> ! 	  if (def_bb
> ! 	      && flow_bb_inside_loop_p (loop, def_bb))
> ! 	    return false;
> ! 	}
> !     }
>     else
>       /* The step for pointer arithmetics already is 1 byte.  */
>       step = build_int_cst (type, 1);
> *************** idx_find_step (tree base, tree *idx, voi
> *** 1198,1207 ****
>      object is passed to it in DATA.  */
>   
>   static bool
> ! idx_record_use (tree base ATTRIBUTE_UNUSED, tree *idx,
>   		void *data)
>   {
>     find_interesting_uses_op (data, *idx);
>     return true;
>   }
>   
> --- 1235,1249 ----
>      object is passed to it in DATA.  */
>   
>   static bool
> ! idx_record_use (tree base, tree *idx,
>   		void *data)
>   {
>     find_interesting_uses_op (data, *idx);
> +   if (TREE_CODE (base) == ARRAY_REF)
> +     {
> +       find_interesting_uses_op (data, array_ref_element_size (base));
> +       find_interesting_uses_op (data, array_ref_low_bound (base));
> +     }
>     return true;
>   }
>   
> *************** find_interesting_uses_stmt (struct ivopt
> *** 1318,1329 ****
>   	default: ;
>   	}
>   
> !       if (TREE_CODE_CLASS (TREE_CODE (lhs)) == 'r')
>   	{
>   	  find_interesting_uses_address (data, stmt, &TREE_OPERAND (stmt, 0));
>   	  find_interesting_uses_op (data, rhs);
>   	  return;
>   	}
>       }
>   
>     if (TREE_CODE (stmt) == PHI_NODE
> --- 1360,1381 ----
>   	default: ;
>   	}
>   
> !       /* Handle memory = gimple_val.  */
> !       if (TREE_CODE_CLASS (TREE_CODE (lhs)) == 'r'
> ! 	  && is_gimple_val (rhs))
>   	{
>   	  find_interesting_uses_address (data, stmt, &TREE_OPERAND (stmt, 0));
>   	  find_interesting_uses_op (data, rhs);
>   	  return;
>   	}
> + 
> +       /* TODO -- we should also handle address uses of type
> + 
> + 	 memory = call (whatever);
> + 
> + 	 and
> + 
> + 	 call (memory).  */
>       }
>   
>     if (TREE_CODE (stmt) == PHI_NODE
> *************** static tree
> *** 1995,2004 ****
>   get_computation_at (struct loop *loop,
>   		    struct iv_use *use, struct iv_cand *cand, tree at)
>   {
> !   tree ubase = unsave_expr_now (use->iv->base);
> !   tree ustep = unsave_expr_now (use->iv->step);
> !   tree cbase = unsave_expr_now (cand->iv->base);
> !   tree cstep = unsave_expr_now (cand->iv->step);
>     tree utype = TREE_TYPE (ubase), ctype = TREE_TYPE (cbase);
>     tree uutype;
>     tree expr, delta;
> --- 2047,2056 ----
>   get_computation_at (struct loop *loop,
>   		    struct iv_use *use, struct iv_cand *cand, tree at)
>   {
> !   tree ubase = use->iv->base;
> !   tree ustep = use->iv->step;
> !   tree cbase = cand->iv->base;
> !   tree cstep = cand->iv->step;
>     tree utype = TREE_TYPE (ubase), ctype = TREE_TYPE (cbase);
>     tree uutype;
>     tree expr, delta;
> *************** iv_value (struct iv *iv, tree niter)
> *** 2905,2911 ****
>     tree type = TREE_TYPE (iv->base);
>   
>     niter = fold_convert (type, niter);
> !   val = fold (build2 (MULT_EXPR, type, iv->step, unsave_expr_now (niter)));
>   
>     return fold (build2 (PLUS_EXPR, type, iv->base, val));
>   }
> --- 2957,2963 ----
>     tree type = TREE_TYPE (iv->base);
>   
>     niter = fold_convert (type, niter);
> !   val = fold (build2 (MULT_EXPR, type, iv->step, niter));
>   
>     return fold (build2 (PLUS_EXPR, type, iv->base, val));
>   }
> *************** rewrite_use_outer (struct ivopts_data *d
> *** 4125,4130 ****
> --- 4177,4183 ----
>   	value = get_computation_at (data->current_loop,
>   				    use, cand, last_stmt (exit->src));
>   
> +       value = unshare_expr (value);
>         op = force_gimple_operand (value, &stmts, true, SSA_NAME_VAR (tgt));
>   	  
>         /* If we will preserve the iv anyway and we would need to perform
> Index: tree-ssa-loop-niter.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-niter.c,v
> retrieving revision 2.7
> diff -c -3 -p -r2.7 tree-ssa-loop-niter.c
> *** tree-ssa-loop-niter.c	5 Sep 2004 15:24:15 -0000	2.7
> --- tree-ssa-loop-niter.c	12 Sep 2004 19:35:03 -0000
> *************** inverse (tree x, tree mask)
> *** 84,105 ****
>     return rslt;
>   }
>   
> - /* Returns unsigned variant of TYPE.  */
> - 
> - tree
> - unsigned_type_for (tree type)
> - {
> -   return make_unsigned_type (TYPE_PRECISION (type));
> - }
> - 
> - /* Returns signed variant of TYPE.  */
> - 
> - static tree
> - signed_type_for (tree type)
> - {
> -   return make_signed_type (TYPE_PRECISION (type));
> - }
> - 
>   /* Determine the number of iterations according to condition (for staying
>      inside loop) which compares two induction variables using comparison
>      operator CODE.  The induction variable on left side of the comparison
> --- 84,89 ----
> Index: tree.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/tree.c,v
> retrieving revision 1.426
> diff -c -3 -p -r1.426 tree.c
> *** tree.c	11 Sep 2004 21:14:38 -0000	1.426
> --- tree.c	12 Sep 2004 19:35:07 -0000
> *************** tree_fold_gcd (tree a, tree b)
> *** 5939,5942 ****
> --- 5939,5958 ----
>       }
>   }
>   
> + /* Returns unsigned variant of TYPE.  */
> + 
> + tree
> + unsigned_type_for (tree type)
> + {
> +   return lang_hooks.types.unsigned_type (type);
> + }
> + 
> + /* Returns signed variant of TYPE.  */
> + 
> + tree
> + signed_type_for (tree type)
> + {
> +   return lang_hooks.types.signed_type (type);
> + }
> + 
>   #include "gt-tree.h"
> Index: tree.h
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/tree.h,v
> retrieving revision 1.619
> diff -c -3 -p -r1.619 tree.h
> *** tree.h	11 Sep 2004 21:14:39 -0000	1.619
> --- tree.h	12 Sep 2004 19:35:09 -0000
> *************** extern tree build_empty_stmt (void);
> *** 2786,2791 ****
> --- 2786,2792 ----
>   
>   extern tree make_signed_type (int);
>   extern tree make_unsigned_type (int);
> + extern tree signed_type_for (tree);
>   extern tree unsigned_type_for (tree);
>   extern void initialize_sizetypes (bool);
>   extern void set_sizetype (tree);
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Ada broken on i686-linux (some progress)
  2004-09-11 20:10 Ada broken on i686-linux (some progress) Zdenek Dvorak
@ 2004-09-12 17:52 ` Laurent GUERBY
  0 siblings, 0 replies; 11+ messages in thread
From: Laurent GUERBY @ 2004-09-12 17:52 UTC (permalink / raw)
  To: Zdenek Dvorak; +Cc: kenner, jh, gcc

Hi Zdenek and Honza, I tried with HEAD plus Zdenek patch and still got
an ICE during stage2 with the following backtrace.

(gdb) r -I- -I. -Iada -I/home/guerby/work/gcc/version-head/gcc/ada -quiet -dumpbase g-os_lib.adb -O2 -g -gnatpg -gnata -mtune=pentiumpro -gnatO ada/g-os_lib.o /home/guerby/work/gcc/version-head/gcc/ada/g-os_lib.adb -o /tmp/cccG1GBc.s
Starting program: /home/guerby/work/gcc/build/build-20040912T182550/gcc/stage1/gnat1 -I- -I. -Iada -I/home/guerby/work/gcc/version-head/gcc/ada -quiet -dumpbase g-os_lib.adb -O2 -g -gnatpg -gnata -mtune=pentiumpro -gnatO ada/g-os_lib.o /home/guerby/work/gcc/version-head/gcc/ada/g-os_lib.adb -o /tmp/cccG1GBc.s
/home/guerby/work/gcc/version-head/gcc/ada/g-os_lib.adb: In function `GNAT.OS_LIB.TO_PATH_STRING_ACCESS':
/home/guerby/work/gcc/version-head/gcc/ada/g-os_lib.adb:2224: error: Definition in block 1 does not dominate use in block 8
for SSA_NAME: D.5632_4
in statement:
ivtmp.654D.6174_59 = &(*return_val$P_ARRAYD.6158_31)[2]{lb: D.5632_4 sz: 1};


Breakpoint 2, internal_error (msgid=0x87d8efd "verify_ssa failed.") at /home/guerby/work/gcc/version-head/gcc/diagnostic.c:543
543	  va_start (ap, msgid);
(gdb) bt
#0  internal_error (msgid=0x87d8efd "verify_ssa failed.") at /home/guerby/work/gcc/version-head/gcc/diagnostic.c:543
During symbol reading, Incomplete CFI data; unspecified registers at 0x08404c71.
During symbol reading, Incomplete CFI data; unspecified registers at 0x08404c71.
During symbol reading, Incomplete CFI data; unspecified registers at 0x08404c71.
During symbol reading, Incomplete CFI data; unspecified registers at 0x08404c71.
During symbol reading, Incomplete CFI data; unspecified registers at 0x08404c71.
During symbol reading, Incomplete CFI data; unspecified registers at 0x08404c71.
During symbol reading, Incomplete CFI data; unspecified registers at 0x08404c71.
#1  0x082f2a93 in verify_ssa () at /home/guerby/work/gcc/version-head/gcc/tree-ssa.c:612
During symbol reading, Incomplete CFI data; unspecified registers at 0x082f2a6f.
During symbol reading, Incomplete CFI data; unspecified registers at 0x082f2a6f.
During symbol reading, Incomplete CFI data; unspecified registers at 0x082f2a6f.
During symbol reading, Incomplete CFI data; unspecified registers at 0x082f2a6f.
During symbol reading, Incomplete CFI data; unspecified registers at 0x082f2a6f.
During symbol reading, Incomplete CFI data; unspecified registers at 0x082f2a6f.
During symbol reading, Incomplete CFI data; unspecified registers at 0x082f2a6f.
#2  0x0837bc6c in verify_loop_closed_ssa () at /home/guerby/work/gcc/version-head/gcc/tree-ssa-loop-manip.c:376
During symbol reading, Incomplete CFI data; unspecified registers at 0x0837bc8d.
During symbol reading, Incomplete CFI data; unspecified registers at 0x0837bc8d.
During symbol reading, Incomplete CFI data; unspecified registers at 0x0837bc8d.
During symbol reading, Incomplete CFI data; unspecified registers at 0x0837bc8d.
During symbol reading, Incomplete CFI data; unspecified registers at 0x0837bc8d.
During symbol reading, Incomplete CFI data; unspecified registers at 0x0837bc8d.
#3  0x083958fd in tree_ssa_iv_optimize (loops=0x8db6310) at /home/guerby/work/gcc/version-head/gcc/tree-ssa-loop-ivopts.c:4424
#4  0x08377249 in tree_ssa_loop_ivopts () at /home/guerby/work/gcc/version-head/gcc/tree-ssa-loop.c:308
#5  0x082f65f9 in execute_one_pass (pass=0x88678e0) at /home/guerby/work/gcc/version-head/gcc/tree-optimize.c:501
#6  0x082f66e5 in execute_pass_list (pass=0x88678e0) at /home/guerby/work/gcc/version-head/gcc/tree-optimize.c:536
#7  0x082f6703 in execute_pass_list (pass=0x8867720) at /home/guerby/work/gcc/version-head/gcc/tree-optimize.c:537
#8  0x082f6703 in execute_pass_list (pass=0x88670a0) at /home/guerby/work/gcc/version-head/gcc/tree-optimize.c:537
#9  0x082f6954 in tree_rest_of_compilation (fndecl=0x40353ae0, nested_p=0 '\0') at /home/guerby/work/gcc/version-head/gcc/tree-optimize.c:618
#10 0x0806f2b0 in gnat_expand_body (gnu_decl=0x40353ae0) at /home/guerby/work/gcc/version-head/gcc/ada/misc.c:652
#11 0x086edfec in cgraph_expand_function (node=0x4043ae0c) at /home/guerby/work/gcc/version-head/gcc/cgraphunit.c:814
#12 0x086efe42 in cgraph_expand_all_functions () at /home/guerby/work/gcc/version-head/gcc/cgraphunit.c:1680
#13 0x086f0130 in cgraph_optimize () at /home/guerby/work/gcc/version-head/gcc/cgraphunit.c:1770
#14 0x0806d7eb in gnat_parse_file (set_yydebug=0) at /home/guerby/work/gcc/version-head/gcc/ada/misc.c:240
#15 0x086783fc in compile_file () at /home/guerby/work/gcc/version-head/gcc/toplev.c:991
#16 0x08679de5 in do_compile () at /home/guerby/work/gcc/version-head/gcc/toplev.c:2096
#17 0x08679e4c in toplev_main (argc=18, argv=0xbffff2f4) at /home/guerby/work/gcc/version-head/gcc/toplev.c:2128
#18 0x082cd286 in main (argc=18, argv=0xbffff2f4) at /home/guerby/work/gcc/version-head/gcc/main.c:35
(gdb) f 3
#3  0x083958fd in tree_ssa_iv_optimize (loops=0x8db6310) at /home/guerby/work/gcc/version-head/gcc/tree-ssa-loop-ivopts.c:4424
4424		  verify_loop_closed_ssa ();
(gdb) f 2
#2  0x0837bc6c in verify_loop_closed_ssa () at /home/guerby/work/gcc/version-head/gcc/tree-ssa-loop-manip.c:376
376	  verify_ssa ();
(gdb) f 1
#1  0x082f2a93 in verify_ssa () at /home/guerby/work/gcc/version-head/gcc/tree-ssa.c:612
612	  internal_error ("verify_ssa failed.");
(gdb) l
607	  free (definition_block);
608	  timevar_pop (TV_TREE_SSA_VERIFY);
609	  return;
610	
611	err:
612	  internal_error ("verify_ssa failed.");
613	}
614	
615	
616	/* Initialize global DFA and SSA structures.  */
(gdb) f 4
#4  0x08377249 in tree_ssa_loop_ivopts () at /home/guerby/work/gcc/version-head/gcc/tree-ssa-loop.c:308
308	  tree_ssa_iv_optimize (current_loops);
(gdb) f 5
#5  0x082f65f9 in execute_one_pass (pass=0x88678e0) at /home/guerby/work/gcc/version-head/gcc/tree-optimize.c:501
501	    pass->execute ();


On x86_64, I got a SEGV while building the RTS


../../xgcc -B../../ -c -g -O2 -fPIC      -W -Wall -gnatpg  g-awk.adb -o g-awk.o
+===========================GNAT BUG DETECTED==============================+
| 4.0.0 20040912 (experimental) (x86_64-unknown-linux-gnu) GCC error:      |
| Segmentation fault                                                       |
| Error detected at g-awk.adb:1316:24                                      |

It is happening during garbage collection:

gt_ggc_mx_lang_tree_node
...
#139 0x00000000004271ea in gt_ggc_mx_lang_tree_node (x_p=Variable "x_p" is not available.
) at gtype-ada.h:185
#140 0x00000000004271ea in gt_ggc_mx_lang_tree_node (x_p=Variable "x_p" is not available.
) at gtype-ada.h:185
#141 0x00000000004271ea in gt_ggc_mx_lang_tree_node (x_p=Variable "x_p" is not available.
) at gtype-ada.h:185
#142 0x00000000007bc266 in gt_ggc_mx_dataflow_d (x_p=Variable "x_p" is not available.
) at gtype-desc.c:288
#143 0x00000000007c3c45 in gt_ggc_mx_tree_ann_d (x_p=Variable "x_p" is not available.
) at gtype-desc.c:365
#144 0x0000000000426f9a in gt_ggc_mx_lang_tree_node (x_p=Variable "x_p" is not available.
) at gtype-ada.h:162
#145 0x000000000042712a in gt_ggc_mx_lang_tree_node (x_p=Variable "x_p" is not available.
) at gtype-ada.h:178
#146 0x00000000007bc167 in gt_ggc_mx_varray_head_tag (x_p=Variable "x_p" is not available.
) at gtype-desc.c:533
#147 0x00000000007b7e6f in ggc_mark_roots () at /home/guerby/work/gcc/version-head/gcc/ggc-common.c:118
#148 0x0000000000960227 in ggc_collect () at /home/guerby/work/gcc/version-head/gcc/ggc-page.c:1968
#149 0x000000000065f37c in execute_todo (properties=732, flags=15) at /home/guerby/work/gcc/version-head/gcc/tree-optimize.c:438
#150 0x000000000065f5a8 in execute_pass_list (pass=0x11bfb50) at /home/guerby/work/gcc/version-head/gcc/tree-optimize.c:512
#151 0x000000000065f5d5 in execute_pass_list (pass=0xc55500) at /home/guerby/work/gcc/version-head/gcc/tree-optimize.c:537
#152 0x000000000065f855 in tree_rest_of_compilation (fndecl=0x2a96060e00, nested_p=0 '\0') at /home/guerby/work/gcc/version-head/gcc/tree-optimize.c:618
#153 0x000000000098df13 in cgraph_expand_function (node=0x2a95a85000) at /home/guerby/work/gcc/version-head/gcc/cgraphunit.c:814
#154 0x000000000098f842 in cgraph_optimize () at /home/guerby/work/gcc/version-head/gcc/cgraphunit.c:1680
#155 0x000000000093732f in toplev_main (argc=Variable "argc" is not available.
) at /home/guerby/work/gcc/version-head/gcc/toplev.c:991
#156 0x0000002a95688e5d in __libc_start_main () from /lib64/tls/libc.so.6
#157 0x000000000040297a in _start () at ../sysdeps/x86_64/elf/start.S:96
(gdb) f 1
#1  0x00000000007bbb88 in gt_ggc_mx_basic_block_def (x_p=Variable "x_p" is not available.
) at gtype-desc.c:429
429       while (ggc_test_and_set_mark (xlimit))

Laurent

On Sat, 2004-09-11 at 21:02, Zdenek Dvorak wrote:
> Hello,
> 
> > >     It would be usefull to know the backtraces at least here.  The
> > >     second
> > >     problem looks like yet another tree node sharing problem, so in
> > >     the
> > >     case the failure is within tree-ssa-loop-ivopts, I will try to add
> > >     more of unsave_exprs to uses that might result in sharing and lets
> > >     see
> > >     if it fix it.
> > > 
> > > I can confirm this is a loop issue because it doesn't happen when
> > > I disable loop optimizations.
> > 
> > I will try to add the unsaves to dubious places in ivops tomorrow then.
> > Ot helped in other cases with the same symptom.
> 
> could you please check whether this patch helps?
> 
> Zdenek
> 
> Index: tree-ssa-loop-ivopts.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-ivopts.c,v
> retrieving revision 2.9
> diff -c -3 -p -r2.9 tree-ssa-loop-ivopts.c
> *** tree-ssa-loop-ivopts.c	10 Sep 2004 08:56:36 -0000	2.9
> --- tree-ssa-loop-ivopts.c	11 Sep 2004 17:15:30 -0000
> *************** static tree
> *** 1995,2004 ****
>   get_computation_at (struct loop *loop,
>   		    struct iv_use *use, struct iv_cand *cand, tree at)
>   {
> !   tree ubase = unsave_expr_now (use->iv->base);
> !   tree ustep = unsave_expr_now (use->iv->step);
> !   tree cbase = unsave_expr_now (cand->iv->base);
> !   tree cstep = unsave_expr_now (cand->iv->step);
>     tree utype = TREE_TYPE (ubase), ctype = TREE_TYPE (cbase);
>     tree uutype;
>     tree expr, delta;
> --- 2007,2016 ----
>   get_computation_at (struct loop *loop,
>   		    struct iv_use *use, struct iv_cand *cand, tree at)
>   {
> !   tree ubase = use->iv->base;
> !   tree ustep = use->iv->step;
> !   tree cbase = cand->iv->base;
> !   tree cstep = cand->iv->step;
>     tree utype = TREE_TYPE (ubase), ctype = TREE_TYPE (cbase);
>     tree uutype;
>     tree expr, delta;
> *************** iv_value (struct iv *iv, tree niter)
> *** 2905,2911 ****
>     tree type = TREE_TYPE (iv->base);
>   
>     niter = fold_convert (type, niter);
> !   val = fold (build2 (MULT_EXPR, type, iv->step, unsave_expr_now (niter)));
>   
>     return fold (build2 (PLUS_EXPR, type, iv->base, val));
>   }
> --- 2917,2923 ----
>     tree type = TREE_TYPE (iv->base);
>   
>     niter = fold_convert (type, niter);
> !   val = fold (build2 (MULT_EXPR, type, iv->step, niter));
>   
>     return fold (build2 (PLUS_EXPR, type, iv->base, val));
>   }
> *************** rewrite_use_outer (struct ivopts_data *d
> *** 4125,4130 ****
> --- 4137,4143 ----
>   	value = get_computation_at (data->current_loop,
>   				    use, cand, last_stmt (exit->src));
>   
> +       value = unshare_expr (value);
>         op = force_gimple_operand (value, &stmts, true, SSA_NAME_VAR (tgt));
>   	  
>         /* If we will preserve the iv anyway and we would need to perform
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Ada broken on i686-linux (some progress)
@ 2004-09-11 20:10 Zdenek Dvorak
  2004-09-12 17:52 ` Laurent GUERBY
  0 siblings, 1 reply; 11+ messages in thread
From: Zdenek Dvorak @ 2004-09-11 20:10 UTC (permalink / raw)
  To: kenner; +Cc: jh, gcc

Hello,

> >     It would be usefull to know the backtraces at least here.  The
> >     second
> >     problem looks like yet another tree node sharing problem, so in
> >     the
> >     case the failure is within tree-ssa-loop-ivopts, I will try to add
> >     more of unsave_exprs to uses that might result in sharing and lets
> >     see
> >     if it fix it.
> > 
> > I can confirm this is a loop issue because it doesn't happen when
> > I disable loop optimizations.
> 
> I will try to add the unsaves to dubious places in ivops tomorrow then.
> Ot helped in other cases with the same symptom.

could you please check whether this patch helps?

Zdenek

Index: tree-ssa-loop-ivopts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-ivopts.c,v
retrieving revision 2.9
diff -c -3 -p -r2.9 tree-ssa-loop-ivopts.c
*** tree-ssa-loop-ivopts.c	10 Sep 2004 08:56:36 -0000	2.9
--- tree-ssa-loop-ivopts.c	11 Sep 2004 17:15:30 -0000
*************** static tree
*** 1995,2004 ****
  get_computation_at (struct loop *loop,
  		    struct iv_use *use, struct iv_cand *cand, tree at)
  {
!   tree ubase = unsave_expr_now (use->iv->base);
!   tree ustep = unsave_expr_now (use->iv->step);
!   tree cbase = unsave_expr_now (cand->iv->base);
!   tree cstep = unsave_expr_now (cand->iv->step);
    tree utype = TREE_TYPE (ubase), ctype = TREE_TYPE (cbase);
    tree uutype;
    tree expr, delta;
--- 2007,2016 ----
  get_computation_at (struct loop *loop,
  		    struct iv_use *use, struct iv_cand *cand, tree at)
  {
!   tree ubase = use->iv->base;
!   tree ustep = use->iv->step;
!   tree cbase = cand->iv->base;
!   tree cstep = cand->iv->step;
    tree utype = TREE_TYPE (ubase), ctype = TREE_TYPE (cbase);
    tree uutype;
    tree expr, delta;
*************** iv_value (struct iv *iv, tree niter)
*** 2905,2911 ****
    tree type = TREE_TYPE (iv->base);
  
    niter = fold_convert (type, niter);
!   val = fold (build2 (MULT_EXPR, type, iv->step, unsave_expr_now (niter)));
  
    return fold (build2 (PLUS_EXPR, type, iv->base, val));
  }
--- 2917,2923 ----
    tree type = TREE_TYPE (iv->base);
  
    niter = fold_convert (type, niter);
!   val = fold (build2 (MULT_EXPR, type, iv->step, niter));
  
    return fold (build2 (PLUS_EXPR, type, iv->base, val));
  }
*************** rewrite_use_outer (struct ivopts_data *d
*** 4125,4130 ****
--- 4137,4143 ----
  	value = get_computation_at (data->current_loop,
  				    use, cand, last_stmt (exit->src));
  
+       value = unshare_expr (value);
        op = force_gimple_operand (value, &stmts, true, SSA_NAME_VAR (tgt));
  	  
        /* If we will preserve the iv anyway and we would need to perform

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Ada broken on i686-linux (some progress)
@ 2004-09-11 14:16 Richard Kenner
  0 siblings, 0 replies; 11+ messages in thread
From: Richard Kenner @ 2004-09-11 14:16 UTC (permalink / raw)
  To: hubicka; +Cc: gcc

    My problem is actually that GDB crash on gnat executable without even
    producing backtrace for crash within C part of the binarry making almost
    every debugging very inconvenient.

    Perhaps update will solve that..

I doubt it.  I've seen this in the past and it's been a GDB problem.
The latest GDB version does this less often but it does still happen and
is indeed quite annoying when it does.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Ada broken on i686-linux (some progress)
  2004-09-10 12:09 Richard Kenner
@ 2004-09-11  3:19 ` Jan Hubicka
  0 siblings, 0 replies; 11+ messages in thread
From: Jan Hubicka @ 2004-09-11  3:19 UTC (permalink / raw)
  To: Richard Kenner; +Cc: jh, gcc

>     It would be usefull to know the backtraces at least here.  The second
>     problem looks like yet another tree node sharing problem, so in the
>     case the failure is within tree-ssa-loop-ivopts, I will try to add
>     more of unsave_exprs to uses that might result in sharing and lets see
>     if it fix it.
> 
> I can confirm this is a loop issue because it doesn't happen when
> I disable loop optimizations.

I will try to add the unsaves to dubious places in ivops tomorrow then.
Ot helped in other cases with the same symptom.
> 
>     What is the current situation of ada aware gdb?  I used to have one but
>     it no longer works on 3.5 GCC produced dwarf and the default in my
>     instalation just die horribly seeing ada.
> 
> I almost never used an Ada-aware GDB even in the few times I'm
> debugging in the Ada part of the front end.  I am indeed having

My problem is actually that GDB crash on gnat executable without even
producing backtrace for crash within C part of the binarry making almost
every debugging very inconvenient.

Perhaps update will solve that..
Honza

> problems finding a GDB that works well with 4.0-GCC-produced code, but
> it does not seem related to Ada per se: it appears that it's just like
> other issues where Ada produces more complex code that triggers latent
> bugs either in debug output creation or reading.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Ada broken on i686-linux (some progress)
@ 2004-09-10 12:09 Richard Kenner
  2004-09-11  3:19 ` Jan Hubicka
  0 siblings, 1 reply; 11+ messages in thread
From: Richard Kenner @ 2004-09-10 12:09 UTC (permalink / raw)
  To: jh; +Cc: gcc

    It would be usefull to know the backtraces at least here.  The second
    problem looks like yet another tree node sharing problem, so in the
    case the failure is within tree-ssa-loop-ivopts, I will try to add
    more of unsave_exprs to uses that might result in sharing and lets see
    if it fix it.

I can confirm this is a loop issue because it doesn't happen when
I disable loop optimizations.

    What is the current situation of ada aware gdb?  I used to have one but
    it no longer works on 3.5 GCC produced dwarf and the default in my
    instalation just die horribly seeing ada.

I almost never used an Ada-aware GDB even in the few times I'm
debugging in the Ada part of the front end.  I am indeed having
problems finding a GDB that works well with 4.0-GCC-produced code, but
it does not seem related to Ada per se: it appears that it's just like
other issues where Ada produces more complex code that triggers latent
bugs either in debug output creation or reading.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Ada broken on i686-linux (some progress)
  2004-09-09 21:49           ` Ada broken on i686-linux (some progress) Laurent GUERBY
@ 2004-09-10  9:38             ` Jan Hubicka
  0 siblings, 0 replies; 11+ messages in thread
From: Jan Hubicka @ 2004-09-10  9:38 UTC (permalink / raw)
  To: Laurent GUERBY; +Cc: Jan Hubicka, Arnaud Charlet, Nathan Sidwell, gcc, uros

> With mainline plus your patch, on x86_64 it gets past the a-ngelfu.adb
> failure but it ICE later in the RTS build:
> 
> ../../xgcc -B../../ -c -g -O2 -fPIC      -W -Wall -gnatpg  g-exctra.adb -o g-exctra.o
> +===========================GNAT BUG DETECTED==============================+
> | 3.5.0 20040909 (experimental) (x86_64-unknown-linux-gnu) GCC error:      |
> | in var_ann, at tree-flow-inline.h:34                                     |
> | Error detected at g-exctra.adb:127:1                                     |
> 
> On x86, it fails mid stage2:
> 
> stage1/xgcc -Bstage1/ -B/home/guerby/work/gcc/install/install-20040909T225159/i686-pc-linux-gnu/bin/ -c -g -O2      -gnatpg -gnata -I- -I. -Iada -I/home/guerby/work/gcc/version-head/gcc/ada /home/guerby/work/gcc/version-head/gcc/ada/g-os_lib.adb -o ada/g-os_lib.o
> /home/guerby/work/gcc/version-head/gcc/ada/g-os_lib.adb: In function `GNAT.OS_LIB.TO_PATH_STRING_ACCESS':
> /home/guerby/work/gcc/version-head/gcc/ada/g-os_lib.adb:2224: error: Definition in block 1 does not dominate use in block 8
> for SSA_NAME: T.2976<D5632>_4
> in statement:
> ivtmp.3319<D6204>_59 = &(*return_val$P_ARRAY<D6188>_31)[2]{lb: T.2976<D5632>_4 sz: 1};

It would be usefull to know the backtraces at least here.  The second
problem looks like yet another tree node sharing problem, so in the case
the failure is within tree-ssa-loop-ivopts, I will try to add more of
unsave_exprs to uses that might result in sharing and lets see if it fix
it.

I dunno what is going wrong in the first case just from the failure
reported.

What is the current situation of ada aware gdb?  I used to have one but
it no longer works on 3.5 GCC produced dwarf and the default in my
instalation just die horribly seeing ada.

Honza

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Ada broken on i686-linux (some progress)
@ 2004-09-09 22:08 Richard Kenner
  0 siblings, 0 replies; 11+ messages in thread
From: Richard Kenner @ 2004-09-09 22:08 UTC (permalink / raw)
  To: laurent; +Cc: gcc

Most of those errors I've seen (and reported most).  I just tried a build
that disabled all loop optimizations (in tree-optimize.c).  That works
a lot better, though the ACATS profile is poor (mostly due to a
multiple definition s-fatgen.adb).

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Ada broken on i686-linux (some progress)
  2004-09-09 17:24         ` Jan Hubicka
@ 2004-09-09 21:49           ` Laurent GUERBY
  2004-09-10  9:38             ` Jan Hubicka
  0 siblings, 1 reply; 11+ messages in thread
From: Laurent GUERBY @ 2004-09-09 21:49 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: Arnaud Charlet, Nathan Sidwell, gcc, uros

With mainline plus your patch, on x86_64 it gets past the a-ngelfu.adb
failure but it ICE later in the RTS build:

../../xgcc -B../../ -c -g -O2 -fPIC      -W -Wall -gnatpg  g-exctra.adb -o g-exctra.o
+===========================GNAT BUG DETECTED==============================+
| 3.5.0 20040909 (experimental) (x86_64-unknown-linux-gnu) GCC error:      |
| in var_ann, at tree-flow-inline.h:34                                     |
| Error detected at g-exctra.adb:127:1                                     |

On x86, it fails mid stage2:

stage1/xgcc -Bstage1/ -B/home/guerby/work/gcc/install/install-20040909T225159/i686-pc-linux-gnu/bin/ -c -g -O2      -gnatpg -gnata -I- -I. -Iada -I/home/guerby/work/gcc/version-head/gcc/ada /home/guerby/work/gcc/version-head/gcc/ada/g-os_lib.adb -o ada/g-os_lib.o
/home/guerby/work/gcc/version-head/gcc/ada/g-os_lib.adb: In function `GNAT.OS_LIB.TO_PATH_STRING_ACCESS':
/home/guerby/work/gcc/version-head/gcc/ada/g-os_lib.adb:2224: error: Definition in block 1 does not dominate use in block 8
for SSA_NAME: T.2976<D5632>_4
in statement:
ivtmp.3319<D6204>_59 = &(*return_val$P_ARRAY<D6188>_31)[2]{lb: T.2976<D5632>_4 sz: 1};

+===========================GNAT BUG DETECTED==============================+
| 3.5.0 20040909 (experimental) (i686-pc-linux-gnu) verify_ssa failed.     |
| Error detected at g-os_lib.adb:2279:1                                    |

Laurent

On Thu, 2004-09-09 at 17:29, Jan Hubicka wrote:
> > > This can be worked around compiling with -O0, so I'll try a bootstrap with
> > > everything built at -O0 to see whether I can get at least a successful build
> > > and commit my pending changes.
> > 
> > Well, I am now hitting the crash already mentioned by Richard and Laurent
> > on x86_64:
> > 
> > <<
> > ../../xgcc -B../../ -c -g -O0 -fPIC      -W -Wall -gnatpg  a-ncelfu.ads -o a-ncelfu.o
> > +===========================GNAT BUG DETECTED==============================+
> > | 3.5.0 20040909 (experimental) (i686-pc-linux-gnu) GCC error:             |
> > | in optimize_mode_switching, at lcm.c:1225                                |
> > | Error detected at a-ngelfu.adb:172:16 [a-ngcefu.adb:38:4 [a-ncelfu.ads:19:1]]|>>
> 
> This should be fixed by this patch (this problem is also reproduced by
> i686 build).  As discussed with Uros, the current implementation is not
> perfect as the mode switching generates unnecesary initializations of
> the varioius control words and then it generates too many loads of
> control word from them but still it is better than old implementation,
> so I would commit it before we get into the more proper sollution.
> 
> I think we might get around the first problem by using separate entities
> for each mode we want, but still it will generate unnecesary loads of
> the global control word that might be avoided by tricking it to be
> special entity 0.  The second problem might be solved either by XFmode
> spilling or post-reload optimize_mode_switching pass inserting the
> control word loads.
> 
> Bot since it is somewhat involved, I've bootstrapped/regtested the
> attached patch i686-pc-gnu-linux, OK?
> 
> double sqrt(double);
> 
> template <typename T> class arr
>   {
>   private:
>     long s;
>     T *d;
> 
>   public:
>     arr() : s(0), d(0) {}
>     ~arr() { delete[] d; }
> 
>     void alloc (long sz);
>     const T &operator[] (long n) const {return d[n];}
>   };
> 
> void blah ()
>   {
>   arr<int> index;
>   index.alloc(10);
>   for (int i=0; i<10; ++i)
>     {
>     int l = int(sqrt(index[0]));
>     if (l<0) throw 2;
>     }
>   }
> 
> Honza
> 
> Index: config/i386/i386.h
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.h,v
> retrieving revision 1.400
> diff -c -3 -p -r1.400 i386.h
> *** config/i386/i386.h	4 Sep 2004 07:55:07 -0000	1.400
> --- config/i386/i386.h	9 Sep 2004 08:18:02 -0000
> *************** extern rtx ix86_compare_op1;	/* operand 
> *** 2966,2972 ****
>     (GET_CODE (I) == CALL_INSN						\
>      || (GET_CODE (I) == INSN && (asm_noperands (PATTERN (I)) >= 0 	\
>   				|| GET_CODE (PATTERN (I)) == ASM_INPUT))\
> !    ? I387_CW_ANY 							\
>      : recog_memoized (I) < 0						\
>      ? I387_CW_ANY 							\
>      : get_attr_i387_cw (I))
> --- 2966,2972 ----
>     (GET_CODE (I) == CALL_INSN						\
>      || (GET_CODE (I) == INSN && (asm_noperands (PATTERN (I)) >= 0 	\
>   				|| GET_CODE (PATTERN (I)) == ASM_INPUT))\
> !    ? I387_CW_UNINITIALIZED						\
>      : recog_memoized (I) < 0						\
>      ? I387_CW_ANY 							\
>      : get_attr_i387_cw (I))
> *************** extern rtx ix86_compare_op1;	/* operand 
> *** 2981,2987 ****
>      are to be inserted.  */
>   
>   #define EMIT_MODE_SET(ENTITY, MODE, HARD_REGS_LIVE) 			\
> !   ((MODE) != I387_CW_ANY						\
>      ? emit_i387_cw_initialization (assign_386_stack_local (HImode, 1),	\
>   				  assign_386_stack_local (HImode, 2),   \
>   				  MODE), 0				\
> --- 2981,2987 ----
>      are to be inserted.  */
>   
>   #define EMIT_MODE_SET(ENTITY, MODE, HARD_REGS_LIVE) 			\
> !   ((MODE) != I387_CW_ANY && (MODE) != I387_CW_UNINITIALIZED		\
>      ? emit_i387_cw_initialization (assign_386_stack_local (HImode, 1),	\
>   				  assign_386_stack_local (HImode, 2),   \
>   				  MODE), 0				\
> Index: config/i386/i386.md
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.md,v
> retrieving revision 1.558
> diff -c -3 -p -r1.558 i386.md
> *** config/i386/i386.md	8 Sep 2004 05:08:26 -0000	1.558
> --- config/i386/i386.md	9 Sep 2004 08:18:03 -0000
> ***************
> *** 431,437 ****
>   
>   ;; Defines rounding mode of an FP operation.
>   
> ! (define_attr "i387_cw" "floor,ceil,trunc,mask_pm,any"
>     (const_string "any"))
>   
>   ;; Describe a user's asm statement.
> --- 431,437 ----
>   
>   ;; Defines rounding mode of an FP operation.
>   
> ! (define_attr "i387_cw" "floor,ceil,trunc,mask_pm,uninitialized,any"
>     (const_string "any"))
>   
>   ;; Describe a user's asm statement.
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2004-09-12 21:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-12  3:56 Ada broken on i686-linux (some progress) Richard Kenner
2004-09-12 22:12 ` Zdenek Dvorak
2004-09-12 23:33   ` Ada broken on i686-linux (some more progress) Laurent GUERBY
  -- strict thread matches above, loose matches on Subject: below --
2004-09-11 20:10 Ada broken on i686-linux (some progress) Zdenek Dvorak
2004-09-12 17:52 ` Laurent GUERBY
2004-09-11 14:16 Richard Kenner
2004-09-10 12:09 Richard Kenner
2004-09-11  3:19 ` Jan Hubicka
2004-09-09 22:08 Richard Kenner
2004-09-09 10:28 Ada broken on i686-linux Arnaud Charlet
2004-09-09 10:41 ` Nathan Sidwell
2004-09-09 10:47   ` Arnaud Charlet
2004-09-09 16:14     ` Arnaud Charlet
2004-09-09 17:04       ` Arnaud Charlet
2004-09-09 17:24         ` Jan Hubicka
2004-09-09 21:49           ` Ada broken on i686-linux (some progress) Laurent GUERBY
2004-09-10  9:38             ` Jan Hubicka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).