public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/63996] New: Infinite loop in invalid C++14 constexpr fn
@ 2014-11-20 13:16 mpolacek at gcc dot gnu.org
  2014-12-08 18:17 ` [Bug c++/63996] " ville.voutilainen at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-11-20 13:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 63996
           Summary: Infinite loop in invalid C++14 constexpr fn
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org

constexpr int
foo (int i)
{
  int a[i] = { };
}

constexpr int j = foo (1);

$ ./cc1plus -quiet bug.C -std=c++14
bug.C:7:23:   in constexpr expansion of ‘foo(1)’
bug.C:7:25: error: ‘(int*)(& a)’ is not a constant expression
 constexpr int j = foo (1);
                         ^
^C

$ gstack 13911
#0  initializer_constant_valid_p_1 (value=0x7f1d3b348b40,
endtype=0x7f1d3b35a000, cache=0x0) at /home/marek/src/gcc/gcc/varasm.c:4525
#1  0x00000000011b7d7e in initializer_constant_valid_p (value=0x7f1d3b348b40,
endtype=0x7f1d3b35a000) at /home/marek/src/gcc/gcc/varasm.c:4543
#2  0x00000000008c2178 in reduced_constant_expression_p (t=0x7f1d3b348b40) at
/home/marek/src/gcc/gcc/cp/constexpr.c:1431
#3  0x00000000008c76f9 in cxx_eval_constant_expression (ctx=0x7fffbdeb8ac0,
t=0x7f1d3b348b40, addr=false, non_constant_p=0x7fffbdeb945f,
overflow_p=0x7fffbdeb945e, jump_target=0x7fffbdeb8a38) at
/home/marek/src/gcc/gcc/cp/constexpr.c:2820
#4  0x00000000008c7302 in cxx_eval_statement_list (ctx=0x7fffbdeb8ac0,
t=0x7f1d3b49d560, non_constant_p=0x7fffbdeb945f, overflow_p=0x7fffbdeb945e,
jump_target=0x7fffbdeb8a38) at /home/marek/src/gcc/gcc/cp/constexpr.c:2734
#5  0x00000000008c7432 in cxx_eval_loop_expr (ctx=0x7fffbdeb8ac0,
t=0x7f1d3b49d700, non_constant_p=0x7fffbdeb945f, overflow_p=0x7fffbdeb945e,
jump_target=0x7fffbdeb8a38) at /home/marek/src/gcc/gcc/cp/constexpr.c:2761
#6  0x00000000008c944b in cxx_eval_constant_expression (ctx=0x7fffbdeb8ac0,
t=0x7f1d3b49d700, addr=false, non_constant_p=0x7fffbdeb945f,
overflow_p=0x7fffbdeb945e, jump_target=0x7fffbdeb8a38) at
/home/marek/src/gcc/gcc/cp/constexpr.c:3308
#7  0x00000000008c7302 in cxx_eval_statement_list (ctx=0x7fffbdeb8ac0,
t=0x7f1d3b496fe0, non_constant_p=0x7fffbdeb945f, overflow_p=0x7fffbdeb945e,
jump_target=0x7fffbdeb8a38) at /home/marek/src/gcc/gcc/cp/constexpr.c:2734
#8  0x00000000008c8fec in cxx_eval_constant_expression (ctx=0x7fffbdeb8ff0,
t=0x7f1d3b496fe0, addr=false, non_constant_p=0x7fffbdeb945f,
overflow_p=0x7fffbdeb945e, jump_target=0x0) at
/home/marek/src/gcc/gcc/cp/constexpr.c:3242
#9  0x00000000008c8bb4 in cxx_eval_constant_expression (ctx=0x7fffbdeb8ff0,
t=0x7f1d3b49d540, addr=false, non_constant_p=0x7fffbdeb945f,
overflow_p=0x7fffbdeb945e, jump_target=0x0) at
/home/marek/src/gcc/gcc/cp/constexpr.c:3207
#10 0x00000000008c8bb4 in cxx_eval_constant_expression (ctx=0x7fffbdeb8ff0,
t=0x7f1d3b49d520, addr=false, non_constant_p=0x7fffbdeb945f,
overflow_p=0x7fffbdeb945e, jump_target=0x7fffbdeb9220) at
/home/marek/src/gcc/gcc/cp/constexpr.c:3207
#11 0x00000000008c8393 in cxx_eval_constant_expression (ctx=0x7fffbdeb8ff0,
t=0x7f1d3b49d500, addr=false, non_constant_p=0x7fffbdeb945f,
overflow_p=0x7fffbdeb945e, jump_target=0x7fffbdeb9220) at
/home/marek/src/gcc/gcc/cp/constexpr.c:3002
#12 0x00000000008c8393 in cxx_eval_constant_expression (ctx=0x7fffbdeb8ff0,
t=0x7f1d3b49d4e0, addr=false, non_constant_p=0x7fffbdeb945f,
overflow_p=0x7fffbdeb945e, jump_target=0x7fffbdeb9220) at
/home/marek/src/gcc/gcc/cp/constexpr.c:3002
#13 0x00000000008c7302 in cxx_eval_statement_list (ctx=0x7fffbdeb8ff0,
t=0x7f1d3b496ea0, non_constant_p=0x7fffbdeb945f, overflow_p=0x7fffbdeb945e,
jump_target=0x7fffbdeb9220) at /home/marek/src/gcc/gcc/cp/constexpr.c:2734
#14 0x00000000008c8fec in cxx_eval_constant_expression (ctx=0x7fffbdeb93f0,
t=0x7f1d3b496ea0, addr=false, non_constant_p=0x7fffbdeb945f,
overflow_p=0x7fffbdeb945e, jump_target=0x7fffbdeb9220) at
/home/marek/src/gcc/gcc/cp/constexpr.c:3242
#15 0x00000000008c906b in cxx_eval_constant_expression (ctx=0x7fffbdeb93f0,
t=0x7f1d3b348ab0, addr=false, non_constant_p=0x7fffbdeb945f,
overflow_p=0x7fffbdeb945e, jump_target=0x7fffbdeb9220) at
/home/marek/src/gcc/gcc/cp/constexpr.c:3248
#16 0x00000000008c1bfd in cxx_eval_call_expression (ctx=0x7fffbdeb93f0,
t=0x7f1d3b3400a8, addr=false, non_constant_p=0x7fffbdeb945f,
overflow_p=0x7fffbdeb945e) at /home/marek/src/gcc/gcc/cp/constexpr.c:1350
#17 0x00000000008c7afa in cxx_eval_constant_expression (ctx=0x7fffbdeb93f0,
t=0x7f1d3b3400a8, addr=false, non_constant_p=0x7fffbdeb945f,
overflow_p=0x7fffbdeb945e, jump_target=0x0) at
/home/marek/src/gcc/gcc/cp/constexpr.c:2892
#18 0x00000000008c980f in cxx_eval_outermost_constant_expr (t=0x7f1d3b3400a8,
allow_non_constant=false, strict=true, object=0x7f1d3b341ea0) at
/home/marek/src/gcc/gcc/cp/constexpr.c:3374
#19 0x00000000008c9e76 in cxx_constant_value (t=0x7f1d3b3400a8,
decl=0x7f1d3b341ea0) at /home/marek/src/gcc/gcc/cp/constexpr.c:3462
#20 0x000000000071df40 in store_init_value (decl=0x7f1d3b341ea0,
init=0x7f1d3b3400a8, cleanups=0x7fffbdeb95d0, flags=5) at
/home/marek/src/gcc/gcc/cp/typeck2.c:809
#21 0x0000000000675df3 in check_initializer (decl=0x7f1d3b341ea0,
init=0x7f1d3b3400a8, flags=5, cleanups=0x7fffbdeb95d0) at
/home/marek/src/gcc/gcc/cp/decl.c:5909
#22 0x0000000000678e32 in cp_finish_decl (decl=0x7f1d3b341ea0,
init=0x7f1d3b3400a8, init_const_expr_p=true, asmspec_tree=0x0, flags=5) at
/home/marek/src/gcc/gcc/cp/decl.c:6535
#23 0x000000000079d0e7 in cp_parser_init_declarator (parser=0x7f1d3b499000,
decl_specifiers=0x7fffbdeb9790, checks=0x0, function_definition_allowed_p=true,
member_p=false, declares_class_or_enum=0, function_definition_p=0x7fffbdeb981b,
maybe_range_for_decl=0x0) at /home/marek/src/gcc/gcc/cp/parser.c:17188
#24 0x0000000000793e6f in cp_parser_simple_declaration (parser=0x7f1d3b499000,
function_definition_allowed_p=true, maybe_range_for_decl=0x0) at
/home/marek/src/gcc/gcc/cp/parser.c:11522
#25 0x0000000000793c5f in cp_parser_block_declaration (parser=0x7f1d3b499000,
statement_p=false) at /home/marek/src/gcc/gcc/cp/parser.c:11403
#26 0x00000000007939e3 in cp_parser_declaration (parser=0x7f1d3b499000) at
/home/marek/src/gcc/gcc/cp/parser.c:11300
#27 0x0000000000793590 in cp_parser_declaration_seq_opt (parser=0x7f1d3b499000)
at /home/marek/src/gcc/gcc/cp/parser.c:11186
#28 0x0000000000786ff6 in cp_parser_translation_unit (parser=0x7f1d3b499000) at
/home/marek/src/gcc/gcc/cp/parser.c:4101
#29 0x00000000007bc8db in c_parse_file () at
/home/marek/src/gcc/gcc/cp/parser.c:32197
#30 0x0000000000922103 in c_common_parse_file () at
/home/marek/src/gcc/gcc/c-family/c-opts.c:1039
#31 0x0000000000e9fe93 in compile_file () at
/home/marek/src/gcc/gcc/toplev.c:570
#32 0x0000000000ea22e6 in do_compile () at
/home/marek/src/gcc/gcc/toplev.c:2041
#33 0x0000000000ea24f0 in toplev::main (this=0x7fffbdeb9a4f, argc=4,
argv=0x7fffbdeb9b48) at /home/marek/src/gcc/gcc/toplev.c:2138
#34 0x0000000000634669 in main (argc=4, argv=0x7fffbdeb9b48) at
/home/marek/src/gcc/gcc/main.c:38
>From gcc-bugs-return-467770-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Nov 20 13:17:38 2014
Return-Path: <gcc-bugs-return-467770-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 7802 invoked by alias); 20 Nov 2014 13:17:37 -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 7323 invoked by uid 48); 20 Nov 2014 13:17:32 -0000
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/62053] [5 Regression] ICE: in remap_type_1, at tree-inline.c:540
Date: Thu, 20 Nov 2014 13:17:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: mpolacek at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P1
X-Bugzilla-Assigned-To: hubicka at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 5.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-62053-4-vqui6sfyzW@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-62053-4@http.gcc.gnu.org/bugzilla/>
References: <bug-62053-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-11/txt/msg02242.txt.bz2
Content-length: 525

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

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

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

--- Comment #9 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Another testcase:

constexpr int
foo (int i)
{
  constexpr int a[i] = { };
}

constexpr int j = foo (1);

./cc1plus -quiet bug.C -std=c++14


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

* [Bug c++/63996] Infinite loop in invalid C++14 constexpr fn
  2014-11-20 13:16 [Bug c++/63996] New: Infinite loop in invalid C++14 constexpr fn mpolacek at gcc dot gnu.org
@ 2014-12-08 18:17 ` ville.voutilainen at gmail dot com
  2014-12-12 17:15 ` ktietz at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-12-08 18:17 UTC (permalink / raw)
  To: gcc-bugs

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

Ville Voutilainen <ville.voutilainen at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-12-08
                 CC|                            |ville.voutilainen at gmail dot com
     Ever confirmed|0                           |1


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

* [Bug c++/63996] Infinite loop in invalid C++14 constexpr fn
  2014-11-20 13:16 [Bug c++/63996] New: Infinite loop in invalid C++14 constexpr fn mpolacek at gcc dot gnu.org
  2014-12-08 18:17 ` [Bug c++/63996] " ville.voutilainen at gmail dot com
