diff options
Diffstat (limited to '')
-rw-r--r-- | test/testFuncs2.c | 8 | ||||
-rw-r--r-- | test/testFuncs3.c | 56 | ||||
-rw-r--r-- | test/testFuncs3.h | 4 |
3 files changed, 59 insertions, 9 deletions
diff --git a/test/testFuncs2.c b/test/testFuncs2.c index 4bd6ec3..f11a896 100644 --- a/test/testFuncs2.c +++ b/test/testFuncs2.c @@ -77,9 +77,9 @@ typedef gaga incompletearr1; #undef LOCOLUPO #endif -#define START 0x8000 -#define END 0xFFFF -#define LEN 0x8000 +#define START 0x80000000 +#define END 0xFFFFFFFF +#define LEN 0x80000000 #if ((START + LEN) > END) #if 0 #error Buffer Overrun @@ -313,11 +313,13 @@ void testfunc11(void) short unsigned int b; short int* p1; long int* p2; + int normalint; p2 = (long int*)p1; p1 = (short int*)p2; b = a; dd = b; + normalint = a; } void testfunc12(void) diff --git a/test/testFuncs3.c b/test/testFuncs3.c index 7d31764..54c6737 100644 --- a/test/testFuncs3.c +++ b/test/testFuncs3.c @@ -1,16 +1,18 @@ /*first line intentionally left blank.*/ +/*********************************************************************************************************************/ int crappyint; - +/*********************************************************************************************************************/ +/*inclusion directives*/ #include "testFuncs3.h" #include <complex.h> - - +/*********************************************************************************************************************/ +/*globals*/ int intarray3[3][2] = MACRO1; int intarray4[3][2] = MACRO2; int answer = ANSWER; - +/*********************************************************************************************************************/ void tddfunc1 (void) { double complex z1 = 10.0 + 10.0 * I; @@ -57,8 +59,52 @@ void tddfunc3(void) READ_TIME_34(); } -void tddfunc4(void) +int* tddfunc4(void) { + int localauto; + return (&localauto); +} +void tddfunc5(void) +{ + int arrint[4]; + arrint[0] = 052; + arrint[1] = 067; + arrint[2] = 100; + arrint[3] = 786; +} + +/*12.12 tdd*/ +void tddfunc6(void) +{ + float floatbitaccess; + int* pointertofloat; + int apartoffloat; + /*@DEVI-you cannot get away with this since c90 and c99 both specify that operands to & need to both be of integral types.*/ + /*embedded compilers might not necessarily be ISO-C-complete so apparently this might be actually viable in some cases but + if the clang parser won't let this through, i can't analyze it so we can't check for this.*/ +#if 0 + apartoffloat = floatbitaccess & 0x000000FF; +#endif + /*this results in a bticast castexpr which we are already tagging,clang does too, so im not overly concerned with this one + though its fairly east to implement.*/ + pointertofloat = &floatbitaccess; + + /*we could literally just tag all unions having float members as possible violations.*/ + union aunion + { + float member1; + union member2 + { + unsigned char member3; + unsigned char member4; + unsigned char member5; + unsigned char member6; + } member22; + } aunionproto; + + aunionproto.member1 = floatbitaccess; + apartoffloat = aunionproto.member22.member5 & 0x000000FF; } +/*********************************************************************************************************************/ /*last line intnetionally left blank.*/ diff --git a/test/testFuncs3.h b/test/testFuncs3.h index 13fdf30..662ed65 100644 --- a/test/testFuncs3.h +++ b/test/testFuncs3.h @@ -56,5 +56,7 @@ do { \ void tddfunc1(void); void tddfunc2(void); void tddfunc3(void); -void tddfunc4(void); +int* tddfunc4(void); +void tddfunc5(void); +void tddfunc6(void); /*last line intenitonally left blank.*/ |