]> andersk Git - splint.git/commitdiff
Added test case for sizeof bug fix.
authordrl7x <drl7x>
Fri, 29 Nov 2002 22:59:50 +0000 (22:59 +0000)
committerdrl7x <drl7x>
Fri, 29 Nov 2002 22:59:50 +0000 (22:59 +0000)
test/Makefile.am
test/Makefile.in
test/sizeoftest.expect
test/sizeoftest/sizeofConst.c [new file with mode: 0644]

index e1049f2dc6f496eea7b978b2bf8a7aaff807e982..4ec559c6ea71749b98ae60997789a230c824f6fd 100644 (file)
@@ -60,7 +60,7 @@ UNITEXPECTS = $(addsuffix .expect, $(UNITTESTS))
 
 SUBDIRTESTS = metastate mergestate tainted fileio \
    simplebufferConstraintTests moreBufferTests moreBufferTests2 globalbufferannotation \
-   maxset strchr for manual
+   maxset strchr sizeoftest for manual
 
 ### warnuse doesn't work yet!
 SUBDIRTESTS += tests2.2
@@ -919,6 +919,7 @@ freearray:
 sizeof:
        -$(SPLINTR) +bounds sizeof.c -expect 1
 
+
 .PHONY: buffertest
 buffertest:
        -$(SPLINTR) +bounds buffertest1.c -expect 5
@@ -1228,6 +1229,8 @@ EXTRA_DIST =  ./abst_t.lcl \
               ./simplebufferConstraintTests/test3.c \
               ./simplebufferConstraintTests/test7.c \
               ./sizeoftest/sizeof.c \
+              ./sizeoftest/Makefile.c \
+              ./sizeoftest/sizeofConst.c \
               ./strchr/strchr.c \
               ./suppressfile/test.c \
               ./tainted/sprintf.c \
index 83152e30389a9afb997ba132dea95e46372aa07f..54e0891b60fe37df6f4567c1348b6101f64f5656 100644 (file)
@@ -1,6 +1,7 @@
-# Makefile.in generated automatically by automake 1.5 from Makefile.am.
+# Makefile.in generated by automake 1.6.3 from Makefile.am.
+# @configure_input@
 
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
 # Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -12,7 +13,6 @@
 # PARTICULAR PURPOSE.
 
 @SET_MAKE@
-
 SHELL = @SHELL@
 
 srcdir = @srcdir@
@@ -43,9 +43,13 @@ AUTOCONF = @AUTOCONF@
 AUTOMAKE = @AUTOMAKE@
 AUTOHEADER = @AUTOHEADER@
 
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_HEADER = $(INSTALL_DATA)
 transform = @program_transform_name@
@@ -61,6 +65,10 @@ host_alias = @host_alias@
 host_triplet = @host@
 target_alias = @target_alias@
 target_triplet = @target@
+
+EXEEXT = @EXEEXT@
+OBJEXT = @OBJEXT@
+PATH_SEPARATOR = @PATH_SEPARATOR@
 AMTAR = @AMTAR@
 AWK = @AWK@
 BISON = @BISON@
@@ -70,17 +78,18 @@ CP = @CP@
 CPP = @CPP@
 DEPDIR = @DEPDIR@
 DIFF = @DIFF@
-EXEEXT = @EXEEXT@
 GREP = @GREP@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 LCLOBJ = @LCLOBJ@
 LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
 LN_S = @LN_S@
 MV = @MV@
-OBJEXT = @OBJEXT@
 PACKAGE = @PACKAGE@
 RM = @RM@
 SED = @SED@
+STRIP = @STRIP@
 VERSION = @VERSION@
 am__include = @am__include@
 am__quote = @am__quote@
@@ -142,7 +151,7 @@ UNITEXPECTS = $(addsuffix .expect, $(UNITTESTS))
 ### warnuse doesn't work yet!
 SUBDIRTESTS = metastate mergestate tainted fileio \
    simplebufferConstraintTests moreBufferTests moreBufferTests2 globalbufferannotation \
-   maxset strchr for manual\
+   maxset strchr sizeoftest for manual\
 tests2.2 tests2.4 tests2.5 db1 db2 db3
 
 SPLINTTESTS = $(UNITTESTS) $(SUBDIRTESTS)
