This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix crash in c-typeck.c:comptypes() (PR3952)
- To: gcc-patches at gcc dot gnu dot org
- Subject: [PATCH] Fix crash in c-typeck.c:comptypes() (PR3952)
- From: Franz Sirl <Franz dot Sirl-kernel at lauterbach dot com>
- Date: Mon, 27 Aug 2001 22:05:53 +0200
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