changeset 31557:2fb47f515612

maint: Merge stable to default.
author John W. Eaton <jwe@octave.org>
date Sat, 26 Nov 2022 17:14:01 -0500
parents 1d410367802c (current diff) 9978ef12aea3 (diff)
children 4e77f48d92ff
files
diffstat 3 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/interpreter.cc	Sat Nov 26 18:51:28 2022 +0100
+++ b/libinterp/corefcn/interpreter.cc	Sat Nov 26 17:14:01 2022 -0500
@@ -459,6 +459,7 @@
       m_environment (),
       m_settings (),
       m_error_system (*this),
+      m_evaluator (*this),
       m_help_system (*this),
       m_input_system (*this),
       m_output_system (*this),
@@ -468,7 +469,6 @@
       m_load_save_system (*this),
       m_type_info (),
       m_symbol_table (*this),
-      m_evaluator (*this),
       m_stream_list (*this),
       m_child_list (),
       m_url_handle_manager (),
--- a/libinterp/corefcn/interpreter.h	Sat Nov 26 18:51:28 2022 +0100
+++ b/libinterp/corefcn/interpreter.h	Sat Nov 26 17:14:01 2022 -0500
@@ -253,6 +253,8 @@
       return m_error_system;
     }
 
+    tree_evaluator& get_evaluator (void);
+
     help_system& get_help_system (void)
     {
       return m_help_system;
@@ -298,8 +300,6 @@
       return m_symbol_table;
     }
 
-    tree_evaluator& get_evaluator (void);
-
     symbol_scope get_top_scope (void) const;
     symbol_scope get_current_scope (void) const;
     symbol_scope require_current_scope (const std::string& who) const;
@@ -586,6 +586,8 @@
 
     error_system m_error_system;
 
+    tree_evaluator m_evaluator;
+
     help_system m_help_system;
 
     input_system m_input_system;
@@ -604,8 +606,6 @@
 
     symbol_table m_symbol_table;
 
-    tree_evaluator m_evaluator;
-
     stream_list m_stream_list;
 
     child_list m_child_list;
--- a/liboctave/util/oct-inttypes.cc	Sat Nov 26 18:51:28 2022 +0100
+++ b/liboctave/util/oct-inttypes.cc	Sat Nov 26 17:14:01 2022 -0500
@@ -378,6 +378,14 @@
   // Essentially, what we do is compute sign, multiply absolute values
   // (as above) and impose the sign.
 
+  // But first, avoid overflow in computation of abs (min_val ()).
+
+  if (x == min_val ())
+    return y == 0 ? 0 : (y < 0 ? max_val () : min_val ());
+
+  if (y == min_val ())
+    return x == 0 ? 0 : (x < 0 ? max_val () : min_val ());
+
   uint64_t usx = octave_int_abs (x);
   uint64_t usy = octave_int_abs (y);
   bool positive = (x < 0) == (y < 0);