Module Name:    src
Committed By:   rillig
Date:           Sun Jun 27 13:59:29 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: fix undefined behavior after syntax error 'unnamed member'

There should really be a linter or other check that guards against
forgetting to assign a value to '$$'.


To generate a diff of this commit:
cvs rdiff -u -r1.231 -r1.232 src/usr.bin/xlint/lint1/cgram.y

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.231 src/usr.bin/xlint/lint1/cgram.y:1.232
--- src/usr.bin/xlint/lint1/cgram.y:1.231	Sun Jun 27 08:20:50 2021
+++ src/usr.bin/xlint/lint1/cgram.y	Sun Jun 27 13:59:29 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.231 2021/06/27 08:20:50 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.232 2021/06/27 13:59:29 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.231 2021/06/27 08:20:50 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.232 2021/06/27 13:59:29 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -850,6 +850,7 @@ member_declaration:
 		} else {
 			/* syntax error '%s' */
 			error(249, "unnamed member");
+			$$ = NULL;
 		}
 	  }
 	| error {

Reply via email to