Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- validation/vla-sizeof.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 validation/vla-sizeof.c diff --git a/validation/vla-sizeof.c b/validation/vla-sizeof.c new file mode 100644 index 000000000..43079992c --- /dev/null +++ b/validation/vla-sizeof.c @@ -0,0 +1,37 @@ +unsigned long vla_sizeof0(int size) +{ + int a[size]; + return sizeof(a); +} + +unsigned long vla_sizeof1(int size) +{ + struct s { + int a[size]; + }; + return sizeof(struct s); +} + +unsigned long vla_sizeof2(int size) +{ + struct s { + int a[size]; + } *p; + return sizeof(*p); +} + +void* vla_inc(int size, void *base) +{ + struct s { + int a[size]; + } *p = base; + + ++p; + return p; +} + +/* + * check-name: vla-sizeof.c + * + * check-known-to-fail + */ -- 2.14.0 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html