Sparse/ News Archive
Sparse 0.4.1 released

I have tagged and tarballed Sparse 0.4.1, now available from http://kernel.org/pub/software/devel/sparse/dist/sparse-0.4.1.tar.gz, with sha1sum 14085c5317cd7f2c8392fb762969906fa91888ef.

This bugfix release fixes a Sparse assertion which recent Linux kernels started triggering, along with a few other fixes.

Full changelog:

Christopher Li (1): Perform local label lookup

Emil Medve (1): Handle ignored attribute malloc

Josh Triplett (4): Add comment on taint flags enum referencing expr->taint Add test-suite metadata to validation/local-label.c Add known-to-fail test case for a static forward declaration Makefile: VERSION=0.4.1

Mike Frysinger (1): fix install perms of manpages

Tilman Sauerbeck (1): Added a prototype for mempcpy().

-- Josh Triplett

Posted Tue Nov 13 04:26:45 2007
Sparse 0.4 released

I have tagged and tarballed Sparse 0.4, now available from http://kernel.org/pub/software/devel/sparse/dist/sparse-0.4.tar.gz, with sha1sum a77a10174c8cdb5314eb5000c1e4f24458848b91.

Highlights and visible changes in this release:

Full changelog:

Al Viro (51):
      handle __alignof as equivalent of __alignof__
      saner reporting of overlaps in initializers
      check for whitespace before object-like macro body
      fix alignment for _Bool
      fix interaction of typeof with bitwise types
      better recovery from bad operations on bitwise
      make copying of EXPR_INDEX non-lazy
      tie the fields of struct in simple list
      rewrite of initializer handling
      fix handling of typeof on structs
      missing NULL checks in initializer handling
      take cast_to() out of usual_conversions(), do it in callers
      mechanically split compatible_assignment_types()
      null pointer constants have no special meaning for pointer subtraction
      remove long-dead variable in evaluate_ptr_add()
      remove useless argument in evaluate_ptr_sub()
      cleanup of evaluate_assign_op()
      clean up the typechecking in arithmetics
      clean up usual_conversions(), kill evaluate_shift()
      fix index conversions in evaluate_ptr_add()
      fix default argument promotion
      move degenerate() down into compatible_assignment_types()
      in case of compound literal we want to delay examining type
      warn on return <void expression>;
      deal with enum members without excessive PITA
      implement __builtin_offsetof()
      fix handling of integer constant expressions
      fix the comma handling in integer constant expressions
      first pass at null pointer constants
      make size_t better approximate the reality
      fix handling of address_space in casts and assignments
      fix handling of pointers in ?:
      saner show_type()
      clean up evaluate_sign()
      integer_promotions() can't get SYM_NODE or SYM_ENUM
      start cleaning type_difference()
      get compatible_assignment_types() deal with all cases
      fix the sanity check in evaluate_ptr_sub()
      rewrite type_difference()
      deal correctly with qualifiers on arrays
      add __builtin_strlen()
      no such thing as array of functions
      new helper: unfoul()
      handling of typeof in evaluate_member_dereference()
      file and global scopes are the same for purposes of struct redefining
      ...,array should degenerate
      sanitize evaluate_ptr_add(), start checking for pointers to functions
      fix evaluate_compare()
      sanitize evaluate_postop()
      saner -Wtypesign
      braino in conditional_expression()

Alberto Bertogli (1):
      Implement x86-64 support in cgcc.

Alexey Dobriyan (2):
      Fix infinite loop in free_preprocessor_line()
      Fix -E handling

Christopher Li (2):
      combinations string clean up
      Pass a bitmask of keywords to handle_attributes

Damien Lespiau (6):
      Change sparse homepage in ctags headers.
      __DATE__ & __TIME expansion
      Beautify all & install Makefile targets
      test-suite: a tiny test automation script
      test-suite documentation
      Sample test-suite test cases

Dan Sheridan (2):
      Improved graph generation using subgraph clusters for functions
      Add gvpr-based post-processing for graphs

