Index: src/invocation/invoke-x86_64.m ================================================================== --- src/invocation/invoke-x86_64.m +++ src/invocation/invoke-x86_64.m @@ -264,11 +264,11 @@ pushGPR(&context, ¤tGPR, int128Tmp[1]); # endif break; #endif case 'f':; - float floatTmp; + double floatTmp = 0; [invocation getArgument: &floatTmp atIndex: i]; pushDouble(&context, ¤tSSE, floatTmp); break; case 'd':; Index: tests/OFInvocationTests.m ================================================================== --- tests/OFInvocationTests.m +++ tests/OFInvocationTests.m @@ -84,11 +84,32 @@ { return (d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10 + d11 + d12 + d13 + d14 + d15 + d16) / 16; } -- (long double)invocationTestMethod4: (long double)d1 +- (float)invocationTestMethod4: (double)d1 + : (float)f2 + : (float)f3 + : (float)f4 + : (float)f5 + : (float)f6 + : (float)f7 + : (float)f8 + : (float)f9 + : (double)d10 + : (float)f11 + : (float)f12 + : (float)f13 + : (float)f14 + : (float)f15 + : (float)f16 +{ + return (d1 + f2 + f3 + f4 + f5 + f6 + f7 + f8 + f9 + d10 + f11 + + f12 + f13 + f14 + f15 + f16) / 16; +} + +- (long double)invocationTestMethod5: (long double)d1 : (long double)d2 : (long double)d3 : (long double)d4 : (long double)d5 : (long double)d6 @@ -106,11 +127,11 @@ return (d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10 + d11 + d12 + d13 + d14 + d15 + d16) / 16; } #ifndef __STDC_NO_COMPLEX__ -- (complex double)invocationTestMethod5: (complex float)c1 +- (complex double)invocationTestMethod6: (complex float)c1 : (complex double)c2 : (complex float)c3 : (complex double)c4 : (complex float)c5 : (complex double)c6 @@ -144,11 +165,11 @@ return (c1 + c2 + c3 + c4 + c5 + c6 + c7 + c8 + c9 + c10 + c11 + c12 + c13 + c14 + c15 + c16) / 16; } -- (complex long double)invocationTestMethod6: (complex double)c1 +- (complex long double)invocationTestMethod7: (complex double)c1 : (complex float)c2 : (complex long double)c3 : (complex double)c4 : (complex float)c5 : (complex long double)c6 @@ -185,11 +206,11 @@ } #endif #ifdef __SIZEOF_INT128__ __extension__ -- (__int128)invocationTestMethod7: (int)i1 +- (__int128)invocationTestMethod8: (int)i1 : (__int128)i2 : (__int128)i3 : (__int128)i4 : (int)i5 : (__int128)i6 @@ -321,14 +342,40 @@ double doubleResult; TEST(@"-[invoke] #2", R([invocation invoke]) && R([invocation getReturnValue: &doubleResult]) && doubleResult == 8.5) + /* -[invoke] #3 */ + selector = @selector(invocationTestMethod4::::::::::::::::); + invocation = [OFInvocation invocationWithMethodSignature: + [self methodSignatureForSelector: selector]]; + + [invocation setArgument: &self + atIndex: 0]; + [invocation setArgument: &selector + atIndex: 1]; + + for (int i = 1; i <= 16; i++) { + float f = i; + double d = i; + + if (i == 1 || i == 10) + [invocation setArgument: &d + atIndex: i + 1]; + else + [invocation setArgument: &f + atIndex: i + 1]; + } + + float floatResult; + TEST(@"-[invoke] #3", R([invocation invoke]) && + R([invocation getReturnValue: &floatResult]) && floatResult == 8.5) + /* Only when encoding long doubles is supported */ if (strcmp(@encode(double), @encode(long double)) != 0) { - /* -[invoke] #3 */ - selector = @selector(invocationTestMethod4::::::::::::::::); + /* -[invoke] #4 */ + selector = @selector(invocationTestMethod5::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; @@ -340,18 +387,18 @@ [invocation setArgument: &d atIndex: i + 1]; } long double longDoubleResult; - TEST(@"-[invoke] #3", R([invocation invoke]) && + TEST(@"-[invoke] #4", R([invocation invoke]) && R([invocation getReturnValue: &longDoubleResult]) && longDoubleResult == 8.5) } # ifndef __STDC_NO_COMPLEX__ - /* -[invoke] #4 */ - selector = @selector(invocationTestMethod5::::::::::::::::); + /* -[invoke] #5 */ + selector = @selector(invocationTestMethod6::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; @@ -369,19 +416,19 @@ [invocation setArgument: &cd atIndex: i + 1]; } complex double complexDoubleResult; - TEST(@"-[invoke] #4", R([invocation invoke]) && + TEST(@"-[invoke] #5", R([invocation invoke]) && R([invocation getReturnValue: &complexDoubleResult]) && complexDoubleResult == 8.5 + 4.25 * I) /* Only when encoding complex long doubles is supported */ if (strcmp(@encode(complex double), @encode(complex long double)) != 0) { - /* -[invoke] #5 */ - selector = @selector(invocationTestMethod6::::::::::::::::); + /* -[invoke] #6 */ + selector = @selector(invocationTestMethod7::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; @@ -408,19 +455,19 @@ break; } } complex long double complexLongDoubleResult; - TEST(@"-[invoke] #5", R([invocation invoke]) && + TEST(@"-[invoke] #6", R([invocation invoke]) && R([invocation getReturnValue: &complexLongDoubleResult]) && complexLongDoubleResult == 8.5 + 4.25 * I) } # endif # ifdef __SIZEOF_INT128__ - /* -[invoke] #6 */ - selector = @selector(invocationTestMethod7::::::::::::::::); + /* -[invoke] #7 */ + selector = @selector(invocationTestMethod8::::::::::::::::); invocation = [OFInvocation invocationWithMethodSignature: [self methodSignatureForSelector: selector]]; [invocation setArgument: &self atIndex: 0]; @@ -439,15 +486,15 @@ [invocation setArgument: &i128 atIndex: i + 1]; } __extension__ __int128 int128Result; - TEST(@"-[invoke] #6", R([invocation invoke]) && + TEST(@"-[invoke] #7", R([invocation invoke]) && R([invocation getReturnValue: &int128Result]) && int128Result == __extension__ ((__int128)0xFFFFFFFFFFFFFFFF << 64) + 8) # endif #endif [pool drain]; } @end