coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] yes: fix E2K architecture compatibility


From: Mikhail Barashkov
Subject: [PATCH] yes: fix E2K architecture compatibility
Date: Tue, 21 Sep 2021 16:52:54 +0300

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;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]