[llvm-bugs] [Bug 24501] New: unsupported inline asm: input with type 'int' matching output with type 'unsigned long long'
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Aug 19 10:21:18 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=24501
Bug ID: 24501
Summary: unsupported inline asm: input with type 'int' matching
output with type 'unsigned long long'
Product: clang
Version: 3.4
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: jtony at ca.ibm.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Created attachment 14747
--> https://llvm.org/bugs/attachment.cgi?id=14747&action=edit
The test case file used to reproduce the error
This defect was first found when we try to build the open source
FFmpeg:valgrind.h. while it builds fine with GCC, clang gives errors as
follows.
------------------------------------------------------------------------------
To reproduce:
> cat q.C
#include <valgrind/valgrind.h>
> clang q.C
In file included from q.C:1:
/usr/include/valgrind/valgrind.h:4516:47: error: unsupported inline asm: input
with type 'int' matching output with
type 'volatile unsigned long long'
_qzz_res = VALGRIND_DO_CLIENT_REQUEST_EXPR(0,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/usr/include/valgrind/valgrind.h:646:49: note: expanded from macro
'VALGRIND_DO_CLIENT_REQUEST_EXPR'
: "a" (&_zzq_args[0]), "0" (_zzq_default) \
^
/usr/include/valgrind/valgrind.h:4554:47: error: unsupported inline asm: input
with type 'int' matching output with
type 'volatile unsigned long long'
_qzz_res = VALGRIND_DO_CLIENT_REQUEST_EXPR(0,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/usr/include/valgrind/valgrind.h:646:49: note: expanded from macro
'VALGRIND_DO_CLIENT_REQUEST_EXPR'
: "a" (&_zzq_args[0]), "0" (_zzq_default) \
^
2 errors generated.
Error while processing q.C.
------------------------------------------------------------------------------
Because the valgrind.h is so large. I spent some time reducing it to a very
small test case (expand the macro _zzq_default, remove unrelated other parts),
which can still reproduce the above error. As follows:
------------------------------------------------------------------------------
> cat q.C
void VALGRIND_PRINTF(const char *format, ...)
{
unsigned long _qzz_res = ({
unsigned long long int _zzq_result;
__asm__ volatile("lgr 3,%1"
: "=d" (_zzq_result)
: "0" (/*(unsigned long long)i*/0)
);
_zzq_result; });
}
> clang q.C
q.C:7:57: error: unsupported inline asm: input with type 'int' matching output
with type 'unsigned long long'
: "0" (/*(unsigned long long)i*/0)
^
1 error generated.
------------------------------------------------------------------------------
If I explicitly cast 0 to unsigned long long, there will be no error. While I
agree it is dangerous to cast "unsigned long long" to "int" (bug #14408), but I
think it will be nice to make clang implicitly cast "int" to "unsigned long
long" in this case. Furthermore, it seems that only some type promotion work
need to be done in function Sema::ActOnGCCAsmStmt().
------------------------------------------------------------------------------
This bug exists in clang 3.4,3.5 and 3.6.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150819/d070c6a8/attachment.html>
More information about the llvm-bugs
mailing list