Код:
#include  <stdio.h>
#include <stdint.h>
// gcc test.c
// gcc 11.2.1 20210816 [revision 056e324ce46a7924b5cf10f61010cf9dd2ca10e9]
// bug
// test.c:41:5: Warning: «test_bug» accessing 8 bytes in a region of size 4 [-Wstringop-overflow=]
typedef struct test_struct
{
  int type;
  const char *file; // removing this fix warning
  int line; // removing this fix warning
} test_struct;
// warning only when ext_names is second argument
test_struct test_bug(uint32_t *queue_info_count, const char *ext_names[]){
  test_struct retval = (test_struct){ .type = 0,};
  printf("test_bug %s\n",ext_names[*queue_info_count]);
  return retval;
}
// no warning
test_struct test_no_bug(const char *ext_names[], uint32_t *queue_info_count){
  test_struct retval = (test_struct){ .type = 0,};
  printf("test_no_bug %s\n",ext_names[*queue_info_count]);
  return retval;
}
int main(void)
{
  printf("Hello, world!\n");
  uint32_t queue_info_count = 0;
  const char *extension_names[] = {
    "test",
  };
  test_bug(&queue_info_count, extension_names); // warning
  test_no_bug(extension_names, &queue_info_count); // no warning
  return 0;
}
Помогите понять в чем «ошибка» и ошибка ли это, спасибо.


