Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some compiler warnings about possible uninitialized variables #29

Open
mingodad opened this issue Jul 22, 2021 · 0 comments
Open

Some compiler warnings about possible uninitialized variables #29

mingodad opened this issue Jul 22, 2021 · 0 comments

Comments

@mingodad
Copy link

Adding -Wall -Wextra with gcc give a few warnings and some of then I fixed as shown bellow:

diff --git a/src/yaep.c b/src/yaep.c
index 3719017..b68cce8 100644
--- a/src/yaep.c
+++ b/src/yaep.c
@@ -5263,8 +5263,8 @@ static vlo_t *tnodes_vlo;
 static struct yaep_tree_node *
 prune_to_minimal (struct yaep_tree_node *node, int *cost)
 {
-  struct yaep_tree_node *child, *alt, *next_alt, *result;
-  int i, min_cost;
+  struct yaep_tree_node *child, *alt, *next_alt, *result = NULL;
+  int i, min_cost = 0;
 
   assert (node != NULL);
   switch (node->type)
@@ -5431,7 +5431,7 @@ make_parse (int *ambiguous_p)
   struct yaep_tree_node *parent_anode, *anode, root_anode;
   int parent_disp;
   int saved_one_parse_p;
-  struct yaep_tree_node **term_node_array;
+  struct yaep_tree_node **term_node_array = NULL;
 #ifndef __cplusplus
   vlo_t stack, orig_states;
 #else
@@ -6420,7 +6420,7 @@ read_rule (const char ***rhs, const char **anode, int *anode_cost,
 
 /* The following variable is the current number of next input
    token. */
-static int ntok;
+static size_t ntok;
 
 /* The following function imported by Earley's algorithm (see comments
    in the interface file). */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant