Re: [PATCH v1] Remove 'restrict' from 'nptr' in strtol(3)-like functions

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

 



在 2024-07-05 23:23, Alejandro Colomar via Gcc 写道:
Hi Martin,

On Fri, Jul 05, 2024 at 05:02:15PM GMT, Martin Uecker wrote:
But when the thing gets non-trivial, as in strtol(3), GCC misses the
-Wrestrict diagnostic, as reported in

A pointer to `char` can alias any object, so in theory one could write code that looks like below. This piece of code is probably nonsense, but it illustrates the exact necessity of the `restrict` qualifiers:

   char*
   dumb(char* p)
     {
       strtol((const char*) &p, &p, 0);
       return p;
     }

   // warning: passing argument 2 to 'restrict'-qualified parameter
   // aliases with argument 1






--
Best regards,
LIU Hao

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux