This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR28776, ICE in build_polynomial_chrec


This fixes an ICE triggered by us missing to convert the arguments
of the arithmetic expression we're going to fold to the expressions
type.

Bootstrapped and tested on x86_64-unknown-linux-gnu for all languages
including ada but omitting java (libjava is broken).

Ok for mainline?

Thanks,
Richard.

:ADDPATCH middle-end:

2006-08-22  Richard Guenther  <rguenther@suse.de>

	PR middle-end/28776
	* tree-scalar-evolution.c (fold_used_pointer): Convert
	arguments to arithmetic expression to the chrecs type.

	* gcc.c-torture/compile/pr28776-1.c: New testcase.
	* gcc.c-torture/compile/pr28776-2.c: Likewise.

Index: tree-scalar-evolution.c
===================================================================
*** tree-scalar-evolution.c	(revision 116318)
--- tree-scalar-evolution.c	(working copy)
*************** fold_used_pointer (tree expr)
*** 1847,1852 ****
--- 1847,1854 ----
        if (new0 == op0 && new1 == op1)
  	return expr;
  
+       new0 = chrec_convert (TREE_TYPE (expr), new0, NULL_TREE);
+       new1 = chrec_convert (TREE_TYPE (expr), new1, NULL_TREE);
        if (code == PLUS_EXPR)
  	expr = chrec_fold_plus (TREE_TYPE (expr), new0, new1);
        else
Index: testsuite/gcc.c-torture/compile/pr28776-1.c
===================================================================
*** testsuite/gcc.c-torture/compile/pr28776-1.c	(revision 0)
--- testsuite/gcc.c-torture/compile/pr28776-1.c	(revision 0)
***************
*** 0 ****
--- 1,16 ----
+ typedef struct dw_fde_struct
+ {
+   int decl;
+ } *dw_fde_ref;
+ dw_fde_ref fde_table;
+ unsigned fde_table_in_use;
+ void output_call_frame_info (void)
+ {
+   unsigned int i;
+   dw_fde_ref fde;
+   for (i = 0; i < fde_table_in_use; i++)
+     {
+       fde = &fde_table[i];
+       tree_contains_struct_check_failed (fde_table[i].decl);
+     }
+ }
Index: testsuite/gcc.c-torture/compile/pr28776-2.c
===================================================================
*** testsuite/gcc.c-torture/compile/pr28776-2.c	(revision 0)
--- testsuite/gcc.c-torture/compile/pr28776-2.c	(revision 0)
***************
*** 0 ****
--- 1,26 ----
+ typedef struct RangeCoder
+ {
+     unsigned char one_state[256];
+ } RangeCoder;
+ static inline void put_rac(RangeCoder *c, unsigned char* const state)
+ {
+   *state= c->one_state[*state];
+ }
+ typedef struct PlaneContext{
+     unsigned (*state)[32];
+ } PlaneContext;
+ static inline void put_symbol(RangeCoder *c, unsigned char *state)
+ {
+     int i;
+     const int e;
+     put_rac(c, state);
+     for(i=e-1; i>=0; i--)
+       put_rac(c, state+22+i);
+ }
+ int encode_line(void)
+ {
+     PlaneContext * const p;
+     RangeCoder * const c;
+     int a;
+     put_symbol(c, p->state[a]);
+ }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]