This corrects a build failure when using GCC8 and configured with
the --enable-gcc-warnings and --enable-assert options:
src/reader.c: In function 'reader':
src/reader.c:740:17: error: potential null pointer dereference
[-Werror=null-dereference]
node = node->next)
* src/reader.c (check_and_convert_grammar): Add a NULL assertion.
Signed-off-by: David Michael <[email protected]>
---
Hi,
I'm hitting a build failure with the developer configure options
--enable-assert and --enable-gcc-warnings and GCC 8. This patch will
correct it by adding another assert inside the loop to be consistent
with how it's handled after it, but note that it will still fail if
asserts are disabled and warnings are enabled. If that case should be
supported, both aver() calls need to be replaced.
Thanks.
David
src/reader.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/reader.c b/src/reader.c
index c220d707..c8b5c187 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -743,6 +743,7 @@ check_and_convert_grammar (void)
node != NULL && node->content.sym != NULL;
node = node->next)
;
+ aver (node != NULL);
}
aver (node != NULL);
grammar_start_symbol_set (node->content.sym,
--
2.14.4