https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106119
--- Comment #2 from Tom Cosgrove <tom.cosgrove at arm dot com> --- Further addendum: If you use a `void *` to save the value of the pointer, you don't get the warning! See https://gcc.godbolt.org/z/fof8a747z i.e. this code does not generate the warning: #include <stdint.h> #include <stdio.h> #include <stdlib.h> void calloc_self_test( __attribute__ ((unused)) int verbose ) { void *buffer1 = calloc( 1, 1 ); void *old_buffer1 = buffer1; free( buffer1 ); buffer1 = calloc( 1, 1 ); int same = ( old_buffer1 == buffer1 ); if( verbose ) printf( " CALLOC(1 again): passed (%s address)\n", same ? "same" : "different" ); free( buffer1 ); }