public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58705] New: [4.7/4.8/4.9 Regression] [c++11] ICE with invalid initializer for _Complex variable
@ 2013-10-12 21:30 reichelt at gcc dot gnu.org
2013-10-12 21:30 ` [Bug c++/58705] " reichelt at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: reichelt at gcc dot gnu.org @ 2013-10-12 21:30 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58705
Bug ID: 58705
Summary: [4.7/4.8/4.9 Regression] [c++11] ICE with invalid
initializer for _Complex variable
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: reichelt at gcc dot gnu.org
The following invalid code snippet (compiled with "-std=c++11") triggers an ICE
since GCC 4.7.0:
===============================
_Complex float f = {{}};
===============================
bug.cc:1:23: internal compiler error: Segmentation fault
_Complex float f = {{}};
^
0xb15dff crash_signal
../../gcc/gcc/toplev.c:335
0x5e6d15 vec<constructor_elt_d, va_gc, vl_embed>::operator[](unsigned int)
../../gcc/gcc/vec.h:827
0x5e6d15 check_narrowing(tree_node*, tree_node*)
../../gcc/gcc/cp/typeck2.c:836
0x55e437 check_initializer
../../gcc/gcc/cp/decl.c:5669
0x570ccc cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
../../gcc/gcc/cp/decl.c:6356
0x65e7e7 cp_parser_init_declarator
../../gcc/gcc/cp/parser.c:16633
0x65ff2f cp_parser_simple_declaration
../../gcc/gcc/cp/parser.c:11047
0x643860 cp_parser_block_declaration
../../gcc/gcc/cp/parser.c:10928
0x66aaae cp_parser_declaration
../../gcc/gcc/cp/parser.c:10825
0x6697ca cp_parser_declaration_seq_opt
../../gcc/gcc/cp/parser.c:10711
0x66b0e6 cp_parser_translation_unit
../../gcc/gcc/cp/parser.c:3989
0x66b0e6 c_parse_file()
../../gcc/gcc/cp/parser.c:30962
0x787f73 c_common_parse_file()
../../gcc/gcc/c-family/c-opts.c:1046
Please submit a full bug report, [etc.]
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/58705] [4.7/4.8/4.9 Regression] [c++11] ICE with invalid initializer for _Complex variable
2013-10-12 21:30 [Bug c++/58705] New: [4.7/4.8/4.9 Regression] [c++11] ICE with invalid initializer for _Complex variable reichelt at gcc dot gnu.org
@ 2013-10-12 21:30 ` reichelt at gcc dot gnu.org
2013-10-14 7:55 ` mpolacek at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: reichelt at gcc dot gnu.org @ 2013-10-12 21:30 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58705
Volker Reichelt <reichelt at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ice-on-invalid-code
Known to work| |4.6.0
Target Milestone|--- |4.7.4
Known to fail| |4.7.0, 4.8.0, 4.9.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/58705] [4.7/4.8/4.9 Regression] [c++11] ICE with invalid initializer for _Complex variable
2013-10-12 21:30 [Bug c++/58705] New: [4.7/4.8/4.9 Regression] [c++11] ICE with invalid initializer for _Complex variable reichelt at gcc dot gnu.org
2013-10-12 21:30 ` [Bug c++/58705] " reichelt at gcc dot gnu.org
@ 2013-10-14 7:55 ` mpolacek at gcc dot gnu.org
2013-10-14 8:49 ` mpolacek at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-10-14 7:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58705
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-10-14
CC| |mpolacek at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/58705] [4.7/4.8/4.9 Regression] [c++11] ICE with invalid initializer for _Complex variable
2013-10-12 21:30 [Bug c++/58705] New: [4.7/4.8/4.9 Regression] [c++11] ICE with invalid initializer for _Complex variable reichelt at gcc dot gnu.org
2013-10-12 21:30 ` [Bug c++/58705] " reichelt at gcc dot gnu.org
2013-10-14 7:55 ` mpolacek at gcc dot gnu.org
@ 2013-10-14 8:49 ` mpolacek at gcc dot gnu.org
2013-10-14 9:03 ` mpolacek at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-10-14 8:49 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58705
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This will ICE even with -std=c++03 -Wnarrowing.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/58705] [4.7/4.8/4.9 Regression] [c++11] ICE with invalid initializer for _Complex variable
2013-10-12 21:30 [Bug c++/58705] New: [4.7/4.8/4.9 Regression] [c++11] ICE with invalid initializer for _Complex variable reichelt at gcc dot gnu.org
` (2 preceding siblings ...)
2013-10-14 8:49 ` mpolacek at gcc dot gnu.org
@ 2013-10-14 9:03 ` mpolacek at gcc dot gnu.org
2013-10-14 9:41 ` mpolacek at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-10-14 9:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58705
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This will fix the ICE, but perhaps we want to give an error instead...
I'll regtest this and post to ML.
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -833,7 +833,8 @@ check_narrowing (tree type, tree init)
&& TREE_CODE (type) == COMPLEX_TYPE)
{
tree elttype = TREE_TYPE (type);
- check_narrowing (elttype, CONSTRUCTOR_ELT (init, 0)->value);
+ if (CONSTRUCTOR_NELTS (init) > 0)
+ check_narrowing (elttype, CONSTRUCTOR_ELT (init, 0)->value);
if (CONSTRUCTOR_NELTS (init) > 1)
check_narrowing (elttype, CONSTRUCTOR_ELT (init, 1)->value);
return;
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/58705] [4.7/4.8/4.9 Regression] [c++11] ICE with invalid initializer for _Complex variable
2013-10-12 21:30 [Bug c++/58705] New: [4.7/4.8/4.9 Regression] [c++11] ICE with invalid initializer for _Complex variable reichelt at gcc dot gnu.org
` (3 preceding siblings ...)
2013-10-14 9:03 ` mpolacek at gcc dot gnu.org
@ 2013-10-14 9:41 ` mpolacek at gcc dot gnu.org
2013-10-17 21:59 ` paolo.carlini at oracle dot com
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-10-14 9:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58705
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #3)
> This will fix the ICE, but perhaps we want to give an error instead...
IMNSHO we want, as C FE does:
58705.C:1:1: error: empty scalar initializer
58705.C:1:1: error: (near initialization for ‘f’)
Will put that in the patch.
>From gcc-bugs-return-431639-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Oct 14 09:49:21 2013
Return-Path: <gcc-bugs-return-431639-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 14519 invoked by alias); 14 Oct 2013 09:49:21 -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 14481 invoked by uid 48); 14 Oct 2013 09:49:18 -0000
From: "paolo.carlini at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/58708] string literal operator templates broken
Date: Mon, 14 Oct 2013 09:49: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.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: paolo.carlini at oracle dot com
X-Bugzilla-Status: NEW
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_status cf_reconfirmed_on everconfirmed
Message-ID: <bug-58708-4-zcMg6qa7wb@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58708-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58708-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: 2013-10/txt/msg00783.txt.bz2
Content-length: 490
http://gcc.gnu.org/bugzilla/show_bug.cgi?idX708
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-10-14
Ever confirmed|0 |1
--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Confirmed.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/58705] [4.7/4.8/4.9 Regression] [c++11] ICE with invalid initializer for _Complex variable
2013-10-12 21:30 [Bug c++/58705] New: [4.7/4.8/4.9 Regression] [c++11] ICE with invalid initializer for _Complex variable reichelt at gcc dot gnu.org
` (4 preceding siblings ...)
2013-10-14 9:41 ` mpolacek at gcc dot gnu.org
@ 2013-10-17 21:59 ` paolo.carlini at oracle dot com
2013-10-24 13:54 ` mpolacek at gcc dot gnu.org
2013-10-24 13:55 ` mpolacek at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-10-17 21:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58705
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC|mpolacek at gcc dot gnu.org |
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Marek is on it and posted a patch.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/58705] [4.7/4.8/4.9 Regression] [c++11] ICE with invalid initializer for _Complex variable
2013-10-12 21:30 [Bug c++/58705] New: [4.7/4.8/4.9 Regression] [c++11] ICE with invalid initializer for _Complex variable reichelt at gcc dot gnu.org
` (5 preceding siblings ...)
2013-10-17 21:59 ` paolo.carlini at oracle dot com
@ 2013-10-24 13:54 ` mpolacek at gcc dot gnu.org
2013-10-24 13:55 ` mpolacek at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-10-24 13:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58705
--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Thu Oct 24 13:54:00 2013
New Revision: 204014
URL: http://gcc.gnu.org/viewcvs?rev=204014&root=gcc&view=rev
Log:
PR c++/58705
cp/
* typeck2.c (check_narrowing): Don't check narrowing when the scalar
initializer is empty.
testsuite/
* g++.dg/parse/pr58705.C: New test.
Added:
trunk/gcc/testsuite/g++.dg/parse/pr58705.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/typeck2.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/58705] [4.7/4.8/4.9 Regression] [c++11] ICE with invalid initializer for _Complex variable
2013-10-12 21:30 [Bug c++/58705] New: [4.7/4.8/4.9 Regression] [c++11] ICE with invalid initializer for _Complex variable reichelt at gcc dot gnu.org
` (6 preceding siblings ...)
2013-10-24 13:54 ` mpolacek at gcc dot gnu.org
@ 2013-10-24 13:55 ` mpolacek at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-10-24 13:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58705
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-10-24 13:55 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-12 21:30 [Bug c++/58705] New: [4.7/4.8/4.9 Regression] [c++11] ICE with invalid initializer for _Complex variable reichelt at gcc dot gnu.org
2013-10-12 21:30 ` [Bug c++/58705] " reichelt at gcc dot gnu.org
2013-10-14 7:55 ` mpolacek at gcc dot gnu.org
2013-10-14 8:49 ` mpolacek at gcc dot gnu.org
2013-10-14 9:03 ` mpolacek at gcc dot gnu.org
2013-10-14 9:41 ` mpolacek at gcc dot gnu.org
2013-10-17 21:59 ` paolo.carlini at oracle dot com
2013-10-24 13:54 ` mpolacek at gcc dot gnu.org
2013-10-24 13:55 ` 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).