aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/usual-float.c
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2007-11-10 19:45:54 +0000
committerSteve Naroff <snaroff@apple.com>2007-11-10 19:45:54 +0000
commitf68a63f9cf4d31bc009cc2831b4857fb13ee1a30 (patch)
treeffda6d8a6d03feb46849733b4822523a622c2b51 /test/Sema/usual-float.c
parent39d0a27479a58549bc98b55a224d95fa5b09e971 (diff)
Fix a basic bug (having to do with typedefs) in Sema::UsualArithmeticConversions().
This resuled in the following crash below. Also modified the usual-float.c test case to capture this case. [steve-naroffs-imac:clang/test/Sema] snaroff% ../../../../Debug/bin/clang usual-float.c Assertion failed: (0 && "Sema::UsualArithmeticConversions(): illegal float comparison"), function UsualArithmeticConversions, file SemaExpr.cpp, line 960. 0 clang 0x001ef9b9 _ZN40_GLOBAL__N_Signals.cpp_00000000_4E6DAF8315PrintStackTraceEv + 45 1 clang 0x001efd5f _ZN40_GLOBAL__N_Signals.cpp_00000000_4E6DAF8313SignalHandlerEi + 323 2 libSystem.B.dylib 0x90c6297b _sigtramp + 43 3 ??? 0xffffffff 0x0 + 4294967295 4 libSystem.B.dylib 0x90cdb782 raise + 26 5 libSystem.B.dylib 0x90cead3f abort + 73 6 libSystem.B.dylib 0x90cdc923 __assert_rtn + 101 7 clang 0x00077316 _ZN5clang4Sema26UsualArithmeticConversionsERPNS_4ExprES3_b + 1004 8 clang 0x000803cf _ZN5clang4Sema27CheckMultiplyDivideOperandsERPNS_4ExprES3_NS_14SourceLocationEb + 181 9 clang 0x0007a8e8 _ZN5clang4Sema10ActOnBinOpENS_14SourceLocationENS_3tok9TokenKindEPvS4_ + 472 10 clang 0x000cf058 _ZN5clang6Parser26ParseRHSOfBinaryExpressionENS_6Action12ActionResultILj0EEEj + 1286 11 clang 0x000cf2de _ZN5clang6Parser25ParseAssignmentExpressionEv + 86 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43985 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/usual-float.c')
-rw-r--r--test/Sema/usual-float.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/Sema/usual-float.c b/test/Sema/usual-float.c
index 81e9e6d04b..9c1977ff24 100644
--- a/test/Sema/usual-float.c
+++ b/test/Sema/usual-float.c
@@ -1,6 +1,12 @@
// RUN: clang %s -fsyntax-only
+typedef float CGFloat;
+
+extern void func(CGFloat);
void foo(int dir, int n, int tindex) {
const float PI = 3.142;
-float ang = (float) tindex * (-dir*2.0f*PI/n);
+ CGFloat cgf = 3.4;
+
+ float ang = (float) tindex * (-dir*2.0f*PI/n);
+ func((CGFloat)cgf/65535.0f);
}