public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60708] New: An array temporary causes an ICE in gimplify
@ 2014-03-30 13:29 ville.voutilainen at gmail dot com
  2014-03-31  8:24 ` [Bug c++/60708] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-03-30 13:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60708

            Bug ID: 60708
           Summary: An array temporary causes an ICE in gimplify
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ville.voutilainen at gmail dot com

Test:

template <class T, class U> struct mypair {
  mypair(T, U) {}
};

template <class T, class U> auto my_make_pair(T t, U u)
{
  return mypair<T, U>(t, u);
}

template<typename T> struct S {
 mypair<T *, int> get_pair() noexcept { 
   return my_make_pair((T*)nullptr, 0); 
 } 
}; 

static void foo(const mypair<char *, int> (&a)[2]) noexcept { } 

int main()
{ 
  S<char> s; 
  //mypair<char*, int> jones[2]{s.get_pair(), s.get_pair()};
  //foo(jones);
  foo({s.get_pair(), s.get_pair()}); 
}

If the commented lines are present, this compiles fine. I don't know why,
because with the code as written, the following explosion happens:

lhcat2.cpp: In function ‘int main()’:
lhcat2.cpp:24:35: internal compiler error: Segmentation fault
   foo({s.get_pair(), s.get_pair()}); 
                                   ^
0xb50aff crash_signal
    ../../gcc/toplev.c:337
0x9b590d gimplify_target_expr
    ../../gcc/gimplify.c:5255
0x9a2d2c gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
    ../../gcc/gimplify.c:7815
0x9ac27d gimplify_addr_expr
    ../../gcc/gimplify.c:4801
0x9a2935 gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
    ../../gcc/gimplify.c:7494
0x9acdb8 gimplify_call_expr
    ../../gcc/gimplify.c:2375
0x9a24c7 gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
    ../../gcc/gimplify.c:7419
0x9a6e16 gimplify_stmt(tree_node**, gimple_statement_base**)
    ../../gcc/gimplify.c:5341
0x9a2552 gimplify_cleanup_point_expr
    ../../gcc/gimplify.c:5117
0x9a2552 gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
    ../../gcc/gimplify.c:7811
0x9a6e16 gimplify_stmt(tree_node**, gimple_statement_base**)
    ../../gcc/gimplify.c:5341
0x9a2fdb gimplify_statement_list
    ../../gcc/gimplify.c:1412
0x9a2fdb gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
    ../../gcc/gimplify.c:7863
0x9a6e16 gimplify_stmt(tree_node**, gimple_statement_base**)
    ../../gcc/gimplify.c:5341
0x9a7b1f gimplify_bind_expr
    ../../gcc/gimplify.c:1079
0x9a2a0e gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
    ../../gcc/gimplify.c:7645
0x9a6e16 gimplify_stmt(tree_node**, gimple_statement_base**)
    ../../gcc/gimplify.c:5341
0x9a2fdb gimplify_statement_list
    ../../gcc/gimplify.c:1412
0x9a2fdb gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
    ../../gcc/gimplify.c:7863
0x9a6e16 gimplify_stmt(tree_node**, gimple_statement_base**)
    ../../gcc/gimplify.c:5341
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.
>From gcc-bugs-return-447831-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Mar 30 13:31:27 2014
Return-Path: <gcc-bugs-return-447831-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 27036 invoked by alias); 30 Mar 2014 13:31:26 -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 27007 invoked by uid 48); 30 Mar 2014 13:31:23 -0000
From: "frankhb1989 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/60709] New: [C++11]ICE when using a braced-init-list as function argument to initialize a reference to array
Date: Sun, 30 Mar 2014 13:31:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.8.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: frankhb1989 at gmail 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: <bug-60709-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: 2014-03/txt/msg02700.txt.bz2
Content-length: 943

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`709

            Bug ID: 60709
           Summary: [C++11]ICE when using a braced-init-list as function
                    argument to initialize a reference to array
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: frankhb1989 at gmail dot com

Minimal case:

template<class T>
struct X{};

void f(X<int>(&&)[1])
{}
int main()
{
  f({X<int>()});
}

g++ a.cc -std=c++11
a.cc: In function 'int main()':
a.cc:8:15: internal compiler error: Segmentation fault
   f({X<int>()});
               ^
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://sourceforge.net/projects/mingw-w64> for instructions.

