On MCST Elbrus 2000, in protected mode, memory pointers can't be reused, and yes crashes in protected mode.

This patch fixes this by disabling reuse_operand_strings in this mode.


diff --git a/src/yes.c b/src/yes.c
index b6bd35a5e..64b40f147 100644
--- a/src/yes.c
+++ b/src/yes.c
@@ -99,6 +99,12 @@ main (int argc, char **argv)

   /* Fill the buffer with one copy of the output.  If possible, reuse
      the operands strings; this wins when the buffer would be large.  */
+  #ifdef __e2k__
+  if (sizeof(void*) == 16)
+    { // In E2K protected mode we can't reuse operands memory
+      reuse_operand_strings = false;
+    }
+  #endif
   char *buf = reuse_operand_strings ? *operands : xmalloc (bufalloc);
   size_t bufused = 0;
   operandp = operands;


  • [PATCH] yes: fix E2... Mikhail Barashkov via GNU coreutils General Discussion

Reply via email to