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: replace segmentation fault with as...
details: https://anonhg.NetBSD.org/src/rev/c913fe84ffa8
branches: trunk
changeset: 953756:c913fe84ffa8
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Mar 20 08:16:30 2021 +0000
description:
lint: replace segmentation fault with assertion failure
diffstat:
tests/usr.bin/xlint/lint1/d_c99_init.c | 12 +++++++++++-
usr.bin/xlint/lint1/init.c | 5 +++--
2 files changed, 14 insertions(+), 3 deletions(-)
diffs (50 lines):
diff -r 823a164a851f -r c913fe84ffa8 tests/usr.bin/xlint/lint1/d_c99_init.c
--- a/tests/usr.bin/xlint/lint1/d_c99_init.c Sat Mar 20 06:48:23 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_init.c Sat Mar 20 08:16:30 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: d_c99_init.c,v 1.9 2021/03/19 01:02:52 rillig Exp $ */
+/* $NetBSD: d_c99_init.c,v 1.10 2021/03/20 08:16:30 rillig Exp $ */
# 3 "d_c99_init.c"
/*
@@ -132,4 +132,14 @@
333,
};
+/*
+ * C99 6.7.8p11 says that the initializer of a scalar can be "optionally
+ * enclosed in braces". It does not explicitly set an upper limit on the
+ * number of braces. It also doesn't restrict the term "initializer" to only
+ * mean the "outermost initializer". Both GCC 10 and Clang 8 already warn
+ * about this, so there is no extra work for lint to do.
+ */
+// FIXME: assertion failure 'istk->i_type != NULL'
+// struct point scalar_with_several_braces = {};
+
// See d_struct_init_nested.c for a more complicated example.
diff -r 823a164a851f -r c913fe84ffa8 usr.bin/xlint/lint1/init.c
--- a/usr.bin/xlint/lint1/init.c Sat Mar 20 06:48:23 2021 +0000
+++ b/usr.bin/xlint/lint1/init.c Sat Mar 20 08:16:30 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: init.c,v 1.106 2021/03/19 18:17:46 rillig Exp $ */
+/* $NetBSD: init.c,v 1.107 2021/03/20 08:16:30 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.106 2021/03/19 18:17:46 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.107 2021/03/20 08:16:30 rillig Exp $");
#endif
#include <stdlib.h>
@@ -696,6 +696,7 @@
istk = initstk;
debug_step("expecting type '%s'", type_name(istk->i_type));
+ lint_assert(istk->i_type != NULL);
switch (istk->i_type->t_tspec) {
case ARRAY:
if (namedmem != NULL) {
Home |
Main Index |
Thread Index |
Old Index