Bug 145229 - loval variable used before set + dead function
loval variable used before set + dead function
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: bison (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Roland McGrath
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-01-15 12:43 EST by David Binderman
Modified: 2007-11-30 17:10 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-10-14 20:51:47 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description David Binderman 2005-01-15 12:43:55 EST
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 19:27:54 EDT
As I see new bison 2.1 fix all this bugs.
Comment 2 Roland McGrath 2005-10-14 20:51:47 EDT
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 03:46:14 EDT
>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 16:28:08 EDT
diff -urN bison-2.0 bison-2.1 > bison-20-21.patch

1.
+2005-07-09  Paul Eggert  <eggert@cs.ucla.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@cs.ucla.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?

Note You need to log in before you can comment on or make changes to this bug.