Josh Triplett (118):
      Fix website and repository references in FAQ
      Fix the version number
      Remove old version note.
      gitweb lives at git.kernel.org now.
      Add a "make dist" that requires $(VERSION) to match `git describe`
      Add test case for __asm__ __volatile__(...)
      Make cgcc not pass -Wall to sparse even if passing it to cc
      Teach cgcc about all currently existing sparse warning options
      Teach cgcc about -ventry and -vdead
      Parse asm after a label as a statement, not an attribute
      Add test case for stdcall and cdecl attributes.
      Add -Wno-old-initializer to turn off warnings about non-C99 struct initializers
      Add test case for -Wno-old-initializer
      Revert unintentional inclusion of warning fix in previous commit.
      Use %td when printing a ptrdiff_t to avoid problems on 64-bit platforms
      Remove extra space.
      Add shebang to gvpr scripts, make them executable, and change usage accordingly
      Fix an __attribute__() parsing error
      Expand calling convention test case to cover fastcall
      Add -Wno-non-pointer-null to turn off warning about using a plain integer as a NULL pointer
      Add __builtin_strcat and __builtin_strncat.
      Ignore the GCC constructor and destructor attributes
      Remove inaccurate comment designating some attributes as windows-specific.
      Move the ident for defined() into the preprocessor section.
      Reorganize attribute list for readability.
      Add double-underscore variant __always_inline__.
      Add double-underscore variant __noinline__.
      Add no-double-underscore variant "used", ignored like "__used__".
      Add double-underscore variant __syscall_linkage__.
      Add no-double-underscore variant format_arg.
      Add explanatory comment about direct use of __IDENT for preprocessor idents.
      Sparse always defines __STDC__ 1, so cgcc does not need to do so
      Fix old typo: s/wierd/weird/
      Canonicalize URL in FAQ: add www., add trailing slash
      Change "LD" to "LINK" in Makefile prettyprinting.
      Makefile prettyprinting: make INSTALL and other output line up correctly
      Add test case for infinite loop in free_preprocessor_line()
      Turn on -Wdecl by default.
      ctags: Use const as appropriate in cmp_sym()
      validation/old-initializer.c: Make the_s static to avoid extraneous warning.
      validation/restricted-typeof.c: Make globals static to avoid extraneous warnings.
      validation/escapes.c: Make globals static to avoid extraneous warnings.
      validation/non-pointer-null.c: Make global static to avoid extraneous warning.
      Merge commit 'viro/integer-constant'
      Move all the preprocessor tests into validation/preprocessor/
      Move test-suite output files to validation/.gitignore
      .gitignore: Stop ignoring all dotfiles
      validation: Update comments for current Sparse behavior and test-suite.
      Add test-suite comments to all the obvious preprocessor tests
      Make preprocessor-loop a normal numbered preprocessor test
      Add test-suite comment to preprocessor21.
      Add test-suite comment to address_space.c
      Make clean depend on clean-check
      Rename asm-volatile to better describe what it tests
      Add test-suite comment to label-asm.c
      Remove "check-exit-value: 0" and rely on default; remove extra blank line.
      Add test-suite comment to bad-array-designated-initializer.c
      Add c2xml to .gitignore
      Split c2xml build rule into compile and link stages, and add the quiet prefixes
      expression.h needs lib.h for struct position and symbol.h for int_ctype
      Fix GCC warnings in c2xml
      Fix sparse warnings in c2xml: mark globals static and remove unused globals
      Fix test-suite to handle stdout and stderr separately, and fix up tests
      Add test-suite metadata to bad-cast.c
      Add test-suite metadata to bad-ternary-cond.c, and remove now-redundant comment
      Add test-suite metadata to initializer-entry-defined-twice.c
      Add test-suite metadata to context.c
      Add test-suite metadata to escapes.c
      Add test-suite metadata to calling-convention-attributes.c
      Fix typos in test-suite documentation
      Makefile: stop cleaning files we didn't make and have no business cleaning
      Add test-suite metadata to old-initializer.c; also test with -Wno-initializer
      allocate.h: Stop needlessly returning a void value in __DO_ALLOCATOR
      Turn off -Wdo-while by default.
      Add test-suite metadata to label-attr.c
      validation/builtin_safe1.c: Show the unsafe macro argument
      Make "Initializer entry defined twice" a warning, not an error
      Remove explicit restatements of defaults in metadata for member_of_typeof test
      Remove explicit restatements of defaults in metadata for outer-scope test
      Remove explicit restatements of defaults in metadata for comma test
      Add test case for comparing null pointer constant to int.
      Makefile: Use -O2 -finline-functions, not just -O
      cse: Size insn_hash_table more realistically, speeding up CSE significantly
      Add some missing dependencies in the Makefile
      Drop -fpic; it hurts performance and we don't build libsparse.so by default
      Add another test case to validation/comma.c
      ctags: Handle some new namespaces and symbol types.
      is_zero_constant: declare saved const
      Add test case for -Wtypesign
      Sort warning options in lib.c and lib.h
      Rename Wcast_to_address_space to Wcast_to_as to match the command-line argument
      Add a manpage for sparse
      Install the Sparse manpage
      cgcc: Sparse accepts -Wcast-to-as, not -Wcast-to-address-space
      Rename Wundefined_preprocessor to Wundef to match the command-line argument
      cgcc: Sparse accepts -Wundef, not -Wundefined-preprocessor
      Use -fno-strict-aliasing, as the ptrlist code seems to violate C99 strict aliasing rules
      Add test-suite annotations to restricted-typeof.c
      Add test-suite annotations to double-semicolon.c
      Add test-suite annotations to check_byte_count-ice.c
      Add test-suite annotations to badtype4.c
      Add test-suite annotations to varargs1.c
      Add test-suite annotations to struct-attribute-placement.c
      Add test-suite annotations to non-pointer-null.c
      Add test-suite annotations to struct-ns1.c
      Add test-suite annotations to noderef.c
      Makefile: Use ?= to allow overriding OS or AR on the Make command line
      FAQ: Point to URL on vger for subscription instructions and archives
      README: recode from ISO-8859-1 to UTF-8
      validation: Rename typeconvert.c to integer-promotions.c to match its purpose
      Add test-suite annotations to integer-promotions.c
      Add test-suite annotations to cond_expr.c
      Add test-suite annotations to function-pointer-modifier-inheritance.c
      validation: Update comment in type1.c to reflect current state of Sparse
      Add test-suite annotations to init-char-array.c
      Add a manpage for cgcc
      Add SEE ALSO for cgcc in sparse manpage
      Makefile: VERSION=0.4

