Am 14.04.20 um 07:51 schrieb Vahid Bashiri:
> int func(void *var,int val);
> typedef int (*SetVal)(void *, int);
> typedef struct {
>                 int val;
>                 SetVal setval;
>                 } my_struct; 
> int main()
> {  
> 
>     my_struct str1 = {0,func};
>     my_struct str2 = {0,func};
>     str1.setval(&str1,11);  
>     str2.setval(&str2,5);
>     return 0;
> }
> int func(void *var,int val)
> {
>     my_struct *tmp = (my_struct*)var;
>     tmp->val = val;
>     return 0;
> }
> 

I can reproduce this issue; it is definitely a bug.

Plese report it in the bug tracker:
https://sourceforge.net/p/sdcc/bugs/

Though looking at the asm, at first sight it looks more like an
assembler bug rather than a compiler bug to me.

Philipp

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to