summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrillig <rillig@NetBSD.org>2023-04-11 19:40:04 +0000
committerrillig <rillig@NetBSD.org>2023-04-11 19:40:04 +0000
commit0b3caf36480550f15e94bc33666906c3e2f1886c (patch)
treead88ec7090e5c3ce1ac99dac2831630ddfa7d221
parent9db374eb347731f111596c0ec56d61a9f3f208cd (diff)
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'.
-rw-r--r--usr.bin/xlint/lint1/tree.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/xlint/lint1/tree.c b/usr.bin/xlint/lint1/tree.c
index ddb65366101..11524de44e7 100644
--- a/usr.bin/xlint/lint1/tree.c
+++ b/usr.bin/xlint/lint1/tree.c
@@ -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 arg, tspec_t ot, const type_t *tp,
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;