aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/inline-early
AgeCommit message (Collapse)AuthorFilesLines
2022-06-27Merge branches 'unreplaced' and 'inline'Luc Van Oostenryck1-0/+13
* fix "unreplaced" warnings caused by using typeof() on inline functions * cleanup related to inlining of variadic functions
2022-06-26inline: add testcases for inlining of variadicsLuc Van Oostenryck1-0/+13
Inlining of variadic functions needs some special cases. Add some testcases for this. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2022-06-24fix "unreplaced" warnings caused by using typeof() on inline functionsLuc Van Oostenryck1-0/+28
Currently, sparse do all its inlining at the tree level, during constant expansion. To not mix-up the evaluation of the original function body in case the address of an inline function is taken or when the function can't otherwise be inlined, the statements and symbols lists of inline functions are kept in separated fields. Then, if the original body must be evaluated it must first be 'uninlined' to have a copy in the usual fields. This make sense when dealing with the definition of the function. But, when using typeof() on functions, the resulting type doesn't refer to this definition, it's just a copy of the type and only of the type. There shouldn't be any reasons to uninline anything. However, the distinction between 'full function' and 'type only' is not made during evaluation and the uninlining attempt produce a lot of "warning: unreplaced symbol '...'" because of the lack of a corresponding definition. Fix this by not doing the uninlining if the symbol lack a definition. Note: It would maybe be more appropriate for EXPR_TYPE to use a stripped-own version of evaluate_symbol() doing only the examination of the return and argument types, bypassing the attempt to uninline the body and evaluate the initializer and the statements since there is none of those for an EXPR_TYPE. Link: https://lore.kernel.org/all/202206191726.wq70mbMK-lkp@intel.com Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
2022-06-07fix crash when inlining casts of erroneous expressionsLuc Van Oostenryck1-0/+15
Sparse do inlining very early, during expansion, just after (type) evaluation and before IR linearization, and is done even if some errors have been found. This means that the inlining must be robust against erroneous code. However, during inlining, a cast expression is always dereferenced and a crash will occur if not valid (in which case it should be null). Fix this by checking for null cast expressions and directly returning NULL, like done for the inlining of the other invalid expressions. Link: https://lore.kernel.org/r/e42698a9-494c-619f-ac16-8ffe2c87e04e@intel.com Reported-by: kernel test robot <lkp@intel.com> Reported-by: Yafang Shao <laoar.shao@gmail.com> Reported-by: Yujie Liu <yujie.liu@intel.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>