[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: test-verify.c: avoid -Wmissing-declarations warnings
From: |
Bruno Haible |
Subject: |
Re: test-verify.c: avoid -Wmissing-declarations warnings |
Date: |
Tue, 03 Nov 2020 17:20:51 +0100 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-193-generic; KDE/5.18.0; x86_64; ; ) |
Hi Bernhard,
> > Should be fixed with the attached patch
This was untested, was it? Because in a gnulib testdir, 'test-verify'
now crashes immediately. The reason is that the compiler eliminated the
entire code of the main() function, because it was told that it is
on a dead branch:
state s = { 0 }
implies
s.halt = 0;
and
assume (s->halt);
means that if the 'halt' field is zero, the code flow cannot get here.
This patch fixes it.
2020-11-03 Bruno Haible <bruno@clisp.org>
verify tests: Fix crash with GCC (regression 2020-11-02).
* tests/test-verify.c (main): Fix initializer of s.
diff --git a/tests/test-verify.c b/tests/test-verify.c
index a141417..fe7599c 100644
--- a/tests/test-verify.c
+++ b/tests/test-verify.c
@@ -112,7 +112,7 @@ test_assume_noreturn (void)
int
main (void)
{
- state s = { 0 };
+ state s = { 0, 1 };
test_assume_expressions (&s);
test_assume_optimization (5);
return !(function (0) == 0 && function (1) == 8);