diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2022-05-20 22:27:08 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2022-05-21 10:58:37 +0200 |
| commit | b3d7fb1bac881a714fed871db33e98e67b9bf1b6 (patch) | |
| tree | 5247da491753239aa0a7e26e7532959928348b2d /validation | |
| parent | c4706aa764f3ae68258ba60be6325a5662900362 (diff) | |
| download | sparse-dev-b3d7fb1bac881a714fed871db33e98e67b9bf1b6.tar.gz | |
fix infinite loop when expanding __builtin_object_size() with self-init vars
expand_object_size(), used to expand __builtin_object_size(),
recursively try to get the parent initializer. This fails miserably
by looping endlessly when the object is a self-initialized variable.
For the moment, fix this in the most obvious way: stop the recursion
and do not expand such variables.
Note: I wouldn't be surprised if these self-initialized variables create
other problems elsewhere. Maybe we should remove their initializer
and somehow mark them as "do not warn about -Wuninitialized"
(well, there is no such warnings *yet*).
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation')
| -rw-r--r-- | validation/builtin-objsize-self-init.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/validation/builtin-objsize-self-init.c b/validation/builtin-objsize-self-init.c new file mode 100644 index 00000000..77e3da43 --- /dev/null +++ b/validation/builtin-objsize-self-init.c @@ -0,0 +1,11 @@ +static void f(void) +{ + void *param = param; + __builtin_object_size(param, 0); +} + +/* + * check-name: builtin-objsize-self-init + * check-timeout: + * check-error-end + */ |
