Hi, here is a tentative patch to implement a new attribute nonzero, which is similar to nonnull, but is not a function attribute but a type attribute. One reason is that nonnull is awkward to use. For this reason, clang allows the use of nonnull in function parameters, but this is incompatible with old and current use of this attribute in gcc (though in a rather obscure use case). See: https://gcc.gnu.org/ml/gcc/2015-05/msg00077.html The other reason is that a nonzero type attribute is conceptually much simpler and at the same time more general than the existing nonnull and nonnull_return function attributes (and could replace both), e.g. we can define non-zero types and diagnose all stores of known constant 0 to variables of this type, use this for computing better value ranges, etc. This patch implements the attribute and adds a warning if a zero constant is passed as argument with nonzero type attribute. Also infer_nonnull_range in gcc/gimple.c is extended to make use of the attribute (which in turn is used by ubsan). In addition, in C the attribute is automatically added to pointers declared as array parameters with static, e.g: void foo(int a[static 5]); Martin (tested on x86_64-unknown-linux-gnu)