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 target/61544] New: ICE due to thumb1_reorg function mishandles label type insn


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<char>; _Alloc =
std::allocator<char>; std::basic_stringstream<_CharT, _Traits,
_Alloc>::__string_type = std::basic_string<char>]':
/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 <http://gcc.gnu.org/bugs.html> 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.


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