Module Name: src
Committed By: christos
Date: Mon Feb 9 18:17:34 UTC 2015
Modified Files:
src/usr.bin/xlint/lint1: tree.c
Log Message:
Treat complex numbers like other floating numbers. This caused a core-dump
when linting libm complex code and assumed the size of the type larger than
the array size of value bitmaps.
To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/usr.bin/xlint/lint1/tree.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.77 src/usr.bin/xlint/lint1/tree.c:1.78
--- src/usr.bin/xlint/lint1/tree.c:1.77 Thu Nov 20 16:17:18 2014
+++ src/usr.bin/xlint/lint1/tree.c Mon Feb 9 13:17:34 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.77 2014/11/20 21:17:18 christos Exp $ */
+/* $NetBSD: tree.c,v 1.78 2015/02/09 18:17:34 christos Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.77 2014/11/20 21:17:18 christos Exp $");
+__RCSID("$NetBSD: tree.c,v 1.78 2015/02/09 18:17:34 christos Exp $");
#endif
#include <stdlib.h>
@@ -2002,9 +2002,18 @@ cvtcon(op_t op, int arg, type_t *tp, val
v->v_ansiu = 0;
}
- if (nt != FLOAT && nt != DOUBLE && nt != LDOUBLE) {
+ switch (nt) {
+ case FLOAT:
+ case FCOMPLEX:
+ case DOUBLE:
+ case DCOMPLEX:
+ case LDOUBLE:
+ case LCOMPLEX:
+ break;
+ default:
sz = tp->t_isfield ? tp->t_flen : size(nt);
nv->v_quad = xsign(nv->v_quad, nt, sz);
+ break;
}
if (rchk && op != CVT) {