aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-11-19 01:37:05 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-11-19 21:05:06 +0100
commit2c5eeff0f1741761196b8b2cfc86b71ef9ef9548 (patch)
tree4d998d6e54c483c23acb3176a744ff8a49d4ef3c
parent64003b0b9741888cd801e8822b3adb421876b39f (diff)
downloadsparse-2c5eeff0f1741761196b8b2cfc86b71ef9ef9548.tar.gz
fix assignment: pointer to __pure/__noreturn function to void *
It's fine for a pointer to a __pure or a __noreturn function to be assigned to a void pointer (since this pointer can't be used to make an indirect function call without another cast). Ensure this by ignoring the corresponding modifiers when checking such assignments. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--evaluate.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/evaluate.c b/evaluate.c
index 7c3389cf..b9d3cfe3 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -1464,7 +1464,7 @@ static int check_assignment_types(struct symbol *target, struct expression **rp,
*/
if (b1->type == SYM_FN)
mod1 |= MOD_CONST;
- if (mod2 & ~mod1) {
+ if (mod2 & ~mod1 & ~MOD_FUN_ATTR) {
*typediff = "different modifiers";
return 0;
}