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 bootstrap/77359] [7 Regression] AIX bootstrap failure due to alignment of stack pointer + STACK_DYNAMIC_OFFSET


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

--- Comment #16 from Dominik Vogt <vogt at linux dot vnet.ibm.com> ---
There's nothing wrong with applying that change, but it does not fix the
problem.  I'm still debugging this and have it narrowed down to being related
with functions that use alloca() and call another function using varargs.

This code extracted from gencfn-macros:
--
#include <stdarg.h>
#include <stdio.h>
#include <string.h>

char *gs;

char * concat_copy2 (const char *first, ...)
{
  va_list args;
  va_start (args, first);
  {
    char *end = gs;
    const char *arg;

    for (arg = first; arg ; arg = va_arg (args, const char *))
      {
        unsigned long length = strlen (arg);
        memcpy (end, arg, length);
        end += length;
      }
    *end = '\000';
  }
  va_end (args);

  return gs;
}

bool contains (char *k)
{
  fprintf(stderr, "!!!contains: %p '%s'\n", (void *)&k, (char *)k);
  return false;
}

int main(int argc, char **argv)
{
  char *tmp;

  gs = (char *) __builtin_alloca(14);
  tmp = concat_copy2 ("BUILT_IN_", "blab", 0);

  return contains(tmp) ? 0 : 1;
}
--

This somehow overwrites the string concatenated in tmp/gs with some pointer.

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