bugFreeciv - Bugs: bug #20393, "cheapest_amount may be used...

 
 
Show feedback again

bug #20393: "cheapest_amount may be used uninitialized" -warning

Submitted by:  Jordi Negrevernis i Font <jorneg>
Submitted on:  Sat 29 Dec 2012 10:50:40 PM UTC  
 
Category: generalSeverity: 3 - Normal
Priority: 5 - NormalStatus: Fixed
Assigned to: Marko Lindqvist <cazfi>Open/Closed: Closed
Release: Operating System: GNU/Linux
Planned Release: 2.5.0

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Thu 03 Jan 2013 03:06:11 PM UTC, comment #6:

(This came in in patch #3553.)

Jacob Nevins <jtn>
Project Administrator
Thu 03 Jan 2013 11:19:53 AM UTC, SVN revision 22110:

Initialize "cheapest_amount" to silence warning with older gcc versions.

Reported by Jordi Negrevernis i Font

See gna bug #20393

(Browse SVN revision 22110)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Sun 30 Dec 2012 05:35:48 PM UTC, comment #4:

It does.

Thanks and Happy New Year... ;-)

Jordi Negrevernis i Font <jorneg>
Project Member
Sun 30 Dec 2012 02:10:56 AM UTC, comment #3:

This should silence the warning.

(file #16879)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Sun 30 Dec 2012 01:54:26 AM UTC, comment #2:

It's from Ubuntu 10.4...

jordi@ubuntu10-4:~/freeciv/trunk/freeciv$ gcc --version
gcc (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

jordi@ubuntu10-4:~/freeciv/trunk/freeciv$

Jordi Negrevernis i Font <jorneg>
Project Member
Sun 30 Dec 2012 01:00:41 AM UTC, comment #1:

gcc version?

Unless I made a mistake in my manual check, it cannot be used uninitialized. Heuristics of gcc-4.7.2 apparently draw that conclusion too, as Ḯ'm not getting that warning.

Of course, adding extra initialization to silence the warningg wouldn't break anything - initialization value would get overwritten as soon as real value is assigned (if execution ever gets that far).

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Sat 29 Dec 2012 10:50:40 PM UTC, original submission:

Can't compile trunk on file techtools.c

make[3]: se ingresa al directorio «/home/jordi/freeciv/trunk/freeciv/server»
CC techtools.lo
cc1: warnings being treated as errors
techtools.c: In function ‘pick_cheapest_tech’:
techtools.c:727: error: ‘cheapest_amount’ may be used uninitialized in this function
make[3]: *** [techtools.lo] Error 1
make[3]: se sale del directorio «/home/jordi/freeciv/trunk/freeciv/server»
make[2]: *** [all-recursive] Error 1
make[2]: se sale del directorio «/home/jordi/freeciv/trunk/freeciv/server»
make[1]: *** [all-recursive] Error 1
make[1]: se sale del directorio «/home/jordi/freeciv/trunk/freeciv»
make: *** [all] Error 2
jordi@ubuntu10-4:~/freeciv/trunk/freeciv$

Jordi Negrevernis i Font <jorneg>
Project Member

 

(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #16879:  CheapestInit.patch added by cazfi (421B - text/x-diff)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jtn (Posted a comment)
  • -unavailable- added by cazfi (Posted a comment)
  • -unavailable- added by jorneg (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 03 Jan 2013 11:20:07 AM UTCcazfiStatusReady For Test=>Fixed
      Assigned toNone=>cazfi
      Open/ClosedOpen=>Closed
    Thu 03 Jan 2013 11:17:28 AM UTCcazfiSummaryCan\'t compile trunk=>"cheapest_amount may be used uninitialized" -warning
    Sun 30 Dec 2012 02:10:56 AM UTCcazfiAttached File-=>Added CheapestInit.patch, #16879
      CategoryNone=>general
      StatusNone=>Ready For Test
      Planned Release=>2.5.0
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup