https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102238

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
The source and the destination arrays in the test case do not overlap so there
is no warning.  The preprocessed output makes it easier to see than the
original (the destination of the call is the a member of the object pointed to
by the function argument s3 and the %s argument the local array 'a'):

gcc -E pr102238.c
# 0 "pr102238.c"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2
# 1 "pr102238.c"
void sink (int);

extern char a2[2][22];




struct S {
  char a[4];
  char b[4];
};
struct S2 {
  struct S s_1;
  struct S s_2;
  struct S sa3[3];
};
struct S3 {
  struct S2 s2_1;
  struct S2 s2_2;

  struct {
    struct {
      struct {
        struct S sa_3[3];
      } a_1[3];
    } a_2[3][3];
  } a_3[3][3][3];

  char fa[];
};
void test_struct_member_array (struct S3 *s3, int i)
{
  char *a = (char*)s3;
  char *d = s3->s2_2.s_1.a;
  const char *s = s3->s2_2.s_1.a;

  do { char a[22] = "0123456789"; sink (__builtin_sprintf ((d), "%s", a + 40));
} while (0);
  do { char a[22] = "0123456789"; sink (__builtin_sprintf ((d), "%s", a + 41));
} while (0);
  do { char a[22] = "0123456789"; sink (__builtin_sprintf ((d), "%s", a + 42));
} while (0);
}

Reply via email to