Re: sparse-llvm incorrect handling of function pointers

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

 



On 11 March 2017 at 11:54, Luc Van Oostenryck
<luc.vanoostenryck@xxxxxxxxx> wrote:
> On Fri, Mar 10, 2017 at 06:13:16PM +0000, Dibyendu Majumdar wrote:
>> Yes, here is an amended test.
>>
>> static int testfunc(int i) {
>>  return i-6;
>> }
>> static int (*f) (int) = testfunc;
>> int main(int argc, const char *argv[]) {
>>  if (f) {
>>   return f(6);
>>  }
>>  else {
>>   return 1;
>>  }
>> }
>
> This one is because of the static initialization.
>

Yes, this works now:

static int testfunc(int i) {
 return i-6;
}
/* initialiser does not work */
/* static int (*f) (int) = testfunc */
static int (*f) (int);
int main(int argc, const char *argv[]) {
 f = testfunc;
 if (f) {
  return f(6);
 }
 else {
  return 1;
 }
}
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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