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

2015-05-02 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65958

Eric Botcazou ebotcazou at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |ebotcazou at gcc dot 
gnu.org

--- Comment #4 from Eric Botcazou ebotcazou at gcc dot gnu.org ---
Two things to do here: 1) switch ARM to modern stack-checking and 2) fix the
underlying issue with alloca and VLAs.


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

2015-05-02 Thread ebotcazou at gcc dot gnu.org
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).