Clang++ 3.4 accepted it successfully.


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

* [Bug c++/60708] [4.8/4.9 Regression] An array temporary causes an ICE in gimplify
  2014-03-30 13:29 [Bug c++/60708] New: An array temporary causes an ICE in gimplify ville.voutilainen at gmail dot com
  2014-03-31  8:24 ` [Bug c++/60708] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
@ 2014-03-31  8:24 ` rguenth at gcc dot gnu.org
  2014-03-31  8:27 ` ville.voutilainen at gmail dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-03-31  8:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60708

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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

* [Bug c++/60708] [4.8/4.9 Regression] An array temporary causes an ICE in gimplify
  2014-03-30 13:29 [Bug c++/60708] New: An array temporary causes an ICE in gimplify ville.voutilainen at gmail dot com
@ 2014-03-31  8:24 ` rguenth at gcc dot gnu.org
  2014-03-31  8:24 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-03-31  8:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60708

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
      Known to work|                            |4.7.3
           Keywords|                            |accepts-invalid
   Last reconfirmed|                            |2014-03-31
     Ever confirmed|0                           |1
            Summary|An array temporary causes   |[4.8/4.9 Regression] An
                   |an ICE in gimplify          |array temporary causes an
                   |                            |ICE in gimplify
   Target Milestone|---                         |4.8.3
      Known to fail|                            |4.8.0

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
With 4.7 I get the maybe informative

t.ii:5:55: error: 'my_make_pair' function uses 'auto' type specifier without
trailing return type
t.ii: In instantiation of 'mypair<T*, int> S<T>::get_pair() [with T = char]':
t.ii:23:19:   required from here
t.ii:12:36: error: 'my_make_pair' was not declared in this scope
t.ii:23: confused by earlier errors, bailing out

thus we miss the error in 4.8.x and 4.9 (but ICE the same later).

Marking as accepts-invalid regression.  After that it would be an
error-recovery
ice-on-invalid.


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

* [Bug c++/60708] [4.8/4.9 Regression] An array temporary causes an ICE in gimplify
  2014-03-30 13:29 [Bug c++/60708] New: An array temporary causes an ICE in gimplify ville.voutilainen at gmail dot com
  2014-03-31  8:24 ` [Bug c++/60708] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
  2014-03-31  8:24 ` rguenth at gcc dot gnu.org
@ 2014-03-31  8:27 ` ville.voutilainen at gmail dot com
  2014-03-31 12:54 ` ville.voutilainen at gmail dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-03-31  8:27 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60708

--- Comment #2 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
Well, no - the error that 4.7 gives is caused by my using a C++14 deduced
return type for a function there. 4.9 supports those with --std=c++1y.


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

* [Bug c++/60708] [4.8/4.9 Regression] An array temporary causes an ICE in gimplify
  2014-03-30 13:29 [Bug c++/60708] New: An array temporary causes an ICE in gimplify ville.voutilainen at gmail dot com
                   ` (2 preceding siblings ...)
  2014-03-31  8:27 ` ville.voutilainen at gmail dot com
@ 2014-03-31 12:54 ` ville.voutilainen at gmail dot com
  2014-04-01 18:10 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-03-31 12:54 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60708

--- Comment #3 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
So, to clarify, this is not accepts-invalid, nor is it a 4.7->4.9 regression
with regards to whether the function should be accepted. If I change the test
to
be purely C++11, it ICEs on 4.7 and 4.8 as well.

template <class T, class U> struct mypair {
  mypair(T, U) {}
};

template <class T, class U> auto my_make_pair(T t, U u) -> mypair<T, U>
{
  return mypair<T, U>(t, u);
}

template<typename T> struct S {
 mypair<T *, int> get_pair() noexcept { 
   return my_make_pair((T*)nullptr, 0); 
 } 
}; 

static void foo(const mypair<char *, int> (&a)[2]) noexcept { } 

int main()
{ 
  S<char> s; 
  //mypair<char*, int> jones[2]{s.get_pair(), s.get_pair()};
  //foo(jones);
  foo({s.get_pair(), s.get_pair()}); 
}


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

* [Bug c++/60708] [4.8/4.9 Regression] An array temporary causes an ICE in gimplify
  2014-03-30 13:29 [Bug c++/60708] New: An array temporary causes an ICE in gimplify ville.voutilainen at gmail dot com
                   ` (3 preceding siblings ...)
  2014-03-31 12:54 ` ville.voutilainen at gmail dot com
@ 2014-04-01 18:10 ` jason at gcc dot gnu.org
  2014-04-01 19:14 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2014-04-01 18:10 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60708

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |jason at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org


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

