[PATCH 2/5] fix assignment: pointer to __pure/__noreturn function to void *

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 evaluate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/evaluate.c b/evaluate.c
index 7c3389cff..b9d3cfe3c 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;
 			}
-- 
2.24.0




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux