From 65f044a3ef6f5abde2e45a92a503060909100706 Mon Sep 17 00:00:00 2001 From: Stefan Schulze Frielinghaus Date: Tue, 22 Jul 2025 11:26:44 +0200 Subject: [PATCH] genpreds.cc: Do not use rawmemchr for insn_constraint_len The GNU extension rawmemchr cannot be used. Therefore, replace it by a simple loop. gcc/ChangeLog: * genpreds.cc (write_insn_constraint_len): Replace rawmemchr by a loop. --- gcc/genpreds.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/genpreds.cc b/gcc/genpreds.cc index c6a2983419a..4f8beeb0514 100644 --- a/gcc/genpreds.cc +++ b/gcc/genpreds.cc @@ -1184,7 +1184,12 @@ write_insn_constraint_len (void) puts (" default: break;\n" " }\n" " if (str[0] == '{')\n" - " return ((const char *) rawmemchr (str + 1, '}') - str) + 1;\n" + " {\n" + " size_t len = 1;\n" + " while (str[len] != '}' && str[len] != '\\0')\n" + " ++len;\n" + " return len + 1;\n" + " }\n" " return 1;\n" "}\n"); } -- 2.47.3