Bug 149865 - local variable used before set
local variable used before set
Status: CLOSED NEXTRELEASE
Product: Fedora
Classification: Fedora
Component: logjam (Show other bugs)
3
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tom "spot" Callaway
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-02-28 09:48 EST by David Binderman
Modified: 2007-11-30 17:11 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-03-13 19:30:58 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
gcc -Wall warnings cleaned up (1.91 KB, patch)
2005-03-13 19:19 EST, Tom "spot" Callaway
no flags Details | Diff

  None (edit)
Description David Binderman 2005-02-28 09:48:25 EST
Description of problem:

I just tried to compile package logjam-4.4.1-3 from 
Redhat Fedora Extras development tree.

The compiler said

tools.c(217): remark #592: variable "encoding" is used before its
value is set

The source code is

        const gchar *encoding;
        GError *err = NULL;

        command = gtk_entry_get_text(GTK_ENTRY(entry));
        if (!jam_doc_insert_command_output(doc,
                command, encoding, &err, win) && (err)) {

Suggest initialise local variable "encoding" before first use.


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


How reproducible:


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


Expected results:


Additional info:
Comment 1 Tom "spot" Callaway 2005-02-28 10:19:57 EST
Gcc spit this out? I don't recognize that as a gcc error, it sounds
like ICC being too sensitive.

If gcc wasn't used to compile this, you need to take that bug back to
the upstream maintainer, which, in the case of logjam, is Evan Martin
(http://logjam.danga.com).

If gcc was used, feel free to reopen this bug.

Comment 2 David Binderman 2005-02-28 11:07:04 EST
>Gcc spit this out? 

Nope, Intel 8.1, but gcc will complain about the line
by adding "-O2 -Wall" to gcc command line.

>it sounds like ICC being too sensitive.

Good comedy. 

In fact, reading definately un-init memory is one of the oldest
mistakes that C programmers.

>If gcc was used, feel free to reopen this bug.

See above - gcc can complain about this bug.
Comment 3 Tom "spot" Callaway 2005-03-13 19:19:00 EST
Created attachment 111958 [details]
gcc -Wall warnings cleaned up

OK, taking the time to look at this one.

Recompiled logjam 4.4.1 with -O2 -Wall.

The following errors were thrown by the compiler:
cmdline.c: In function `command_dispatch':
cmdline.c:667: warning: 'acc' might be used uninitialized in this function
checkfriends-gtk.c: In function `cf_float_destroy':
checkfriends-gtk.c:258: warning: unused variable `cfm'
checkfriends-gtk.c: In function `cf_dock_destroy':
checkfriends-gtk.c:280: warning: unused variable `cfm'
checkfriends-gtk.c: At top level:
checkfriends-gtk.c:295: warning: 'cf_dock_setup' defined but not used
menu.c: In function `menu_make_bar':
menu.c:443: warning: unused variable `i'
tools.c: In function `tools_insert_command_output':
tools.c:212: warning: 'encoding' might be used uninitialized in this function

All of these errors are fixed in the attached patch.
Comment 4 Tom "spot" Callaway 2005-03-13 19:30:32 EST
Changes committed to devel branch of CVS.

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