public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "su at cs dot ucdavis.edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/67619] New: ICE at -O1 and above on x86_64-linux-gnu in int_mode_for_mode, at stor-layout.c:425
Date: Fri, 18 Sep 2015 07:16:00 -0000	[thread overview]
Message-ID: <bug-67619-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67619

            Bug ID: 67619
           Summary: ICE at -O1 and above on x86_64-linux-gnu in
                    int_mode_for_mode, at stor-layout.c:425
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

The following code causes an ICE when compiled with the current gcc trunk at
-O1 and above on x86_64-linux-gnu in both 32-bit and 64-bit modes.

It also affects 4.6.x through 5.2.x: 
(1) hang: 4.6.x and 4.7.x 
(2) ICE: 4.8.x to 5.2.x 


$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 6.0.0 20150917 (experimental) [trunk revision 227862] (GCC) 
$ 
$ gcc-trunk -O0 -c small.c
$ 
$ gcc-trunk -O1 -c small.c
small.c: In function ‘foo’:
small.c:9:3: internal compiler error: in int_mode_for_mode, at
stor-layout.c:425
   __builtin_eh_return (l, p);
   ^
0xa9f22b int_mode_for_mode(machine_mode)
        ../../gcc-trunk/gcc/stor-layout.c:425
0x7ec67e emit_move_via_integer
        ../../gcc-trunk/gcc/expr.c:3143
0x7f8d9a emit_move_insn_1(rtx_def*, rtx_def*)
        ../../gcc-trunk/gcc/expr.c:3524
0x7f90d4 emit_move_insn(rtx_def*, rtx_def*)
        ../../gcc-trunk/gcc/expr.c:3592
0x7dcae2 copy_to_reg(rtx_def*)
        ../../gcc-trunk/gcc/explow.c:578
0x7d558f expand_builtin_eh_return(tree_node*, tree_node*)
        ../../gcc-trunk/gcc/except.c:2222
0x6d48f4 expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int)
        ../../gcc-trunk/gcc/builtins.c:6450
0x7f46d2 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ../../gcc-trunk/gcc/expr.c:10473
0x6f54a3 expand_expr
        ../../gcc-trunk/gcc/expr.h:255
0x6f54a3 expand_call_stmt
        ../../gcc-trunk/gcc/cfgexpand.c:2647
0x6f54a3 expand_gimple_stmt_1
        ../../gcc-trunk/gcc/cfgexpand.c:3534
0x6f54a3 expand_gimple_stmt
        ../../gcc-trunk/gcc/cfgexpand.c:3697
0x6f6b9a expand_gimple_basic_block
        ../../gcc-trunk/gcc/cfgexpand.c:5700
0x6fda46 execute
        ../../gcc-trunk/gcc/cfgexpand.c:6286
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.
$ 


--------------------------------


void
foo ()
{
  unsigned long l;
  void *p = 0; 

  __builtin_unwind_init ();
  l = 0; 
  __builtin_eh_return (l, p);
}
>From gcc-bugs-return-497483-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Sep 18 07:27:30 2015
Return-Path: <gcc-bugs-return-497483-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 37402 invoked by alias); 18 Sep 2015 07:27:29 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 37383 invoked by uid 48); 18 Sep 2015 07:27:24 -0000
From: "cctsai57 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/67620] New: _GLIBCXX_USE_CXX11_ABI=1 fails to catch ios_base::failure
Date: Fri, 18 Sep 2015 07:27:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: 6.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: cctsai57 at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
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 target_milestone
Message-ID: <bug-67620-4@http.gcc.gnu.org/bugzilla/>
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: 2015-09/txt/msg01461.txt.bz2
Content-length: 1518

https://gcc.gnu.org/bugzilla/show_bug.cgi?idg620

            Bug ID: 67620
           Summary: _GLIBCXX_USE_CXX11_ABI=1 fails to catch
                    ios_base::failure
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cctsai57 at gmail dot com
  Target Milestone: ---

#include <iostream>
#include <fstream>
#include <typeinfo>
using namespace std;

int main()
{
    ifstream f;
    f.exceptions(ifstream::failbit);

    try {
      f.open("file_does_not_exit");// throw ios_base::failure
    }
    catch (const ios_base::failure &iof)
    {
        // g++ -std=gnu++11 -D_GLIBCXX_USE_CXX11_ABI=0
        cout << "typeid(iof) : " << typeid(iof).name() << '\n';
    }
    catch (const exception &ex)
    {
        // g++ -std=gnu++11 -D_GLIBCXX_USE_CXX11_ABI=1. Bug? Why?
        cout << "typeid(ex)  : " << typeid(ex).name() << '\n';
    }
}

$ g++ -std=gnu++11 -D_GLIBCXX_USE_CXX11_ABI=0 a.cpp -static && ./a.out
typeid(iof) : NSt8ios_base7failureE
$ g++ -std=gnu++11 -D_GLIBCXX_USE_CXX11_ABI=1 a.cpp -static && ./a.out
typeid(ex)  : NSt8ios_base7failureE

Description:
Let `f.open()' throw `ios_base::failure'.  If compiled with
-D_GLIBCXX_USE_CXX11_ABI=1, the above code fails to catch `ios_base::failure',
but `exception' insead.

gcc version:
gcc version 5.2.1 20150917 (GCC)
gcc version 6.0.0 20150917 (experimental) (GCC)


             reply	other threads:[~2015-09-18  7:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-18  7:16 su at cs dot ucdavis.edu [this message]
2015-09-18  8:35 ` [Bug rtl-optimization/67619] " ubizjak at gmail dot com
2015-09-21 15:24 ` [Bug middle-end/67619] " uros at gcc dot gnu.org
2015-09-21 19:09 ` uros at gcc dot gnu.org
2015-09-21 19:19 ` ubizjak at gmail dot com
2021-08-08 16:50 ` pinskia 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-67619-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).