From eb44bcc7bc940d7cc1f4c10afa5a1cb7ec0dd198 Mon Sep 17 00:00:00 2001 From: John Levon Date: Fri, 22 Nov 2019 13:16:49 +0000 Subject: [PATCH] 12013 fix smatch build for GCC4 Reviewed by: Dan McDonald Approved by: Robert Mustacchi --- usr/src/tools/smatch/Makefile | 2 +- usr/src/tools/smatch/src/Makefile | 4 ++-- usr/src/tools/smatch/src/check_arm64_tagged.c | 9 +++++++-- usr/src/tools/smatch/src/ident-list.h | 2 +- .../src/smatch_data/illumos_kernel.skipped_functions | 1 + .../src/smatch_data/illumos_user.skipped_functions | 6 ++---- usr/src/tools/smatch/src/smatch_kernel_user_data.c | 9 +++++++-- 7 files changed, 21 insertions(+), 12 deletions(-) diff --git a/usr/src/tools/smatch/Makefile b/usr/src/tools/smatch/Makefile index 145c08de28..b68d5634e2 100644 --- a/usr/src/tools/smatch/Makefile +++ b/usr/src/tools/smatch/Makefile @@ -20,7 +20,7 @@ # PROG = smatch -SPARSE_VERSION = 0.6.1-rc1-il-1 +SPARSE_VERSION = 0.6.1-rc1-il-2 include ../Makefile.tools diff --git a/usr/src/tools/smatch/src/Makefile b/usr/src/tools/smatch/src/Makefile index 495cc6192d..164fa1bd33 100644 --- a/usr/src/tools/smatch/src/Makefile +++ b/usr/src/tools/smatch/src/Makefile @@ -1,4 +1,4 @@ -VERSION=0.6.1-rc1-il-1 +VERSION=0.6.1-rc1-il-2 ######################################################################## # The following variables can be overwritten from the command line @@ -9,7 +9,7 @@ CC ?= gcc LD = $(CC) AR = ar -CFLAGS ?= -O2 -g +CFLAGS ?= -g DESTDIR ?= PREFIX ?= $(HOME) diff --git a/usr/src/tools/smatch/src/check_arm64_tagged.c b/usr/src/tools/smatch/src/check_arm64_tagged.c index e126552e59..d4d00873e1 100644 --- a/usr/src/tools/smatch/src/check_arm64_tagged.c +++ b/usr/src/tools/smatch/src/check_arm64_tagged.c @@ -154,8 +154,13 @@ int rl_range_has_min_value(struct range_list *rl, sval_t sval) static bool rl_is_tagged(struct range_list *rl) { - sval_t invalid = { .type = &ullong_ctype, .value = (1ULL << 56) }; - sval_t invalid_kernel = { .type = &ullong_ctype, .value = (0xff8ULL << 52) }; + sval_t invalid; + sval_t invalid_kernel; + + invalid.type = &ullong_ctype; + invalid.value = 1ULL << 56; + invalid_kernel.type = &ullong_ctype; + invalid_kernel.value = 0xff8ULL << 52; /* * We only care for tagged addresses, thus ignore anything where the diff --git a/usr/src/tools/smatch/src/ident-list.h b/usr/src/tools/smatch/src/ident-list.h index 096b1c2358..4ffd756301 100644 --- a/usr/src/tools/smatch/src/ident-list.h +++ b/usr/src/tools/smatch/src/ident-list.h @@ -31,7 +31,7 @@ IDENT(static); /* C99 keywords */ IDENT(restrict); IDENT(__restrict); IDENT(__restrict__); IDENT(_Bool); -IDENT(_Complex); +IDENT_RESERVED(_Complex); IDENT_RESERVED(_Imaginary); /* C11 keywords */ diff --git a/usr/src/tools/smatch/src/smatch_data/illumos_kernel.skipped_functions b/usr/src/tools/smatch/src/smatch_data/illumos_kernel.skipped_functions index 3617b9b806..029d02aad9 100644 --- a/usr/src/tools/smatch/src/smatch_data/illumos_kernel.skipped_functions +++ b/usr/src/tools/smatch/src/smatch_data/illumos_kernel.skipped_functions @@ -3,6 +3,7 @@ ECDSA_VerifyDigest dtrace_disx86 elf32exec elfexec +emlxs_sli4_process_unsol_rcv iscsi_ioctl lm_idle_chk ld64_sym_validate diff --git a/usr/src/tools/smatch/src/smatch_data/illumos_user.skipped_functions b/usr/src/tools/smatch/src/smatch_data/illumos_user.skipped_functions index f82ff4f38a..2842a7bc96 100644 --- a/usr/src/tools/smatch/src/smatch_data/illumos_user.skipped_functions +++ b/usr/src/tools/smatch/src/smatch_data/illumos_user.skipped_functions @@ -1,8 +1,6 @@ /* - * The below functions cause smatch to fail with "turning off implications after - * 60 seconds" or similar, generally because they're too large for it to handle. - * - * This will disable analysis altogether. + * These are specific functions that are generally too complex for smatch to + * reasonably handle. */ /* libast */ diff --git a/usr/src/tools/smatch/src/smatch_kernel_user_data.c b/usr/src/tools/smatch/src/smatch_kernel_user_data.c index ca4c7cd315..cda3b58d9d 100644 --- a/usr/src/tools/smatch/src/smatch_kernel_user_data.c +++ b/usr/src/tools/smatch/src/smatch_kernel_user_data.c @@ -681,10 +681,15 @@ static void handle_eq_noteq(struct expression *expr) static struct range_list *strip_negatives(struct range_list *rl) { sval_t min = rl_min(rl); - sval_t minus_one = { .type = rl_type(rl), .value = -1 }; - sval_t over = { .type = rl_type(rl), .value = INT_MAX + 1ULL }; + sval_t minus_one; + sval_t over; sval_t max = sval_type_max(rl_type(rl)); + minus_one.type = rl_type(rl); + minus_one.value = -1; + over.type = rl_type(rl); + over.value = INT_MAX + 1ULL; + if (!rl) return NULL; -- 2.45.2