Module Name:    src
Committed By:   rillig
Date:           Tue Jun 29 20:44:38 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint1: tree.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.296 -r1.297 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.296 src/usr.bin/xlint/lint1/tree.c:1.297
--- src/usr.bin/xlint/lint1/tree.c:1.296	Tue Jun 29 14:19:51 2021
+++ src/usr.bin/xlint/lint1/tree.c	Tue Jun 29 20:44:38 2021
@@ -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)

Reply via email to