Why does printing a pointer cause it to escape?

Erick Ochoa eochoa@gcc.gnu.org
Wed Jun 23 10:32:25 GMT 2021


I know that some BUILT_IN functions are treated in a special way by
the points-to analysis. Those functions are those that take pointers
as arguments or return them but do not change their points-to set and
similar cases. (E.g. strcpy returns a pointer to the same object as
their first argument points to.)

I notice that in these special cases, the printf function is nowhere
to be found, and if one prints a pointer using printf the pointer
points to escaped memory.

Why is this the case?


More information about the Gcc mailing list