http://llvm.org/bugs/show_bug.cgi?id=14722
Bug #: 14722
Summary: mid-optimizer warning
Product: clang
Version: unspecified
Platform: PC
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
Classification: Unclassified
Please reimplement this mid-optimizer warning (currently in instcombine) in
clang instead. Since static analysis can't find all these cases, please also
implement it under -fsanitize=undefined. Testcase:
--
typedef void* FTC_Node;
typedef void* FTC_GQuery;
typedef void* FTC_GNode;
typedef void* FTC_Cache;
typedef void* FT_Pointer;
static unsigned char
FTC_GNode_Compare(FTC_GNode gnode, FTC_GQuery gquery)
{
return 0;
}
typedef unsigned char
(*FTC_Node_CompareFunc)( FTC_Node node,
FT_Pointer key,
FTC_Cache cache );
void test() {
FTC_Node *_node = 0;
FTC_Cache _cache = 0;
FTC_GQuery query = 0;
FTC_Node_CompareFunc _nodcomp = (FTC_Node_CompareFunc)(FTC_GNode_Compare);
_nodcomp( _node, &query, _cache );
}
--
I preserved the names from freetype2 in case anybody wants to go talk to them
about how they're calling a function with an entirely wrong signature.
Previously this caused the following behaviour:
nlewycky@ducttape:~$ llvm/Debug+Asserts/bin/clang -O2 -Wall -Werror warn.c -c
WARNING: While resolving call to function 'FTC_GNode_Compare' arguments were
dropped!
nlewycky@ducttape:~$ llvm/Debug+Asserts/bin/clang -Wall -Werror warn.c -c
As of r171041 it does this:
nlewycky@ducttape:~$ llvm/Debug+Asserts/bin/clang -O2 -Wall -Werror warn.c -c
error: while resolving call to function 'FTC_GNode_Compare' arguments were
dropped
1 error generated.
nlewycky@ducttape:~$ llvm/Debug+Asserts/bin/clang -Wall -Werror warn.c -c
which is now build-breaking. I'd also like some advice from the language folks,
whether we may optimize to 'unreachable' here. I suspect there's some reason we
don't already (K&R?).
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs