From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26649 invoked by alias); 7 Feb 2014 21:25:39 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 26630 invoked by uid 48); 7 Feb 2014 21:25:34 -0000 From: "lsebald1 at umbc dot edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/60111] New: [SH] ICE compiling Newlib (4.8.2) Date: Fri, 07 Feb 2014 21:25:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: lsebald1 at umbc dot edu X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-02/txt/msg00755.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D60111 Bug ID: 60111 Summary: [SH] ICE compiling Newlib (4.8.2) Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: lsebald1 at umbc dot edu Created attachment 32081 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=3D32081&action=3Dedit Preprocessed source file exhibiting the ICE. When building a cross-compiler from armv6l-unknown-linux-gnueabihf (A Raspb= erry Pi running Raspbian) to sh-elf, I'm running into an internal compiler error when compiling part of Newlib. Here is the backtrace that is generated: sh-elf-gcc -B/mnt/usbhdd1/toolchain/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-el= f/m4-nofpu/newlib/ -isystem /mnt/usbhdd1/toolchain/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-elf/= m4-nofpu/newlib/targ-include -isystem /mnt/usbhdd1/toolchain/kos/utils/dc-chain/newlib-2.0.0/newlib/libc/include -B/mnt/usbhdd1/toolchain/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-el= f/m4-nofpu/libgloss/sh -L/mnt/usbhdd1/toolchain/kos/utils/dc-chain/build-newlib-sh-elf-2.0.0/sh-el= f/m4-nofpu/libgloss/libnosys -L/mnt/usbhdd1/toolchain/kos/utils/dc-chain/newlib-2.0.0/libgloss/sh -m4-n= ofpu -DPACKAGE_NAME=3D\"newlib\" -DPACKAGE_TARNAME=3D\"newlib\" -DPACKAGE_VERSION=3D\"2.0.0\" -DPACKAGE_STRING=3D\"newlib\ 2.0.0\" -DPACKAGE_BUGREPORT=3D\"\" -DPACKAGE_URL=3D\"\" -I. -I../../../../../../newlib-2.0.0/newlib/libc/stdlib -DREENTRANT_SYSCALLS_PROVIDED -DMALLOC_PROVIDED -DABORT_PROVIDED -DHAVE_FCN= TL -ffunction-sections -fdata-sections -fno-builtin -g -O2 -m4-nofpu -c = -o lib_a-lrand48.o `test -f 'lrand48.c' || echo '../../../../../../newlib-2.0.0/newlib/libc/stdlib/'`lrand48.c ../../../../../../newlib-2.0.0/newlib/libc/stdlib/lrand48.c: In function =E2=80=98_lrand48_r=E2=80=99: ../../../../../../newlib-2.0.0/newlib/libc/stdlib/lrand48.c:24:1: internal compiler error: in gen_ashift, at config/sh/sh.c:3746 } ^ 0x5a33db gen_ashift ../../gcc-4.8.2/gcc/config/sh/sh.c:3746 0x5a358f gen_shifty_hi_op(int, rtx_def**) ../../gcc-4.8.2/gcc/config/sh/sh.c:3874 0x5a87ff gen_shl_and(rtx_def*, rtx_def*, rtx_def*, rtx_def*) ../../gcc-4.8.2/gcc/config/sh/sh.c:4185 0x5f105f gen_split_912(rtx_def*, rtx_def**) ../../gcc-4.8.2/gcc/config/sh/sh.md:5173 0x222a6f try_split(rtx_def*, rtx_def*, int) ../../gcc-4.8.2/gcc/emit-rtl.c:3562 0x382b47 split_insn ../../gcc-4.8.2/gcc/recog.c:2836 0x38709f split_all_insns() ../../gcc-4.8.2/gcc/recog.c:2926 0x38715b rest_of_handle_split_after_reload ../../gcc-4.8.2/gcc/recog.c:3832 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See for instructions. I have tried with both GCC versions available on the host OS' package manag= er (Debian 4.6.3-14+rpi1, and Debian 4.7.2-5+rpi1) and have the same ICE with = both of them. This may actually be a host-related bug, rather than a target-rela= ted bug, as the ICE does not occur when building a cross-compiler on Darwin on x86-64. Preprocessed source code of the file exhibiting the ICE is attached. >>From gcc-bugs-return-442999-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Feb 07 21:35:24 2014 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 3822 invoked by alias); 7 Feb 2014 21:35:24 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 3782 invoked by uid 48); 7 Feb 2014 21:35:20 -0000 From: "david.abdurachmanov at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/60112] New: bogus error: array subscript is above array bounds Date: Fri, 07 Feb 2014 21:35:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: minor X-Bugzilla-Who: david.abdurachmanov at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-02/txt/msg00756.txt.bz2 Content-length: 2731 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60112 Bug ID: 60112 Summary: bogus error: array subscript is above array bounds Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: david.abdurachmanov at gmail dot com GCC pre-4.9.0 (r206686), no issues on 4.6.2, 4.7.2, and 4.8.1. I found that if I mark `get_size' as inline or constexpr errors are gone. If I keep `nFaces' uninitialized it also complains, but if I set it explicitly to some number (e.g., 0,..,) it's fine. Even commenting out such line (49) as lp += VV(tanDistToFace[iFDest]); removes the errors. I tried removing more mass from the test case, but it also removes the errors. Doesn't work with -O2, but works fine with -O0, -O1, -O3, -Os, and -Og. ### COMPILE ### c++ -c -O2 -std=c++11 -Werror=array-bounds -fdiagnostics-show-option -fPIC test2.cpp ### ERRORS ### test2.cpp: In function 'void abc()': test2.cpp:43:37: error: array subscript is above array bounds [-Werror=array-bounds] iFDestSorted[nDestSorted - i - 1] = iFDestSorted[iMax]; ^ test2.cpp:44:22: error: array subscript is above array bounds [-Werror=array-bounds] iFDestSorted[iMax] = iTmp; ^ cc1plus: some warnings being treated as errors ### TEST CASE ### struct GP { double mx, my, mz; GP (double x, double y, double z) : mx(x), my(y), mz(z) { }; }; typedef struct GP GP; void do_something(const GP& n) { } struct VV { double mx; VV (double x) : mx(x) { }; }; typedef struct VV VV; struct PP { double mx; PP (double x) : mx(x) { }; double x() { return mx; }; PP& operator+=(const VV& rhs) { mx += rhs.mx; return *this; }; }; typedef struct PP PP; int get_size() { return 0; }; void abc() { double tanDistToFace[6] = {0,0,0,0,0,0}; unsigned int iFDestSorted[6] = {0,0,0,0,0,0}; unsigned int nDestSorted = 0; unsigned int nFaces = get_size(); for (unsigned int iFace = 0; iFace < nFaces; ++iFace) { nDestSorted++; } for (unsigned int i = 0; i < nDestSorted; ++i) { unsigned int iMax = nDestSorted - i - 1; for (unsigned int j=0; j < nDestSorted-i; ++j) { if (tanDistToFace[iFDestSorted[j]] > tanDistToFace[iFDestSorted[iMax]]) { iMax = j; } } unsigned int iTmp = iFDestSorted[nDestSorted - i - 1]; iFDestSorted[nDestSorted - i - 1] = iFDestSorted[iMax]; iFDestSorted[iMax] = iTmp; } int iFDest = iFDestSorted[0]; PP lp(0); lp += VV(tanDistToFace[iFDest]); GP gp(lp.x(), lp.x(), lp.x()); do_something(gp); }