]> andersk Git - splint.git/commitdiff
Added test case for pproblem with typedefs and fixed size arrays.
authordrl7x <drl7x>
Sun, 27 Jan 2002 02:45:50 +0000 (02:45 +0000)
committerdrl7x <drl7x>
Sun, 27 Jan 2002 02:45:50 +0000 (02:45 +0000)
test/moreBufferTests2.expect
test/moreBufferTests2/Makefile
test/moreBufferTests2/fixedArrayType.c [new file with mode: 0644]

index 64a539e96ca9c749469faa5fb9f3114a66e30b67..c95ca7d03bc58d1be4ee8313420bdb3ce12a4dd7 100644 (file)
@@ -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
index 45eb3294e7936dfd8b2b49fdd3c59a97ab37269e..3aac2b84dff3265b8ece44e71ec916d713beaf9c 100644 (file)
@@ -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 (file)
index 0000000..ac88562
--- /dev/null
@@ -0,0 +1,12 @@
+#include <stdio.h>
+
+typedef int Array[10];
+
+int fixedArrayTouch()
+{
+  Array buffer;
+
+  buffer[sizeof(Array)-1] = 1;
+
+  return 0;
+}
This page took 0.058341 seconds and 5 git commands to generate.