Bug 145229

Summary: loval variable used before set + dead function
Product: [Fedora] Fedora Reporter: David Binderman <dcb314>
Component: bisonAssignee: Roland McGrath <roland>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: mgarski
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-10-15 00:51:47 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description David Binderman 2005-01-15 17:43:55 UTC
Description of problem:

I just tried to compile package bison-2.0-4 from 
Redhat Fedora development tree.

The compiler said

1.

parse-gram.c(1152): remark #592: variable "gram_lval" is used before
its value is set

The source code is

  yyvsp[0] = yylval;

I'm not sure what the fix is for this.

2.

tables.c(48): remark #177: function "state_number_to_vector_number"
was declared but never referenced

I've had a look at the source code, and I agree with the compiler.
Suggest delete dead code.



Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Marcin Garski 2005-10-14 23:27:54 UTC
As I see new bison 2.1 fix all this bugs.

Comment 2 Roland McGrath 2005-10-15 00:51:47 UTC
Rawhide has bison-2.1 now.  If there is any problem, file a new bug or reopen
this one with fresh details if it is the same exact problem.

Comment 3 David Binderman 2005-10-15 07:46:14 UTC
>Rawhide has bison-2.1 now.  

I fail to understand how an upgrade guarantees that a bug
is fixed.

In my opinion, very poor process.

Luckily, the other poster appears to have checked for us.

Comment 4 Marcin Garski 2005-10-15 20:28:08 UTC
diff -urN bison-2.0 bison-2.1 > bison-20-21.patch

1.
+2005-07-09  Paul Eggert  <eggert.edu>
+
+	* data/yacc.c (yyparse): Undo previous patch.  Instead,
+	set yylsp[0] and yyvsp[0] only if the initial action
+	sets yylloc and yylval, respectively.
+
+	* data/yacc.c (yyparse): In the initial action, set
+	yylsp[0] and yyvsp[0] rather than yylloc and yylval.
+	This avoids the use of undefined variables if the initial
+	action does not set yylloc and/or yylval.

@@ -1147,11 +1324,9 @@
   yylloc.start.line   = yylloc.end.line   = 1;
   yylloc.start.column = yylloc.end.column = 0;
 }
-/* Line 842 of yacc.c.  */
-#line 1152 "parse-gram.c"
-  yyvsp[0] = yylval;
-    yylsp[0] = yylloc;
-
+/* Line 930 of yacc.c.  */
+#line 1329 "parse-gram.c"
+  yylsp[0] = yylloc;
   goto yysetstate;
 
 /*------------------------------------------------------------.
@@ -1184,7 +1359,7 @@

2.
+2005-03-15  Paul Eggert  <eggert.edu>
+
+	* src/tables.c (state_number_to_vector_number): Put it inside an
+	"#if 0", since it's not currently used.  Problem reported by
+	Roland McGrath.

@@ -44,11 +44,13 @@
    state_number and symbol_number.  */
 typedef int vector_number;
 
+#if 0 /* Not currently used.  */
 static inline vector_number
 state_number_to_vector_number (state_number s)
 {
   return s;
 }
+#endif
 
 static inline vector_number
 symbol_number_to_vector_number (symbol_number sym)
@@ -171,7 +173,7 @@

Can you see why I have wrote that all this bugs don't appear in bison 2.1?