http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57872

            Bug ID: 57872
           Summary: ICE occurs for cross-compile of PPC target with e500v2
                    core
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: super.lzh at gmail dot com

Created attachment 30488
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30488&action=edit
Preprocessed file

[Issue]
When I use gcc-4.8.1 to cross-compile below C program for PPC target with
e500v2 core, following ICE appears, same C file can be compiled correctly for
targets with e500mc/e5500/x86 core. 
$ powerpc-poky-linux-gnuspe-gcc -m32 -mcpu=8548 -mabi=spe -mspe
-mfloat-gprs=double -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed
--sysroot=/local/home/b19537/workspace/poky-os/p1022ds/tmp/sysroots/p1022ds -O2
-pipe -g -feliminate-unused-debug-types -g -O2 -fno-strict-aliasing -pipe -Wall
 -I../../../../../include -I../../../../../include -Wl,-O1 -Wl,--hash-style=gnu
-Wl,--as-needed  -L../../../../../lib  my_test.c   -lm -o my_test
my_test.c: In function 'create_Result_file':
my_test.c:43:1: internal compiler error: in change_address_1, at
emit-rtl.c:2019
 }
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
$

More observation: during my trial, when the array size is equal to 4096 or
smaller than 4096, compile can pass, otherwise build will fail. 

[Source file]
#include <float.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <limits.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/signal.h>
#include <math.h>

#define M_PIl   3.1415926535897932384626433832795029L

int create_Result_file()
{
    int i, nbVal;
    double tabR[20000], Inc;
    char *F_name;
    int fp;

    F_name = "result_file";
    nbVal = 20000;

    Inc = (2 * M_PIl) / nbVal;

    for (i = 0; i < nbVal; i++) {
        tabR[i] = hypot(cos(Inc * i), sin(Inc * i));
    }
    fp = open(F_name, O_RDWR | O_CREAT | O_TRUNC, 0777);
    if (!fp) {
        printf("error opening file");
        close(fp);
        return -1;
    } else {
        for (i = 0; i < nbVal; i++) {
            write(fp, &tabR[i], sizeof(double));
        }

        close(fp);
        return 0;
    } 
}

int main(int argc, char *argv[])
{
    create_Result_file();
    return 0;
}

[Preprocessed file]
Attached my_test.i

[gcc version]
$ powerpc-poky-linux-gnuspe-gcc -v
Using built-in specs.
COLLECT_GCC=powerpc-poky-linux-gnuspe-gcc
COLLECT_LTO_WRAPPER=/local/home/b19537/workspace/poky-os/p1022ds/tmp/sysroots/x86_64-linux/usr/libexec/ppce500v2-poky-linux-gnuspe/gcc/powerpc-poky-linux-gnuspe/4.8.1/lto-wrapper
Target: powerpc-poky-linux-gnuspe
Configured with:
/local/home/b19537/workspace/poky-os/p1022ds/tmp/work-shared/gcc-4.8.1-r0/gcc-4.8.1/configure
--build=x86_64-linux --host=x86_64-linux --target=powerpc-poky-linux-gnuspe
--prefix=/local/home/b19537/workspace/poky-os/p1022ds/tmp/sysroots/x86_64-linux/usr
--exec_prefix=/local/home/b19537/workspace/poky-os/p1022ds/tmp/sysroots/x86_64-linux/usr
--bindir=/local/home/b19537/workspace/poky-os/p1022ds/tmp/sysroots/x86_64-linux/usr/bin/ppce500v2-poky-linux-gnuspe
--sbindir=/local/home/b19537/workspace/poky-os/p1022ds/tmp/sysroots/x86_64-linux/usr/bin/ppce500v2-poky-linux-gnuspe
--libexecdir=/local/home/b19537/workspace/poky-os/p1022ds/tmp/sysroots/x86_64-linux/usr/libexec/ppce500v2-poky-linux-gnuspe
--datadir=/local/home/b19537/workspace/poky-os/p1022ds/tmp/sysroots/x86_64-linux/usr/share
--sysconfdir=/local/home/b19537/workspace/poky-os/p1022ds/tmp/sysroots/x86_64-linux/etc
--sharedstatedir=/local/home/b19537/workspace/poky-os/p1022ds/tmp/sysroots/x86_64-linux/com
--localstatedir=/local/home/b19537/workspace/poky-os/p1022ds/tmp/sysroots/x86_64-linux/var
--libdir=/local/home/b19537/workspace/poky-os/p1022ds/tmp/sysroots/x86_64-linux/usr/lib/ppce500v2-poky-linux-gnuspe
--includedir=/local/home/b19537/workspace/poky-os/p1022ds/tmp/sysroots/x86_64-linux/usr/include
--oldincludedir=/local/home/b19537/workspace/poky-os/p1022ds/tmp/sysroots/x86_64-linux/usr/include
--infodir=/local/home/b19537/workspace/poky-os/p1022ds/tmp/sysroots/x86_64-linux/usr/share/info
--mandir=/local/home/b19537/workspace/poky-os/p1022ds/tmp/sysroots/x86_64-linux/usr/share/man
--disable-silent-rules --disable-dependency-tracking
--with-libtool-sysroot=/local/home/b19537/workspace/poky-os/p1022ds/tmp/sysroots/x86_64-linux
--with-gnu-ld --enable-shared --enable-languages=c,c++ --enable-threads=posix
--disable-multilib --enable-c99 --enable-long-long --enable-symvers=gnu
--enable-libstdcxx-pch --program-prefix=powerpc-poky-linux-gnuspe-
--without-local-prefix --enable-lto --enable-libssp --disable-bootstrap
--disable-libmudflap --with-system-zlib --with-linker-hash-style=gnu
--enable-linker-build-id --with-ppl=no --with-cloog=no
--enable-checking=release --enable-cheaders=c_global --enable-e500_double
--with-gxx-include-dir=/local/home/b19537/workspace/poky-os/p1022ds/tmp/sysroots/p1022ds/usr/include/c++
--with-sysroot=/local/home/b19537/workspace/poky-os/p1022ds/tmp/sysroots/p1022ds
--with-build-sysroot=/local/home/b19537/workspace/poky-os/p1022ds/tmp/sysroots/p1022ds
--enable-targets=powerpc64 --enable-poison-system-directories
--disable-libunwind-exceptions
--with-mpfr=/local/home/b19537/workspace/poky-os/p1022ds/tmp/sysroots/x86_64-linux/usr
--with-system-zlib --disable-nls --with-long-double-128
Thread model: posix
gcc version 4.8.1 (GCC)

Reply via email to