[libc-commits] [libc] [libc] Correct 'memrchr' definition and re-enable on GPU (PR #67850)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Fri Sep 29 16:21:47 PDT 2023


https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/67850

>From 32e0c75d676f89d2ba847b307602ffcb76ba2ebd Mon Sep 17 00:00:00 2001
From: Joseph Huber <jhuber6 at vols.utk.edu>
Date: Fri, 29 Sep 2023 15:34:31 -0500
Subject: [PATCH] [libc] Correct 'memrchr' definition and re-enable on GPU

Summary:
This was disabled on the GPU because it conflicted with the definition
in `glibc`. According to information online and in the `glibc`
implementation, the first argument should be a `const void *`. Fixing
this resolves the problem when exporting this to offloading languages.
---
 libc/spec/gnu_ext.td | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/spec/gnu_ext.td b/libc/spec/gnu_ext.td
index 362add7283d6e11..dfb12419d14005b 100644
--- a/libc/spec/gnu_ext.td
+++ b/libc/spec/gnu_ext.td
@@ -69,7 +69,7 @@ def GnuExtensions : StandardSpec<"GNUExtensions"> {
         FunctionSpec<
             "memrchr",
             RetValSpec<VoidPtr>,
-            [ArgSpec<VoidPtr>, ArgSpec<IntType>, ArgSpec<SizeTType>]
+            [ArgSpec<ConstVoidPtr>, ArgSpec<IntType>, ArgSpec<SizeTType>]
         >,
         FunctionSpec<
             "strerror_r",



More information about the libc-commits mailing list