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 lint: do not sign-extend pointers



details:   https://anonhg.NetBSD.org/src/rev/44bc095c2a42
branches:  trunk
changeset: 379976:44bc095c2a42
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Jun 29 20:44:38 2021 +0000

description:
lint: do not sign-extend pointers

Sign extension only makes sense for integer types.

No idea why the code had tried to sign-extend pointers for the past 26
years.

diffstat:

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

diffs (43 lines):

diff -r 1c314cccacf9 -r 44bc095c2a42 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Tue Jun 29 14:19:51 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Tue Jun 29 20:44:38 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.296 2021/06/29 14:19:51 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.297 2021/06/29 20:44:38 rillig 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.296 2021/06/29 14:19:51 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.297 2021/06/29 20:44:38 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -2401,15 +2401,7 @@ convert_constant(op_t op, int arg, const
                v->v_unsigned_since_c90 = false;
        }
 
-       switch (nt) {
-       case FLOAT:
-       case FCOMPLEX:
-       case DOUBLE:
-       case DCOMPLEX:
-       case LDOUBLE:
-       case LCOMPLEX:
-               break;
-       default:
+       if (is_integer(nt)) {
                /*
                 * FIXME: There must be no sign extension when converting
                 *  from int to char on a platform where char == unsigned
@@ -2417,7 +2409,6 @@ convert_constant(op_t op, int arg, const
                 */
                sz = tp->t_bitfield ? tp->t_flen : size_in_bits(nt);
                nv->v_quad = xsign(nv->v_quad, nt, sz);
-               break;
        }
 
        if (range_check && op != CVT)



Home | Main Index | Thread Index | Old Index