public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64931] New: ICE on function with deduced return type and input is instantiated template class
@ 2015-02-04  2:10 sneves at dei dot uc.pt
  2015-03-04 11:15 ` [Bug c++/64931] " redi at gcc dot gnu.org
  2015-03-23 14:02 ` mpolacek at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: sneves at dei dot uc.pt @ 2015-02-04  2:10 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 64931
           Summary: ICE on function with deduced return type and input is
                    instantiated template class
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sneves at dei dot uc.pt

Minimal example:

template<typename T, unsigned long N>
struct array {
  T data[N];
};

auto copy(array<int, 32> const& x) {
  return x;
}

This only seems to result in ICE if a) `copy` has deduced return type with
value semantics, i.e. `auto` but not `decltype(auto)`, and b) if the `array`
struct is a template, and `copy` takes in a specific instantiation of `array`.
Verified to ICE in GCC 4.8.2, 4.9.2, and 5.0.0 20150202.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/64931] ICE on function with deduced return type and input is instantiated template class
  2015-02-04  2:10 [Bug c++/64931] New: ICE on function with deduced return type and input is instantiated template class sneves at dei dot uc.pt
@ 2015-03-04 11:15 ` redi at gcc dot gnu.org
  2015-03-23 14:02 ` mpolacek at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2015-03-04 11:15 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-03-04
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
f.cc: In function ‘auto copy(const array<int, 32ul>&)’:
f.cc:7:10: internal compiler error: Segmentation fault
   return x;
          ^
0xca615f crash_signal
        /home/jwakely/src/gcc/gcc/gcc/toplev.c:383
0xabb836 gimplify_return_expr
        /home/jwakely/src/gcc/gcc/gcc/gimplify.c:1280
0xaa8510 gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
        /home/jwakely/src/gcc/gcc/gcc/gimplify.c:8144
0xaabdb6 gimplify_stmt(tree_node**, gimple_statement_base**)
        /home/jwakely/src/gcc/gcc/gcc/gimplify.c:5514
0xaa7750 gimplify_cleanup_point_expr
        /home/jwakely/src/gcc/gcc/gcc/gimplify.c:5290
0xaa7750 gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
        /home/jwakely/src/gcc/gcc/gcc/gimplify.c:8260
0xaabdb6 gimplify_stmt(tree_node**, gimple_statement_base**)
        /home/jwakely/src/gcc/gcc/gcc/gimplify.c:5514
0xaad72d gimplify_body(tree_node*, bool)
        /home/jwakely/src/gcc/gcc/gcc/gimplify.c:9048
0xaadd86 gimplify_function_tree(tree_node*)
        /home/jwakely/src/gcc/gcc/gcc/gimplify.c:9202
0x8ed6d7 cgraph_node::analyze()
        /home/jwakely/src/gcc/gcc/gcc/cgraphunit.c:633
0x8f0406 analyze_functions
        /home/jwakely/src/gcc/gcc/gcc/cgraphunit.c:1023
0x8f0b75 symbol_table::finalize_compilation_unit()
        /home/jwakely/src/gcc/gcc/gcc/cgraphunit.c:2435
0x6bcde0 cp_write_global_declarations()
        /home/jwakely/src/gcc/gcc/gcc/cp/decl2.c:4754
>From gcc-bugs-return-479313-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Mar 04 11:16:18 2015
Return-Path: <gcc-bugs-return-479313-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 47883 invoked by alias); 4 Mar 2015 11:16:18 -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 46383 invoked by uid 48); 4 Mar 2015 11:16:14 -0000
From: "albert.astals at canonical dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/65309] [Regression] Executes wrong function inside an anonymous namespace on runtime
Date: Wed, 04 Mar 2015 11:16:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: albert.astals at canonical 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:
Message-ID: <bug-65309-4-V4LSD7oM0A@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65309-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65309-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-03/txt/msg00457.txt.bz2
Content-length: 528

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

--- Comment #3 from Albert Astals Cid <albert.astals at canonical dot com> ---
I guess i'm using the system default one, that would be

$ `which ld` -V
GNU ld (GNU Binutils for Ubuntu) 2.25
  Supported emulations:
   elf_x86_64
   elf32_x86_64
   elf_i386
   i386linux
   elf_l1om
   elf_k1om
   i386pep
   i386pe

I'm not the only one with this problem, doesn't seem to be Ubuntu specific
either, see
http://lists.qt-project.org/pipermail/development/2015-March/020632.html


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/64931] ICE on function with deduced return type and input is instantiated template class
  2015-02-04  2:10 [Bug c++/64931] New: ICE on function with deduced return type and input is instantiated template class sneves at dei dot uc.pt
  2015-03-04 11:15 ` [Bug c++/64931] " redi at gcc dot gnu.org
@ 2015-03-23 14:02 ` mpolacek at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-03-23 14:02 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Slightly more reduced:

template<typename T>
struct S {
  T data[32];
};

auto
foo (S<int> & x)
{
  return x;
}

The problem is that we create a RESULT_DECL with NULL DECL_SIZE, and gimplifier
ICEs on that.  The RESULT_DECL is created in convert_for_initialization called
from check_return_expr I think.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-23 13:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-04  2:10 [Bug c++/64931] New: ICE on function with deduced return type and input is instantiated template class sneves at dei dot uc.pt
2015-03-04 11:15 ` [Bug c++/64931] " redi at gcc dot gnu.org
2015-03-23 14:02 ` mpolacek at gcc dot gnu.org

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).