https://github.com/el-ev updated 
https://github.com/llvm/llvm-project/pull/196223

>From abba0bb55ff41295326c1a2ce9f981098d76da32 Mon Sep 17 00:00:00 2001
From: Iris Shi <[email protected]>
Date: Thu, 7 May 2026 10:47:25 +0800
Subject: [PATCH 1/2] [clang] Stop simplifyConstraint at embedded NUL

---
 clang/lib/Basic/TargetInfo.cpp                           | 3 +++
 clang/test/CodeGen/inline-asm-constraint-embedded-null.c | 8 ++++++++
 2 files changed, 11 insertions(+)
 create mode 100644 clang/test/CodeGen/inline-asm-constraint-embedded-null.c

diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp
index e6ae89e0948c5..ea0e2671ef380 100644
--- a/clang/lib/Basic/TargetInfo.cpp
+++ b/clang/lib/Basic/TargetInfo.cpp
@@ -1072,6 +1072,9 @@ TargetInfo::simplifyConstraint(StringRef Constraint,
                                SmallVectorImpl<ConstraintInfo> *OutCons) const 
{
   std::string Result;
 
+  // Stop at '\0' to match the old behavior.
+  Constraint = Constraint.split('\0').first;
+
   for (const char *I = Constraint.begin(), *E = Constraint.end(); I < E; I++) {
     switch (*I) {
     default:
diff --git a/clang/test/CodeGen/inline-asm-constraint-embedded-null.c 
b/clang/test/CodeGen/inline-asm-constraint-embedded-null.c
new file mode 100644
index 0000000000000..c2cd3ace0ddd3
--- /dev/null
+++ b/clang/test/CodeGen/inline-asm-constraint-embedded-null.c
@@ -0,0 +1,8 @@
+// REQUIRES: x86-registered-target
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | 
FileCheck %s
+
+// Regression test for issue173900.
+
+// CHECK-LABEL: define {{.*}}void @f(
+// CHECK: call void asm sideeffect "", "f,{{[^"]*}}"(double 0.000000e+00)
+void f(void) { __asm__("" : : "f\0001"(0.0)); }

>From 9dc3d00cc37af60a6db356eb13fc27c34cd86711 Mon Sep 17 00:00:00 2001
From: Iris Shi <[email protected]>
Date: Thu, 7 May 2026 16:42:42 +0800
Subject: [PATCH 2/2] Update clang/lib/Basic/TargetInfo.cpp

---
 clang/lib/Basic/TargetInfo.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp
index ea0e2671ef380..2acdfe339e2f6 100644
--- a/clang/lib/Basic/TargetInfo.cpp
+++ b/clang/lib/Basic/TargetInfo.cpp
@@ -1072,7 +1072,7 @@ TargetInfo::simplifyConstraint(StringRef Constraint,
                                SmallVectorImpl<ConstraintInfo> *OutCons) const 
{
   std::string Result;
 
-  // Stop at '\0' to match the old behavior.
+  // Ignore embedded nulls to match prior (clang-21 and earlier) behavior
   Constraint = Constraint.split('\0').first;
 
   for (const char *I = Constraint.begin(), *E = Constraint.end(); I < E; I++) {

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to