[PATCH 5/5] Fix cast types for opencl
Hannes Domani
ssbssa@yahoo.de
Fri May 31 11:48:01 GMT 2024
The bitshift tests for opencl have these failures:
print /x (signed char) 0x0f << 8
No type named signed char.
(gdb) FAIL: gdb.base/bitshift.exp: lang=opencl: 8-bit, promoted: print /x (signed char) 0x0f << 8
print (signed char) 0x0f << 8
No type named signed char.
(gdb) FAIL: gdb.base/bitshift.exp: lang=opencl: 8-bit, promoted: print (signed char) 0x0f << 8
Apparently opencl doesn't have the 'signed' modifier for types, only
the 'unsigned' modifier.
Even 'char' is guaranteed to be signed if no modifier is used, so
this changes the casts to match this logic.
---
gdb/testsuite/gdb.base/bitshift.exp | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/gdb/testsuite/gdb.base/bitshift.exp b/gdb/testsuite/gdb.base/bitshift.exp
index cab82e1971e..dccc36b20ad 100644
--- a/gdb/testsuite/gdb.base/bitshift.exp
+++ b/gdb/testsuite/gdb.base/bitshift.exp
@@ -123,10 +123,12 @@ proc make_val_cast {lang signed bits val} {
return "$val as ${sign_prefix}$bits"
} else {
# C-like cast.
- if {$signed} {
+ if {!$signed} {
+ set sign_prefix "unsigned "
+ } elseif {$lang == "opencl"} {
set sign_prefix ""
} else {
- set sign_prefix "un"
+ set sign_prefix "signed "
}
if {$bits == 8} {
set type "char"
@@ -143,7 +145,7 @@ proc make_val_cast {lang signed bits val} {
} else {
error "$lang: unsupported bits"
}
- return "(${sign_prefix}signed $type) $val"
+ return "(${sign_prefix}$type) $val"
}
}
--
2.35.1
More information about the Gdb-patches
mailing list