On Wed, 2026-03-18 at 01:54 +0530, Saish Kambali via Gcc wrote:
> Hi David,
>
> I have completed the assignment (Newbies guide), I have the developer
> build
> completed. After many tries, I had implemented the "inform
> (UNKNOWN_LOCATION, "hello world: %qE", cfun->decl);" call to
> gcc/passes.cc
> as following:
>
> if (pass->type == SIMPLE_IPA_PASS || pass->type == IPA_PASS)
> gcc_assert (!cfun && !current_function_decl);
> else
> gcc_assert (cfun && current_function_decl);
>
> if (cfun && cfun->decl)
> {
> inform (UNKNOWN_LOCATION, "hello world: %qE", cfun->decl);
> }
>
> also executed the gdb --args ./gcc/xgcc testfile.c
> and saw the workflow of the compiler from the passes.cc breakpoint I
> added.
Excellent.
>
> For the GSOC 2026, following your suggestion i checked for
> gcc/analyzer/kf.cc and i the known functions (specifically POSIX
> strings
> API's) i found strnlen(), strcasecmp(). strsep() to be missing. So, i
> specifically decided to move forward with strnlen() POSIX as for now.
> I
> have made some small conditional checks:
> Can you please verify them ? So, if any missing, i can add and go
> with
> understanding the code for those conditions with your guidance.
>
> strnlen(ptr, n)
> 1) arg(0) checking for valid pointer,
> 2) to check for buffer bounds whether n to be accessed is greater
> then
> memory allocated for ptr,
> 3) Returned length(L) must be 0 <= L <= n.
Sounds reasonable. I'd suggest to start by writing a test file for the
testsuite, with a variety of valid and invalid uses of the function
you're testing.
You might want to look at kf_strlen and kf_strncpy to get ideas on how
to implement kf_strnlen.
Hope this is helpful
Dave