#47959: dai_select_tech() clang analyzer warning about garbage value Open Date: 2023-04-27 23:43 Last Update: 2023-05-07 17:06 URL for this Ticket: https://osdn.net//projects/freeciv/ticket/47959 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=47959 --------------------------------------------------------------------- Last Changes/Comment on this Ticket: 2023-05-07 17:06 Updated by: cazfi * Owner Update from (None) to cazfi * Resolution Update from None to Accepted --------------------------------------------------------------------- Ticket Status: Reporter: cazfi Owner: cazfi Type: Bugs Status: Open [Owner assigned] Priority: 5 - Medium MileStone: 3.0.8 Component: AI Severity: 5 - Medium Resolution: Accepted --------------------------------------------------------------------- Ticket details: ../../../../src/ai/default/aitech.c:173:26: warning: The left operand of '>' is a garbage value [core.UndefinedBinaryOperatorResult] if (goal_values[i] > goal_values[newgoal] This is likely to be false positive. Analyzer just doesn't know that on each iteration valid_advance_by_number() will filter exactly same techs out, i.e., the same indices are initialized and used. This ticket is about fixing the clang analyzer warning. There's space for refactoring, but will open separate ticket about that. -- Ticket information of Freeciv project Freeciv Project is hosted on OSDN Project URL: https://osdn.net/projects/freeciv/ OSDN: https://osdn.net URL for this Ticket: https://osdn.net/projects/freeciv/ticket/47959 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=47959