@ 2014-12-12 17:15 ` ktietz at gcc dot gnu.org
  2014-12-12 17:18 ` ktietz at gcc dot gnu.org
  2014-12-12 17:44 ` ktietz at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ktietz at gcc dot gnu.org @ 2014-12-12 17:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Kai Tietz <ktietz at gcc dot gnu.org> ---
Author: ktietz
Date: Fri Dec 12 17:14:54 2014
New Revision: 218682

URL: https://gcc.gnu.org/viewcvs?rev=218682&root=gcc&view=rev
Log:
    PR c++/63996
    * constexpr.c (cxx_eval_loop_expr): Don't loop
    endless on none-constant expression.


Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/constexpr.c


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

* [Bug c++/63996] Infinite loop in invalid C++14 constexpr fn
  2014-11-20 13:16 [Bug c++/63996] New: Infinite loop in invalid C++14 constexpr fn mpolacek at gcc dot gnu.org
  2014-12-08 18:17 ` [Bug c++/63996] " ville.voutilainen at gmail dot com
  2014-12-12 17:15 ` ktietz at gcc dot gnu.org
@ 2014-12-12 17:18 ` ktietz at gcc dot gnu.org
  2014-12-12 17:44 ` ktietz at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ktietz at gcc dot gnu.org @ 2014-12-12 17:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Kai Tietz <ktietz at gcc dot gnu.org> ---
Author: ktietz
Date: Fri Dec 12 17:17:58 2014
New Revision: 218683

URL: https://gcc.gnu.org/viewcvs?rev=218683&root=gcc&view=rev
Log:
    PR c++/63996
    * g++.dg/cpp1y/pr63996.C: New file.


Added:
    trunk/gcc/testsuite/g++.dg/cpp1y/pr63996.C
Modified:
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/63996] Infinite loop in invalid C++14 constexpr fn
  2014-11-20 13:16 [Bug c++/63996] New: Infinite loop in invalid C++14 constexpr fn mpolacek at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-12-12 17:18 ` ktietz at gcc dot gnu.org
@ 2014-12-12 17:44 ` ktietz at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ktietz at gcc dot gnu.org @ 2014-12-12 17:44 UTC (permalink / raw)
  To: gcc-bugs

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

Kai Tietz <ktietz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |ktietz at gcc dot gnu.org
         Resolution|---                         |FIXED

--- Comment #3 from Kai Tietz <ktietz at gcc dot gnu.org> ---
Fixed.


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

end of thread, other threads:[~2014-12-12 17:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-20 13:16 [Bug c++/63996] New: Infinite loop in invalid C++14 constexpr fn mpolacek at gcc dot gnu.org
2014-12-08 18:17 ` [Bug c++/63996] " ville.voutilainen at gmail dot com
2014-12-12 17:15 ` ktietz at gcc dot gnu.org
2014-12-12 17:18 ` ktietz at gcc dot gnu.org
2014-12-12 17:44 ` ktietz 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).