Bug 149716 - 4 * local variable used before set
Summary: 4 * local variable used before set
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: gurlchecker
Version: 3
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Phillip Compton
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-02-25 18:05 UTC by David Binderman
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-07-23 18:47:25 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description David Binderman 2005-02-25 18:05:04 UTC
Description of problem:

I just tried to compile package gurlchecker-0.6.3-2 from 
Redhat Fedora Extras development tree.

The compiler said

1.

application.c(183): remark #592: variable "iter" is used before its
value is set

The source code is

  GtkTreeIter iter;

  uc_application_menu_set_sensitive_all ("display", TRUE);
  gtk_tree_store_clear (treestore);
  uc_check_display_list_with_only (uc_lists_checked_links_get (), iter,
                                   UC_CHECK_DISPLAY_BADLINKS);

I'm not sure what's going on here, but it might be sensible to
ensure that iter is set to something sensible before it is given to
uc_check_display_list_with_only.

2.

application.c(202): remark #592: variable "iter" is used before its
value is set
application.c(221): remark #592: variable "iter" is used before its
value is set
application.c(240): remark #592: variable "iter" is used before its
value is set

Duplicates.


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


How reproducible:


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


Expected results:


Additional info:

Comment 1 Michael Schwendt 2005-07-23 18:47:25 UTC
It's in the nature of the GtkTreeIter struct that often it's passed on to other
functions where initialisation happens (call by reference then).


Comment 2 David Binderman 2005-07-23 22:19:05 UTC
>call by reference then

This is C code. The only call by reference is to pass
the address of something.

It *might* be the case that function uc_check_display_list_with_only
is happy to be given rubbish for its second parameter.

In general, functions don't like being given rubbish. 

Suggest either initialise the parameter, or delete the second parameter
from the definition of the function.

Comment 3 Michael Schwendt 2005-07-23 23:29:29 UTC
uc_check_display_list_with_only doesn't care about the struct at all, since it
passes it on to a function where it is initialised.

Again, where I take a look at reports like this, I'm in search of actual
programming mistakes to fix, as they likely cause run-time misbehaviour. Unlike
you, I'm not on a quest to only make Intel C Compiler shut up.



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