Bug 149716 - 4 * local variable used before set
4 * local variable used before set
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: gurlchecker (Show other bugs)
3
All Linux
medium Severity medium
: ---
: ---
Assigned To: Phillip Compton
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-02-25 13:05 EST by David Binderman
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-07-23 14:47:25 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-02-25 13:05:04 EST
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 14:47:25 EDT
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 18:19:05 EDT
>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 19:29:29 EDT
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.