From: drl7x Date: Sun, 27 Jan 2002 02:45:50 +0000 (+0000) Subject: Added test case for pproblem with typedefs and fixed size arrays. X-Git-Tag: splint-3_0_1_5~4 X-Git-Url: http://andersk.mit.edu/gitweb/splint.git/commitdiff_plain/e7af859818da51dc25010dd482f685fc49fbfdc9 Added test case for pproblem with typedefs and fixed size arrays. --- diff --git a/test/moreBufferTests2.expect b/test/moreBufferTests2.expect index 64a539e..c95ca7d 100644 --- a/test/moreBufferTests2.expect +++ b/test/moreBufferTests2.expect @@ -7,3 +7,13 @@ unknownsize.c:9:3: Possible out-of-bounds store: requires maxSet(c @ unknownsize.c:9:3) >= 9 Finished checking --- 1 code warning, as expected + +fixedArrayType.c: (in function fixedArrayTouch) +fixedArrayType.c:9:3: Possible out-of-bounds store: + Unable to resolve constraint: + requires sizeof(Array) @ fixedArrayType.c:9:23 <= 10 + needed to satisfy precondition: + requires maxSet(buffer @ fixedArrayType.c:9:3) >= sizeof(Array) @ + fixedArrayType.c:9:23 - 1 + +Finished checking --- 1 code warning, as expected diff --git a/test/moreBufferTests2/Makefile b/test/moreBufferTests2/Makefile index 45eb329..3aac2b8 100644 --- a/test/moreBufferTests2/Makefile +++ b/test/moreBufferTests2/Makefile @@ -4,4 +4,5 @@ check: $(SPLINT) -exportlocal +bounds unknownsize.c arrayConstExpr.c -expect 1 + $(SPLINT) -exportlocal +bounds fixedArrayType.c -expect 1 diff --git a/test/moreBufferTests2/fixedArrayType.c b/test/moreBufferTests2/fixedArrayType.c new file mode 100644 index 0000000..ac88562 --- /dev/null +++ b/test/moreBufferTests2/fixedArrayType.c @@ -0,0 +1,12 @@ +#include + +typedef int Array[10]; + +int fixedArrayTouch() +{ + Array buffer; + + buffer[sizeof(Array)-1] = 1; + + return 0; +}