Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/common/lib/libc/misc workaround a GCC 8 warning:
details: https://anonhg.NetBSD.org/src/rev/7b337239398e
branches: trunk
changeset: 464383:7b337239398e
user: mrg <mrg%NetBSD.org@localhost>
date: Fri Oct 04 12:12:47 2019 +0000
description:
workaround a GCC 8 warning:
- code that will be unreachable on platforms with
sizeof(double) != sizeof(unsigned long) triggered an valid out
of bounds warning. avoid the error by using sizeof ul.
- also assert that the sizes are the same if entering here.
both from kamil@.
diffstat:
common/lib/libc/misc/ubsan.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diffs (31 lines):
diff -r 2944b85a2afa -r 7b337239398e common/lib/libc/misc/ubsan.c
--- a/common/lib/libc/misc/ubsan.c Fri Oct 04 12:11:38 2019 +0000
+++ b/common/lib/libc/misc/ubsan.c Fri Oct 04 12:12:47 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ubsan.c,v 1.6 2019/06/17 18:55:37 kamil Exp $ */
+/* $NetBSD: ubsan.c,v 1.7 2019/10/04 12:12:47 mrg Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -38,9 +38,9 @@
#include <sys/cdefs.h>
#if defined(_KERNEL)
-__KERNEL_RCSID(0, "$NetBSD: ubsan.c,v 1.6 2019/06/17 18:55:37 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsan.c,v 1.7 2019/10/04 12:12:47 mrg Exp $");
#else
-__RCSID("$NetBSD: ubsan.c,v 1.6 2019/06/17 18:55:37 kamil Exp $");
+__RCSID("$NetBSD: ubsan.c,v 1.7 2019/10/04 12:12:47 mrg Exp $");
#endif
#if defined(_KERNEL)
@@ -1403,7 +1403,8 @@
switch (zDeserializeTypeWidth(pType)) {
case WIDTH_64:
- memcpy(&D, &ulNumber, sizeof(double));
+ ASSERT(sizeof(D) == sizeof(ulNumber));
+ memcpy(&D, &ulNumber, sizeof(ulNumber));
snprintf(pBuffer, zBUfferLength, "%g", D);
break;
case WIDTH_32:
Home |
Main Index |
Thread Index |
Old Index