Kovarththanan Rajaratnam (1):
      libxml compile fix on Cygwin

Michael Stefaniuc (3):
      Ignore the cdecl and stdcall attributes for now.
      Add test for typedef on pointer to function with stdcall attribute.
      '\?' is a valid escape character defined by ANSI C. Its value is '?'.

Mike Frysinger (1):
      Makefile: improve flag handling

Pavel Roskin (5):
      Improve error message if using a member of an incomplete struct or union
      Bitfield without explicit sign should be a warning, not an error
      cgcc: preserve sparse exit code if -no-compile is used
      Avoid use of libc headers in the validation suite
      Fix warnings about undeclared globals, they are irrelevant to the test

Ramsay Jones (2):
      Add (more) support for WIN32 attribute names
      Add cygwin support to cgcc

Randy Dunlap (1):
      add __builtin_labs()

Rob Taylor (4):
      add end position to symbols
      add sparse_keep_tokens api to lib.h
      new get_type_name function
      add c2xml program

Yura Pakhuchiy (1):
      Make cgcc filter out all sparse warning related options

ricknu-0@student.ltu.se (4):
      tokenize.c: Replace handwritten strncmp with existing function.
      expression.c: Clean up match_oplist() and add missing va_end()
      parse.c: Adding va_end().
      tokenize.c: Simplify drop_stream_eoln().

-- Josh Triplett

Posted Sat Sep 15 14:09:29 2007
Sparse 0.3 released

I have tagged and tarballed a 0.3 release of Sparse, now available from http://kernel.org/pub/software/devel/sparse/dist/sparse-0.3.tar.gz, with sha1sum 1d868b29234176abd5f3f5463aad1f11d5268dc2.

Note that the Sparse Git repository has moved to:

git://git.kernel.org/pub/scm/devel/sparse/sparse.git

The old repository location will continue to work for now, but please update any references you have to the old location.

Thanks to Christopher Li for contributing heavily to this release, including several notable new features. See the full changelog for details.

