https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79588

--- Comment #2 from prathamesh3492 at gcc dot gnu.org ---
Created attachment 40771
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40771&action=edit
untested patch

Hi Jakub,
IIUC, the patch punts if param_pos < args->length(), ie, the default value has
been passed. I suppose it won't warn for case when an argument passed by
caller would equal default argument ?
for eg:

int obj;
bool foo (int *__restrict q, int *__restrict p = &obj) { return false; }
int bar ()
{
  return foo(&obj) == 0;
}

param_pos for p is 1 which equals number of arguments passed and so
warn_for_restrict won't get called ?

I have attached untested patch that tries to warn for above case by
appending default arguments to args vector.
Does it look OK ?

Thanks,
Prathamesh

Reply via email to