From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32006 invoked by alias); 18 Jun 2014 04:32:29 -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 31967 invoked by uid 48); 18 Jun 2014 04:32:25 -0000 From: "terry.guo at arm dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/61544] New: ICE due to thumb1_reorg function mishandles label type insn Date: Wed, 18 Jun 2014 04:32: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: 4.10.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: terry.guo at arm 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-06/txt/msg01527.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61544 Bug ID: 61544 Summary: ICE due to thumb1_reorg function mishandles label type insn Product: gcc Version: 4.10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: terry.guo at arm dot com When build some c++ files for pure thumb1 target, I ran into below ICE: terguo01@terry-pc01:thumb1-reorg$ /myssd/terguo01/toolchain-build/thumb1-reorg/build-native/gcc-final/./gcc/xgcc -shared-libgcc -B/myssd/terguo01/toolchain-build/thumb1-reorg/build-native/gcc-final/./gcc -nostdinc++ -L/myssd/terguo01/toolchain-build/thumb1-reorg/build-native/gcc-final/arm-none-eabi/libstdc++-v3/src -L/myssd/terguo01/toolchain-build/thumb1-reorg/build-native/gcc-final/arm-none-eabi/libstdc++-v3/src/.libs -L/myssd/terguo01/toolchain-build/thumb1-reorg/build-native/gcc-final/arm-none-eabi/libstdc++-v3/libsupc++/.libs -B/myssd/terguo01/toolchain-build/thumb1-reorg/install-native/arm-none-eabi/bin/ -B/myssd/terguo01/toolchain-build/thumb1-reorg/install-native/arm-none-eabi/lib/ -isystem /myssd/terguo01/toolchain-build/thumb1-reorg/install-native/arm-none-eabi/include -isystem /myssd/terguo01/toolchain-build/thumb1-reorg/install-native/arm-none-eabi/sys-include -I/myssd/terguo01/toolchain-build/thumb1-reorg/src/gcc/libstdc++-v3/../libgcc -I/myssd/terguo01/toolchain-build/thumb1-reorg/build-native/gcc-final/arm-none-eabi/libstdc++-v3/include/arm-none-eabi -I/myssd/terguo01/toolchain-build/thumb1-reorg/build-native/gcc-final/arm-none-eabi/libstdc++-v3/include -I/myssd/terguo01/toolchain-build/thumb1-reorg/src/gcc/libstdc++-v3/libsupc++ -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -frandom-seed=sstream-inst.lo -g -O2 -c /myssd/terguo01/toolchain-build/thumb1-reorg/src/gcc/libstdc++-v3/src/c++98/sstream-inst.cc -o sstream-inst.o In file included from /myssd/terguo01/toolchain-build/thumb1-reorg/src/gcc/libstdc++-v3/src/c++98/sstream-inst.cc:29:0: /myssd/terguo01/toolchain-build/thumb1-reorg/build-native/gcc-final/arm-none-eabi/libstdc++-v3/include/sstream: In member function 'std::basic_stringstream<_CharT, _Traits, _Alloc>::__string_type std::basic_stringstream<_CharT, _Traits, _Alloc>::str() const [with _CharT = char; _Traits = std::char_traits; _Alloc = std::allocator; std::basic_stringstream<_CharT, _Traits, _Alloc>::__string_type = std::basic_string]': /myssd/terguo01/toolchain-build/thumb1-reorg/build-native/gcc-final/arm-none-eabi/libstdc++-v3/include/sstream:584:36: internal compiler error: Segmentation fault { return _M_stringbuf.str(); } ^ 0xd90226 crash_signal /myssd/terguo01/toolchain-build/thumb1-reorg/src/gcc/gcc/toplev.c:337 0x10e1219 thumb1_reorg /myssd/terguo01/toolchain-build/thumb1-reorg/src/gcc/gcc/config/arm/arm.c:16954 0x10e1cbe arm_reorg /myssd/terguo01/toolchain-build/thumb1-reorg/src/gcc/gcc/config/arm/arm.c:17223 0xd1451c execute /myssd/terguo01/toolchain-build/thumb1-reorg/src/gcc/gcc/reorg.c:3959 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See for instructions. Such ICE is triggered when apply thumb1_reorg function to below basic block: (gdb) p debug_bb(bb) (code_label/s 477 953 480 736 "" [1 uses]) (note 480 477 954 [bb 19] NOTE_INSN_BASIC_BLOCK) (note 954 480 955 (var_location this (plus:SI (reg/f:SI 103 afp) (const_int -20 [0xffffffffffffffec]))) NOTE_INSN_VAR_LOCATION) (note 955 954 956 (var_location this (plus:SI (reg/f:SI 103 afp) (const_int -20 [0xffffffffffffffec]))) NOTE_INSN_VAR_LOCATION) For the code_label insn 477, its INSN_CODE accidentally equals the value of CODE_FOR_cbranchsi4_insn. This leads to the execution of subsequent gcc code: 16953 pat = PATTERN (insn); 16954 op0 = XEXP (XEXP (SET_SRC (pat), 0), 0); Then the ICE is triggered due to applying SET_SRC to a code_label insn. >>From the very beginning, we shouldn't use INSN_CODE to insn like code_label. Thus when the head of basic block isn't a proper insn, we should move to next basic block. Patch at https://gcc.gnu.org/ml/gcc-patches/2014-06/msg00809.html can fix this ICE.