In addition to numerous bug fixes, cleanups, and new test cases, this release includes several new visible features:

Notable internal changes:

Full changelog:

Christopher Li (24):
      Sparse-based Ctags implementation
      Change the symbol access list to a pseudo list
      Add instruction to pseudo user tracking.
      Update usage chain for dead instructions
      Update usage chain for dead branch instruction.
      Allow more than one command line include file.
      Enhance debug information.
      Another attempt to fix the attribute parsing.
      Marking anonymous string.
      Bug fix in pointer modifier inheritance at function degeneration.
      Handle structure attributes between the structure keyword and the name
      Fix the segfault when initializer has unknown symbol
      Fix double semicolon in struct declaration
      Make the ptrlist using the sparse allocator.
      Fix core dump on anonymous symbol.
      Fix a bug that match_idents forget to end with NULL
      Adding debug option for showing the linearized instruction.
      Fix core dump on huge switch
      Introduce expression_error
      Disable liveness "dead" instruction by default.
      Add annotation for inline function call.
      Introduce keyword driven attribute parsing
      Fix the annotated inline call position
      handle label attributes

Christopher Li and Josh Triplett (4):
      Introduce top level parsing for asm parsing.
      Introducing statement keywords
      Free up some special bits in modifiers.
      Moving statement parsing into smaller functions.

James Westby (2):
      Fix mistaken comparison that becomes a no-op.
      Update the information in README about using the library.

Josh Triplett (30):
      Add ctags to .gitignore
      Add a return in the last case of a switch; redundant but less error-prone.
      Coding style fix: in a pointer type, * goes with the name, not the type.
      Add missing #include "allocate.h" in linearize.h for DECLARE_ALLOCATOR.
      Add test case for function pointer modifier inheritance
      Add test case for structure attribute placement.
      Add test case for double semicolon in structure declaration.
      Coding style fix: use parentheses with sizeof
      Move pkg-config file to lib, rather than share
      Add static to declarations in test cases, to remove unrelated warnings.
      Fix typo in symbol.h: s/keywrods/keywords/
      Fix typos in comments
      Use GCC format and sentinel attributes on appropriate functions
      Fix two potential NULL pointer dereferences in dissect.c
      Avoid returning an uninitialized pointer from dup_list of an empty list
      Remove stray space from expand_compare in expand.c
      Prevent potential NULL pointer dereference in expand_compare
      Add test case for basic address_space annotations.
      Use noreturn on die() and error_die()
      Parse and ignore the __regparm__ attribute, just like regparm.
      Fix comment to reference #weak_define rather than #ifndef, matching code
      Teach cgcc about -Wtransparent-union and -Wno-transparent-union
      Declare die_if_error extern in lib.h
      Remove unused variable "include" from lib.c
      Declare do_error static
      Declare gcc_patchlevel extern in lib.h
      compile-i386.c: Declare regs_in_use static
      simplify.c: Declare delete_pseudo_user_list_entry static
      linearize: DECLARE_ALLOCATOR for asm_constraint and asm_rules
      Fix most -Wshadow warnings in Sparse.

Oleg Nesterov (3):
      dissect: cleanup report_implicit()
      dissect: fix multidimensional array initializer
      dissect: simplify lookup_member()

-- Josh Triplett

Posted Tue May 1 13:55:48 2007
Sparse in Google Summer of Code 2007

Google has accepted Sparse as a mentoring organization for Summer of Code 2007. Interested students can propose work on Sparse-related projects, work on those projects over the summer, and receive a stipend from Google for their work.

Student application deadline: March 24th

Sparse, the semantic parser, provides a compiler frontend capable of parsing most of ANSI C as well as many GCC extensions, and a collection of sample compiler backends, including a static analyzer also called 'sparse'. Sparse provides a set of annotations designed to convey semantic information about types, such as what address space pointers point to, or what locks a function acquires or releases. The Linux kernel community uses Sparse to check for common errors in kernel source code. Other projects, such as X.org, have begun to use Sparse as well.

Working on a Sparse project gives students the opportunity to put many core CS skills into practice on a real-world compiler and static analyzer, and gain some recognition within the prominent community of Free and Open Source Software developers working on the Linux kernel.

You can see the current Summer of Code project list for Sparse, or propose an idea of your own.