* [Bug c++/60708] [4.8/4.9 Regression] An array temporary causes an ICE in gimplify
  2014-03-30 13:29 [Bug c++/60708] New: An array temporary causes an ICE in gimplify ville.voutilainen at gmail dot com
                   ` (4 preceding siblings ...)
  2014-04-01 18:10 ` jason at gcc dot gnu.org
@ 2014-04-01 19:14 ` jason at gcc dot gnu.org
  2014-04-01 19:17 ` [Bug c++/60708] [4.8 " jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2014-04-01 19:14 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60708

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Tue Apr  1 19:14:00 2014
New Revision: 208996

URL: http://gcc.gnu.org/viewcvs?rev=208996&root=gcc&view=rev
Log:
    PR c++/60708
    * call.c (build_array_conv): Call complete_type.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/initlist82.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c


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

* [Bug c++/60708] [4.8 Regression] An array temporary causes an ICE in gimplify
  2014-03-30 13:29 [Bug c++/60708] New: An array temporary causes an ICE in gimplify ville.voutilainen at gmail dot com
                   ` (5 preceding siblings ...)
  2014-04-01 19:14 ` jason at gcc dot gnu.org
@ 2014-04-01 19:17 ` jason at gcc dot gnu.org
  2014-05-13 16:05 ` jason at gcc dot gnu.org
  2014-05-13 16:07 ` jason at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2014-04-01 19:17 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60708

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |4.9.0
            Summary|[4.8/4.9 Regression] An     |[4.8 Regression] An array
                   |array temporary causes an   |temporary causes an ICE in
                   |ICE in gimplify             |gimplify

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed in 4.9 so far.


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

* [Bug c++/60708] [4.8 Regression] An array temporary causes an ICE in gimplify
  2014-03-30 13:29 [Bug c++/60708] New: An array temporary causes an ICE in gimplify ville.voutilainen at gmail dot com
                   ` (6 preceding siblings ...)
  2014-04-01 19:17 ` [Bug c++/60708] [4.8 " jason at gcc dot gnu.org
@ 2014-05-13 16:05 ` jason at gcc dot gnu.org
  2014-05-13 16:07 ` jason at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2014-05-13 16:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Tue May 13 16:05:19 2014
New Revision: 210384

URL: http://gcc.gnu.org/viewcvs?rev=210384&root=gcc&view=rev
Log:
    PR c++/60708
    * call.c (build_array_conv): Call complete_type.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/g++.dg/cpp0x/initlist82.C
Modified:
    branches/gcc-4_8-branch/gcc/cp/ChangeLog
    branches/gcc-4_8-branch/gcc/cp/call.c


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

* [Bug c++/60708] [4.8 Regression] An array temporary causes an ICE in gimplify
  2014-03-30 13:29 [Bug c++/60708] New: An array temporary causes an ICE in gimplify ville.voutilainen at gmail dot com
                   ` (7 preceding siblings ...)
  2014-05-13 16:05 ` jason at gcc dot gnu.org
@ 2014-05-13 16:07 ` jason at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2014-05-13 16:07 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 4.8.3.


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

end of thread, other threads:[~2014-05-13 16:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-30 13:29 [Bug c++/60708] New: An array temporary causes an ICE in gimplify ville.voutilainen at gmail dot com
2014-03-31  8:24 ` [Bug c++/60708] [4.8/4.9 Regression] " rguenth at gcc dot gnu.org
2014-03-31  8:24 ` rguenth at gcc dot gnu.org
2014-03-31  8:27 ` ville.voutilainen at gmail dot com
2014-03-31 12:54 ` ville.voutilainen at gmail dot com
2014-04-01 18:10 ` jason at gcc dot gnu.org
2014-04-01 19:14 ` jason at gcc dot gnu.org
2014-04-01 19:17 ` [Bug c++/60708] [4.8 " jason at gcc dot gnu.org
2014-05-13 16:05 ` jason at gcc dot gnu.org
2014-05-13 16:07 ` jason 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).