bugFreeciv - Bugs: bug #20447, 'trade_routes_color' may be used...

 
 
Show feedback again

bug #20447: 'trade_routes_color' may be used uninitialized

Submitted by:  Marko Lindqvist <cazfi>
Submitted on:  Sun 20 Jan 2013 10:25:17 PM UTC  
 
Category: clientSeverity: 3 - Normal
Priority: 5 - NormalStatus: Fixed
Assigned to: Marko Lindqvist <cazfi>Open/Closed: Closed
Release: Operating System: None
Planned Release: 2.3.4, 2.4.0, 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.

 

Wed 23 Jan 2013 09:49:13 AM UTC, SVN revision 22187:

Fixed "'trade_routes_color' may be used uninitialized" compiler warning.

See gna bug #20447

(Browse SVN revision 22187)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Wed 23 Jan 2013 09:49:08 AM UTC, SVN revision 22186:

Fixed "'trade_routes_color' may be used uninitialized" compiler warning.

See gna bug #20447

(Browse SVN revision 22186)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Wed 23 Jan 2013 09:49:03 AM UTC, SVN revision 22185:

Fixed "'trade_routes_color' may be used uninitialized" compiler warning.

See gna bug #20447

(Browse SVN revision 22185)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Sun 20 Jan 2013 10:25:17 PM UTC, original submission:

With optimization level 3, gcc gives:

client/mapview_common.c: In function 'show_city_descriptions':
client/mapview_common.c:1655:22: error: 'trade_routes_color' may be used uninitialized in this function [-Werror=maybe-uninitialized]
client/mapview_common.c:1440:32: note: 'trade_routes_color' was declared here
client/mapview_common.c:1767:22: error: 'trade_routes_color' may be used uninitialized in this function [-Werror=maybe-uninitialized]
client/mapview_common.c:1701:32: note: 'trade_routes_color' was declared here

These seem like gcc is migdiagnosing the situation. In fact, it depends on exact value assigned to trade_routes_color if warning is emitted or not, to the extend that reassigning such an unacceptable value when there already is prior assignment with acceptable value will cause the warning to be emitted.

Luckily, initializing variable when declared makes the warning to go away. That's what attached patch does.

This is last compiler warning I had with optimization level 3 in S2_4.

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.

 

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

Attach File(s):
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by cazfi (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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 23 Jan 2013 09:49:34 AM UTCcazfiStatusReady For Test=>Fixed
      Assigned toNone=>cazfi
      Open/ClosedOpen=>Closed
    Sun 20 Jan 2013 10:25:17 PM UTCcazfiAttached File-=>Added TradeRoutesColorInit.patch, #16984
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup