public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "terry.guo at arm dot com" <gcc-bugzilla@gcc.gnu.org>
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	[thread overview]
Message-ID: <bug-61544-4@http.gcc.gnu.org/bugzilla/> (raw)

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.


             reply	other threads:[~2014-06-18  4:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-18  4:32 terry.guo at arm dot com [this message]
2014-06-18 10:11 ` [Bug target/61544] " xguo at gcc dot gnu.org
2014-06-18 10:13 ` terry.guo at arm dot com
2014-07-04 12:46 ` amker at gcc dot gnu.org
2014-07-09  5:28 ` zqchen at gcc dot gnu.org
2014-07-29 10:50 ` rearnsha at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-61544-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).