Dear,

compiling the attached example fails with this error message:

*** buffer overflow detected ***: terminated
/tmp/ccyb3JRr.s: Assembler messages:
/tmp/ccyb3JRr.s: Internal error (Aborted).
Please report this bug.


Environment:

$ uname -a
Linux gygv 6.10.10-200.fc40.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Sep 12
18:26:09 UTC 2024 x86_64 GNU/Linux

$ gcc --version
gcc (GCC) 14.2.1 20240912 (Red Hat 14.2.1-3)
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

$ as --version
GNU assembler version 2.41-37.fc40
Copyright (C) 2023 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms
of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `x86_64-redhat-linux'.



The command line is this:

gcc -c -O1 -ggdb -masm=intel -Wa,-acdhlgn=gfp_library.lst -Wa,--
listing-lhs-width=4,--listing-rhs-width=132 -o gfp_library.o
gfp_library.c


There are a number of ways to get it compiled: -O0 instead of -O1,  or
omitting  ,--listing-rhs-width=132,  or omittig -ggdb,  or eliminating
the get_realloc() function and replacing its call with its return
expression in the caller.

But the problem is that such solutions don't always work: the original
gfp_library.c is more complex and the simple solution of using -O0
didn't help.

br
PK



#include <dlfcn.h>

#define LIBC             "/usr/lib64/libc.so.6"

typedef void *realloc_ft(void *, size_t);

static void       *libc_so;
static realloc_ft *libc_realloc;


static realloc_ft *get_realloc( void )
{
  return (realloc_ft *)dlsym(libc_so, "realloc");
}


int gfp_lib_init( void )
{
  if ((libc_so = dlopen(LIBC, RTLD_LAZY)) == 0 ||
      (libc_realloc = get_realloc()) == 0)
    return 1;
  else
    return 0;
}

Reply via email to