# HG changeset patch # User Paul Boddie # Date 1716152023 -7200 # Node ID aa1826243f0c6e77cce2beafa5b4c0c967a6aefd # Parent dd0745ab8b8a68bc88fce8d909697fc5f3f52503 Avoid creating zero-length temporary arrays. diff -r dd0745ab8b8a -r aa1826243f0c translator.py --- a/translator.py Sun May 19 22:18:46 2024 +0200 +++ b/translator.py Sun May 19 22:53:43 2024 +0200 @@ -3,7 +3,7 @@ """ Translate programs. -Copyright (C) 2015, 2016, 2017, 2018 Paul Boddie +Copyright (C) 2015, 2016, 2017, 2018, 2024 Paul Boddie This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -2168,13 +2168,13 @@ # Provide space for the recorded number of temporary variables. - if self.uses_temp(name, "__tmp_targets"): + if self.uses_temp(name, "__tmp_targets") and self.max_function_target: self.writeline("__attr __tmp_targets[%d];" % self.max_function_target) - if self.uses_temp(name, "__tmp_contexts"): + if self.uses_temp(name, "__tmp_contexts") and self.max_context_index: self.writeline("__attr __tmp_contexts[%d];" % self.max_context_index) - if self.uses_temp(name, "__tmp_values"): + if self.uses_temp(name, "__tmp_values") and self.max_accessor_index: self.writeline("__attr __tmp_values[%d];" % self.max_accessor_index) # Add temporary variable usage details.