<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/69310>69310</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
MLIR Mesh dialect badly broke MLIR and Flang on Solaris
</td>
</tr>
<tr>
<th>Labels</th>
<td>
mlir:core,
mlir
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
rorth
</td>
</tr>
</table>
<pre>
Between 20231006 and 20231016, 1800+ test failures appeared on Solaris (both amd64 and sparcv9) in the MLIR and Flang testsuites. The failure mode is always the same:
```
FAIL: Flang :: Driver/bbc-openmp-version-macro.f90 (21590 of 79241)
expected:
{{.*}} = arith.constant 199911 : i32
found:
%c199911_i32 = arith.constant32199911 : i32
```
i.e. where a `' '` is expected, and integer (`32`) is printed.
A reghunt identified this patch
```
commit 08545e85167a105b8147d76a48a2fa1eac0f9e9a
Author: Chengji Yao <yaochengji@hotmail.com>
Date: Tue Oct 10 11:35:40 2023 -0700
[MLIR] Add a new Mesh dialect (#68007)
```
as the culprit. Clearly this snippet makes unwarranted assumptions and causes the breakage:
```
diff --git a/mlir/include/mlir/IR/OpImplementation.h b/mlir/include/mlir/IR/OpIm
plementation.h
--- a/mlir/include/mlir/IR/OpImplementation.h
+++ b/mlir/include/mlir/IR/OpImplementation.h
@@ -366,6 +367,17 @@ operator<<(AsmPrinterT &p, bool value) {
return p << (value ? StringRef("true") : "false");
}
+/// Specialization for 8-bit integers to ensure values are printed as integers
+// and not characters.
+template <
+ typename AsmPrinterT, typename T,
+ std::enable_if_t<llvm::is_one_of<T, int8_t, uint8_t>::value, T> * = nullptr>
+inline std::enable_if_t<std::is_base_of<AsmPrinter, AsmPrinterT>::value,
+ AsmPrinterT &>
+operator<<(AsmPrinterT &p, T value) {
+ return p << static_cast<int16_t>(value);
+}
```
However, `char` is `signed` on Solaris, so every character is printed as integer!
For some reason, I'm not able to assign this Issue to the author, so I'm trying this here: @yaocheng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