[Scummvm-git-logs] scummvm master -> 671603aa27d1078dff80fa5bb46d199afb611216

bluegr noreply at scummvm.org
Tue Oct 18 05:42:14 UTC 2022


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
671603aa27 GRIM: Backport a Bison fix for uninitialized yyval (Trac#13784)


Commit: 671603aa27d1078dff80fa5bb46d199afb611216
    https://github.com/scummvm/scummvm/commit/671603aa27d1078dff80fa5bb46d199afb611216
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2022-10-18T08:42:12+03:00

Commit Message:
GRIM: Backport a Bison fix for uninitialized yyval (Trac#13784)

Reported by MSVC whenever pressing a key in EMI in debug builds.

Upstream fix from GNU Bison 1.28c on 2000-10-02:
https://git.savannah.gnu.org/cgit/bison.git/commit/?id=da9abf4366d824a23da3d2416856e9a482794eb1

Changed paths:
    engines/grim/lua/lstx.cpp


diff --git a/engines/grim/lua/lstx.cpp b/engines/grim/lua/lstx.cpp
index ab99141a971..c3fae583d6a 100644
--- a/engines/grim/lua/lstx.cpp
+++ b/engines/grim/lua/lstx.cpp
@@ -1068,8 +1068,16 @@ yydefault:
 	/* Do a reduction.  yyn is the number of a rule to reduce with.  */
 yyreduce:
 	yylen = yyr2[yyn];
-	if (yylen > 0)
-		yyval = yyvsp[1 - yylen]; /* implement default value of the action */
+
+	/* If YYLEN is nonzero, implement the default value of the action:
+	   `$$ = $1'.
+
+	   Otherwise, the following line sets YYVAL to the semantic value of
+	   the lookahead token.  This behavior is undocumented and Bison
+	   users should not rely upon it.  Assigning to YYVAL
+	   unconditionally makes the parser a bit smaller, and it avoids a
+	   GCC warning that YYVAL may be used uninitialized.  */
+	yyval = yyvsp[1-yylen];
 
 	switch (yyn) {
 




More information about the Scummvm-git-logs mailing list