Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint1 Treat complex numbers like other floatin...



details:   https://anonhg.NetBSD.org/src/rev/ae167cf0359e
branches:  trunk
changeset: 336066:ae167cf0359e
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Feb 09 18:17:34 2015 +0000

description:
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.

diffstat:

 usr.bin/xlint/lint1/tree.c |  15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diffs (38 lines):

diff -r f43228261f71 -r ae167cf0359e usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Mon Feb 09 17:48:07 2015 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Mon Feb 09 18:17:34 2015 +0000
@@ -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 @@
                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) {



Home | Main Index | Thread Index | Old Index