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: fix converting a complex floating-...



details:   https://anonhg.NetBSD.org/src/rev/4d28ed76ae11
branches:  trunk
changeset: 374235:4d28ed76ae11
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Apr 11 19:40:04 2023 +0000

description:
lint: fix converting a complex floating-point constant

The complex '+' in msg_142 line 27 led to an invalid floating point
value when converting from 'double' to '_Complex double'.

diffstat:

 usr.bin/xlint/lint1/tree.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (33 lines):

diff -r af8791f31bf6 -r 4d28ed76ae11 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c        Tue Apr 11 19:07:08 2023 +0000
+++ b/usr.bin/xlint/lint1/tree.c        Tue Apr 11 19:40:04 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tree.c,v 1.510 2023/04/11 19:07:08 rillig Exp $        */
+/*     $NetBSD: tree.c,v 1.511 2023/04/11 19:40:04 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: tree.c,v 1.510 2023/04/11 19:07:08 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.511 2023/04/11 19:40:04 rillig Exp $");
 #endif
 
 #include <float.h>
@@ -3646,11 +3646,11 @@ convert_constant_floating(op_t op, int a
                v->v_ldbl = v->v_ldbl > 0 ? max : min;
        }
 
-       if (nt == FLOAT) {
+       if (nt == FLOAT || nt == FCOMPLEX) {
                nv->v_ldbl = (float)v->v_ldbl;
-       } else if (nt == DOUBLE) {
+       } else if (nt == DOUBLE || nt == DCOMPLEX) {
                nv->v_ldbl = (double)v->v_ldbl;
-       } else if (nt == LDOUBLE) {
+       } else if (nt == LDOUBLE || nt == LCOMPLEX) {
                nv->v_ldbl = v->v_ldbl;
        } else {
                nv->v_quad = (int64_t)v->v_ldbl;



Home | Main Index | Thread Index | Old Index