Bogus GCC 12.2 warning? added by mario-goulart on Sun Aug 20 14:00:14 2023

In function ‘stub398’,
    inlined from ‘f_1269’ at tcp.c:1439:8:
tcp.c:190:1: warning: ‘memset’ writing 12 bytes into a region of size 0 overflows the destination [-Wstringop-overflow=]
  190 | memset(addr, 0, sizeof(struct sockaddr_in));
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

$ cat -n tcp.c | sed -n '184,195p;196q' 
   184  #define return(x) C_cblock C_r = (((C_word)(x))); goto C_ret; C_cblockend
   185  C_regparm static C_word C_fcall stub398(C_word C_buf,C_word C_a0,C_word C_a1){
   186  C_word C_r=C_SCHEME_UNDEFINED,*C_a=(C_word*)C_buf;
   187  void * saddr=(void * )C_data_pointer_or_null(C_a0);
   188  unsigned short port=(unsigned short )(unsigned short)C_unfix(C_a1);
   189  struct sockaddr_in *addr = (struct sockaddr_in *)saddr;
   190  memset(addr, 0, sizeof(struct sockaddr_in));
   191  addr->sin_family = AF_INET;
   192  addr->sin_port = htons(port);
   193  addr->sin_addr.s_addr = htonl(INADDR_ANY);
   194  C_ret:
   195  #undef return

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

$ gcc --version
gcc (Debian 12.2.0-14) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

;; chicken-core
$ git rev-parse HEAD
61caf8a1c8cd50f7654f614d81c3225e5f72bc0a