For example in this code:
#include <stdio.h>
int main()
{
  char i = 0;
  char j = 0;
  char *p = &i;
  void *q = p;
  int *pp = q;
  printf("%d %d\n", i, j);
  *pp = -1;
  printf("%d %d\n", i, j);
  return 0;
}
if I compile with gcc version 8.1.0 x64 (Ubuntu 8.1.0-5ubuntu1~16.04) the output is:
0 0
-1 -1
now, I use a cast to int *
#include <stdio.h>
int main()
{
  char i = 0;
  char j = 0;
  char *p = &i;
  void *q = p;
  int *pp = (int *)q;
  printf("%d %d\n", i, j);
  *pp = -1;
  printf("%d %d\n", i, j);
  return 0;
}
the result is the same as the previous.
With clang-6.0 x64 the output is:
0 0
-1 0
Is the code apparently a buffer overflow?
I hope I've explained that clearly.
 
     
     
    