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]

[PATCH] Fix crash in c-typeck.c:comptypes() (PR3952)


Hi,

this little patch fixes a crash in comptypes (PR3952). AFAICS maxval can 
legally be unset here.

Bootstrapped without regressions on powerpc-linux-gnu.
OK to commit to mainline and branch?

Franz.

        PR c/3952
        * c-typeck.c (comptypes): Don't crash if maxval is unset.

Index: gcc/c-typeck.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-typeck.c,v
retrieving revision 1.133
diff -u -p -r1.133 c-typeck.c
--- gcc/c-typeck.c	2001/08/24 12:07:40	1.133
+++ gcc/c-typeck.c	2001/08/26 22:34:28
@@ -514,6 +514,7 @@ comptypes (type1, type2)
 
 	/* Sizes must match unless one is missing or variable.  */
 	if (d1 == 0 || d2 == 0 || d1 == d2
+	    || ! TYPE_MAX_VALUE (d1) || ! TYPE_MAX_VALUE (d2)
 	    || TREE_CODE (TYPE_MIN_VALUE (d1)) != INTEGER_CST
 	    || TREE_CODE (TYPE_MIN_VALUE (d2)) != INTEGER_CST
 	    || TREE_CODE (TYPE_MAX_VALUE (d1)) != INTEGER_CST

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