Displaying 3 results from an estimated 3 matches for "8b5cd85f".
2013 Nov 28
0
[LLVMdev] Question about ExprConstant optimization of IR stage
Hi Haishan,
> int foo(int j) {
> return ++j > 0;
> }
> int main() {
> if (foo(((~0U)>>1)))
> abort();
> exit(0)
> }
This test contains undefined behaviour, and you can never rely on the
compiler doing anything predictable with that. Specifically, the
result of casting (~0U) >> 1 to an int is almost certainly INT_MAX and
when foo
2013 Nov 29
1
[LLVMdev] Question about ExprConstant optimization of IR stage
...t;> 1 to an int is almost certainly INT_MAX and
>when foo increments it integer overflow occurs, which is undefined.
>
>Cheers.
>
>Tim.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131129/8b5cd85f/attachment.html>
2013 Nov 28
2
[LLVMdev] Question about ExprConstant optimization of IR stage
hi,
I compile a case (test.c) to get IR file (test.ll) using clang as follows:
"clang -emit-llvm -S -O2 test.c -o test.ll"
My clang source code version is release 3.3 and debugging build.
//test.c
int foo(int j) {
return ++j > 0;
}
int main() {
if (foo(((~0U)>>1)))
abort();
exit(0)
}
//end test.c
Here are the generated IR file:
//test.ll
;