This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/65958] -fstack-check breaks alloca on architectures using generic stack checking


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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|arm                         |
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-05-02
                 CC|                            |ebotcazou at gcc dot gnu.org
   Target Milestone|---                         |6.0
            Summary|[arm] -fstack-check breaks  |-fstack-check breaks alloca
                   |__builtin(alloca)           |on architectures using
                   |                            |generic stack checking
     Ever confirmed|0                           |1

--- Comment #3 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
Known issue with architectures doing stack-checking the old way like ARM, but
the underlying issue is more general and related to VLAs:

extern void abort (void);

int foo (int n)
{
  char *p, *q;

  if (1)
    {
      char i[n];
      p = __builtin_alloca (8);
      p[0] = 1;
    }

  q = __builtin_alloca (64);
  __builtin_memset (q, 0, 64);

  return !p[0];
}

int main (void)
{
  if (foo (48) != 0)
    abort ();

  return 0;
}

fails on x86-64 because of it (with or without -fstack-check).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]