Students need to apply by March 24th. You can apply at http://code.google.com/soc.

Any Sparse developers interested in mentoring projects over the summer (which primarily consists of answering questions about Sparse, such as on the mailing list), please apply via the Google Summer of Code mentorship application at http://code.google.com/soc/mentor.html, and check the "Sparse" box. Please also mail me with details.

Any Linux developers interested in seeing Sparse do something that it can't currently do, please propose possible Summer of Code projects as soon as you can, and I'll add them to the SoC project page.

-- Josh Triplett

Posted Tue Mar 20 16:59:36 2007
Sparse 0.2 released

I have tagged and tarballed a 0.2 release of Sparse, now available from http://kernel.org/pub/linux/kernel/people/josh/sparse/dist/sparse-0.2.tar.gz, with sha1sum 1762fc609fe436e74b87356a52690b5f7bb40c81.

In addition to plenty of bug fixes, this release includes several notable new features:

Full changelog:

Christopher Li (4):
      trivial fix for seg fault.
      Fix warning on self check.
      delay removing file scope
      cleanup write to argument array hack

Damien Lespiau (1):
      trivial: more .gitignore stuff

Josh Triplett (5):
      Update the FAQ: add sparse website and gitweb, update git URL, remove old BK url
      Rename "check.c" to "sparse.c" to match program name; update .gitignore
      Install static library and header files
      Generate and install a pkg-config file.  Add DESTDIR support to Makefile.
      Remove old SCCS target from Makefile.

Nicolas Kaiser (1):
      double inclusions

Oleg Nesterov (7):
      use lookup_macro() in handle_undef()
      kill NS_INVISIBLEMACRO, introduce NS_UNDEF
      fix redefine of #weak_define
      fix 'weak' attribute loss
      prepare for #strong_{define,undef}
      implement #strong_define
      implement #strong_undef

Pavel Roskin (1):
      Support -Wall flag

-- Josh Triplett

Posted Tue Dec 5 03:47:48 2006
Sparse 0.1 released

I have tagged and tarballed a 0.1 release of Sparse, now available from http://kernel.org/pub/linux/kernel/people/josh/sparse/dist/sparse-0.1.tar.gz, with sha1sum 9e0a4d5abb8e8a4be4cf8d9fe632c69dbec3e242.

As discussed in http://marc.theaimsgroup.com/?i=Pine.LNX.4.64.0610311030370.25218@g5.osdl.org, I've taken maintainership of sparse. Thanks to Linus Torvalds for his previous maintainership. As a result, this release comes from my sparse Git repository. You can find more information about obtaining sparse via Git at the new sparse homepage.

In addition to all the work in the previous Sparse repository (pub/scm/devel/sparse/sparse.git), this release includes the following changes:

Adam DiCarlo (1):
      Add type information to enum mismatch warning

Al Viro (2):
      added a bunch of gcc builtins
      switch to hash-based get_one_special()

Josh Triplett (15):
      "Initializer entry defined twice" should not trigger with zero-size fields
      Fix incorrect symbol in comment on #endif for multiple-inclusion guard
      Add -Wno-uninitialized
      graph: Show position in basic block nodes
      bb_terminated: Use boundary values rather than specific opcodes
      Turn on -Wcontext by default
      Merge branch 'fix-defined-twice-error-on-empty-struct' into staging
      Merge branch 'graph' into staging
      merge branch 'more-warning-flags' into staging and fix conflicts
      merge branch 'no-semantic-h' into staging and fix conflicts
      Merge branch 'Wcontext-default' into staging
      Add test cases to validation/context.c for the Linux __cond_lock macro
      Merge branch 'context-test-cases-for-cond-lock' into josh
      Rename test case bad-assignement.c to bad-assignment.c, fixing the typo.
      Stop building and installing libsparse.so

Josh Triplett and Pavel Roskin (1):
      Recognize and ignore __alias__ and __visibility__

Pavel Roskin (4):
      Compile sparse executable under it's own name, not as "check"
      Add support for __builtin_strpbrk()
      Typo fixes
      Install cgcc on "make install", refactor installation code

Known issue with this release:

-- Josh Triplett

Posted Mon Nov 6 21:43:41 2006