@@ -458,6 +467,8 @@ EXTRA_DIST = ./abst_t.lcl \
               ./simplebufferConstraintTests/test3.c \
               ./simplebufferConstraintTests/test7.c \
               ./sizeoftest/sizeof.c \
+              ./sizeoftest/Makefile.c \
+              ./sizeoftest/sizeofConst.c \
               ./strchr/strchr.c \
               ./suppressfile/test.c \
               ./tainted/sprintf.c \
@@ -785,14 +796,11 @@ $(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.ac $(ACLOCAL_M4)
        cd $(top_srcdir) && \
          $(AUTOMAKE) --foreign  test/Makefile
 Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
-       cd $(top_builddir) && \
-         CONFIG_HEADERS= CONFIG_LINKS= \
-         CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
+       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
 uninstall-info-am:
 tags: TAGS
 TAGS:
 
-
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 
 top_distdir = ..
@@ -800,15 +808,20 @@ distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
 
 distdir: $(DISTFILES)
        $(mkinstalldirs) $(distdir)/./conditions $(distdir)/./db1 $(distdir)/./db2 $(distdir)/./db3 $(distdir)/./fileio $(distdir)/./for $(distdir)/./globalbufferannotation $(distdir)/./manual $(distdir)/./maxset $(distdir)/./mergestate $(distdir)/./metastate $(distdir)/./moreBufferTests $(distdir)/./moreBufferTests2 $(distdir)/./nullterminatedtest $(distdir)/./simplebufferConstraintTests $(distdir)/./sizeoftest $(distdir)/./strchr $(distdir)/./suppressfile $(distdir)/./tainted $(distdir)/./tclauses $(distdir)/./temp $(distdir)/./tests2.2 $(distdir)/./tests2.2a $(distdir)/./tests2.4 $(distdir)/./tests2.4/subdir $(distdir)/./tests2.5 $(distdir)/./warnuse $(distdir)/moreBufferTests2
-       @for file in $(DISTFILES); do \
-         if test -f $$file; then d=.; else d=$(srcdir); fi; \
+       @list='$(DISTFILES)'; for file in $$list; do \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
          dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
          if test "$$dir" != "$$file" && test "$$dir" != "."; then \
-           $(mkinstalldirs) "$(distdir)/$$dir"; \
+           dir="/$$dir"; \
+           $(mkinstalldirs) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
          fi; \
          if test -d $$d/$$file; then \
-           cp -pR $$d/$$file $(distdir) \
-           || exit 1; \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
          else \
            test -f $(distdir)/$$file \
            || cp -p $$d/$$file $(distdir)/$$file \
@@ -832,6 +845,7 @@ install-am: all-am
 installcheck: installcheck-am
 install-strip:
        $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         INSTALL_STRIP_FLAG=-s \
          `test -z '$(STRIP)' || \
            echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
 mostlyclean-generic:
@@ -839,7 +853,7 @@ mostlyclean-generic:
 clean-generic:
 
 distclean-generic:
-       -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
+       -rm -f Makefile $(CONFIG_CLEAN_FILES)
 
 maintainer-clean-generic:
        @echo "This command is intended for maintainers to use"
index 7282421a370ec360eb51b9820471d2ba19abd039..e7cd00ad71ad05b8f242508604f189b5bc638ef0 100644 (file)
@@ -1,9 +1,10 @@
 
 sizeof.c: (in function main)
 sizeof.c:6:2: Possible out-of-bounds store:
+    x[(sizeof(x))]
     Unable to resolve constraint:
     requires 2 >= 3
      needed to satisfy precondition:
     requires maxSet(x @ sizeof.c:6:2) >= 3
 
-Finished LCLint checking --- 1 code error found
+Finished checking --- 1 code warning
diff --git a/test/sizeoftest/sizeofConst.c b/test/sizeoftest/sizeofConst.c
new file mode 100644 (file)
index 0000000..d63a186
--- /dev/null
@@ -0,0 +1,12 @@
+/*@null@*/ char * f()
+{
+  char *buf = malloc(sizeof ("1234") );
+  if (buf == NULL)
+    {
+      return NULL;
+    }
+  
+  strcpy(buf, "1234");
+  return buf;
+}
+
This page took 0.88225 seconds and 5 git commands to generate.