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 Dec 29 22:50:40 2012  
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.0Contains string changes: None

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 Jan 3 15:06:11 2013, comment #6:

(This came in in patch #3553.)

Jacob Nevins <jtn>
Project Administrator
Thu Jan 3 11:19:53 2013, 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 Dec 30 17:35:48 2012, comment #4:

It does.

Thanks and Happy New Year... ;-)

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

This should silence the warning.

(file #16879)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Sun Dec 30 01:54:26 2012, 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


Jordi Negrevernis i Font <jorneg>
Project Member
Sun Dec 30 01:00:41 2012, 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 Dec 29 22:50:40 2012, 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 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):

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.


    Error: not logged in



    Follow 8 latest changes.

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

    Back to the top

    Powered by Savane 3.1-cleanup