help \
abstptr abstract alias alttypes ansireserved argorder \
args arraydims blocks break cases cast charlit clauses commentchar compdestroy \
- constannot controldepth csyntax czechnames czechoslovaknames deadparam \
+ compoundliterals constannot controldepth csyntax czechnames czechoslovaknames deadparam \
decl divzero enum exports external fields flags forbody format freearray \
funcpointer functionmacro glob globals impabstract info init inparam internal iter keep libs \
linked lintcomments list loopexec \
-$(SPLINTRN) compdestroy.c +checks -exportlocal -exportheader +strictdestroy +strictusereleased -expect 3
-$(SPLINTRN) compdestroy.c +strict +partial -exportheader -expect 3
+.PHONY: compoundliterals
+compoundliterals:
+ ${SPLINTRN} compoundliterals.c
+
.PHONY: constannot
constannot:
${SPLINTRN} constannot.c +boundswrite -exportlocal -expect 2
help \
abstptr abstract alias alttypes ansireserved argorder \
args arraydims blocks break cases cast charlit clauses commentchar compdestroy \
- constannot controldepth csyntax czechnames czechoslovaknames deadparam \
+ compoundliterals constannot controldepth csyntax czechnames czechoslovaknames deadparam \
decl divzero enum exports external fields flags forbody format freearray \
funcpointer functionmacro glob globals impabstract info init inparam internal iter keep libs \
linked lintcomments list loopexec \
-$(SPLINTRN) compdestroy.c +checks -exportlocal -exportheader +strictdestroy +strictusereleased -expect 3
-$(SPLINTRN) compdestroy.c +strict +partial -exportheader -expect 3
+.PHONY: compoundliterals
+compoundliterals:
+ ${SPLINTRN} compoundliterals.c
+
.PHONY: constannot
constannot:
${SPLINTRN} constannot.c +boundswrite -exportlocal -expect 2
--- /dev/null
+/* Compound literals, added to C99 */
+struct simple {
+ int a;
+ int b;
+};
+
+typedef struct simple simple_t;
+
+int main (/*@unused@*/ int argc, /*@unused@*/ char **argv) {
+ /* This works */
+ struct simple simple1 = {1,2};
+ /* These don't */
+ struct simple simple2 = (struct simple){1,2};
+ simple_t simple3 = (((((((simple_t){1,2}))))));
+ simple2 = (struct simple) { 1, 2 };
+ printf("%d, %d\n", simple1.a, simple1.b);
+ printf("%d, %d\n", simple2.a, simple2.b);
+ printf("%d, %d\n", simple3.a, simple3.b);
+ return 1;
+}
--- /dev/null
+
+Finished checking --- no warnings
fixedArrayType.c:9:3: Possible out-of-bounds store:
buffer[sizeof(Array) - 1]
Unable to resolve constraint:
- requires sizeof(Array) @ fixedArrayType.c:9:23 <= 10
+ requires sizeof(Array) @ fixedArrayType.c:9:24 <= 10
needed to satisfy precondition:
requires maxSet(buffer @ fixedArrayType.c:9:3) >= sizeof(Array) @
- fixedArrayType.c:9:23 - 1
+ fixedArrayType.c:9:24 - 1
Finished checking --- 1 code warning, as expected