fix c/5615

Richard Henderson rth@redhat.com
Wed Feb 20 11:15:00 GMT 2002


The problem here is that size_binop was aborting because the
two arguments didn't have the same type.  In this case, SIZE.var
was type sizetype instead of ssizetype as documented.


r~


        PR c/5615
        * expr.h (ARGS_SIZE_TREE): Convert size.var to ssizetype.

Index: expr.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.h,v
retrieving revision 1.108
diff -u -p -r1.108 expr.h
--- expr.h	2001/12/12 02:47:53	1.108
+++ expr.h	2002/02/20 18:27:11
@@ -97,7 +97,8 @@ struct args_size
    of type ssizetype.  */
 #define ARGS_SIZE_TREE(SIZE)					\
 ((SIZE).var == 0 ? ssize_int ((SIZE).constant)			\
- : size_binop (PLUS_EXPR, (SIZE).var, ssize_int ((SIZE).constant)))
+ : size_binop (PLUS_EXPR, convert (ssizetype, (SIZE).var),	\
+	       ssize_int ((SIZE).constant)))
 
 /* Convert the implicit sum in a `struct args_size' into an rtx.  */
 #define ARGS_SIZE_RTX(SIZE)					\
Index: gcc.c-torture/compile/20020210-1.c
===================================================================
RCS file: 20020210-1.c
diff -N 20020210-1.c
--- /dev/null	Tue May  5 13:32:27 1998
+++ 20020210-1.c	Wed Feb 20 10:28:50 2002
@@ -0,0 +1,2 @@
+/* PR c/5615 */
+void f(int a, struct {int b[a];} c) {}



More information about the Gcc-patches mailing list