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 rtl-optimization/78374] New: Segfault in cc1 (arm-eabi) on -O1 (or better)


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

            Bug ID: 78374
           Summary: Segfault in cc1 (arm-eabi) on -O1 (or better)
           Product: gcc
           Version: 5.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: meisenmann.lba@fh-salzburg.ac.at
  Target Milestone: ---

Hi!

I'm trying to build an arm-eabi Cross-Compiler (GCC 5.4.0, binutils 2.25.1 and
newlib 2.3) and after the successful build of the bootstrap-GCC, which will
compile the newlib-source, I've got a segfault in cc1 on compiling
argz_delete.c:

....
x:\gcc5\v5.4.0\arm-eabi\sys-include\argz.h: In function 'argz_delete':
x:\gcc5\v5.4.0\arm-eabi\sys-include\argz.h:26:9: internal compiler error:
Segmentation fault
 error_t argz_delete (char **argz, size_t *argz_len, char *entry);
         ^
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
x:\gcc5\v5.4.0\arm-eabi\sys-include\argz.h:26:9: internal compiler error:
Aborted

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
arm-eabi-gcc: internal compiler error: Aborted (program cc1)
...


After some simple tests, I have determined that the segfault occurs if the
optimization-level is O1 or better (I.e., no segfault on O0 and Og).

Additional information:
a) GCC-configuration (arm-eabi-gcc -v)
Using built-in specs.
COLLECT_GCC=\GCC5\V5.4.0\bin\arm-eabi-gcc
COLLECT_LTO_WRAPPER=x:/gcc5/v5.4.0/bin/../libexec/gcc/arm-eabi/5.4.0/lto-wrapper.exe
Target: arm-eabi
Configured with: ../../src/gcc-5.4.0/configure --prefix=/x/GCC5/V5.4.0
--build=i686-w64-mingw32 --target=arm-eabi --disable-nls --disable-shared
--disable-multilib --disable-threads --enable-languages=c,c++ --with-gnu-as
--with-gnu-ld --disable-win32-registry --with-arch=armv7-a --with-abi=apcs-gnu
--with-float=softfp --with-fpu=vfpv3 --disable-tls --with-stabs
--disable-__cxa_atexit --disable-decimal-float --disable-libgomp
--disable-libquadmath --disable-libstdcxx-verbose --with-newlib
--with-headers=../../src/newlib-2.3.0/newlib/libc/include
--with-gxx-include-dir=/x/GCC5/V5.4.0/include/c++/5.4.0
--disable-libstdcxx-visibility --enable-fully-dynamic-string
--with-gmp=C:/msys32/mingw32 --with-mpfr=C:/msys32/mingw32
--with-mpc=C:/msys32/mingw32
Thread model: single
gcc version 5.4.0

b) Minimized C-Code (based on argz_delete.c), which causes also a segfault in
cc1

#include <string.h>
#include <stdlib.h>

int test_func (char **arg, size_t *arg_len, char *entry)
{
  int len = 0;
  /* char *moveto = entry; */

  if (entry)
    {
      /* len = strlen(entry) + 1;
         entry += len;

         memmove(moveto, entry, *arg + *arg_len - entry);
      */

      *arg_len -= len;

      /* *arg = (char *)realloc(*arg, *arg_len); */
      if (*arg == NULL) return -1;
    }
  return 0;
}

Best regards from Austria,
Markus

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