* [patch c++]: Fix PR/63996
@ 2014-12-12 10:58 Kai Tietz
2014-12-12 15:49 ` Jason Merrill
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Kai Tietz @ 2014-12-12 10:58 UTC (permalink / raw)
To: GCC Patches; +Cc: Jason Merrill
Hi,
The loop-expression loops endless in c++14's case for cases the
statement-list isn't constant.
Bug 63996 - Infinite loop in invalid C++14 constexpr fn
ChangeLog
2014-12-12 Kai Tietz <ktietz@redhat.com>
PR c++/63996
* constexpr.c (cxx_eval_loop_expr): Don't loop
endless on none-constant expression.
2014-12-12 Kai Tietz <ktietz@redhat.com>
PR c++/63996
* g++.dg/cpp1y/pr63996.C: New file.
Tested for x86_64-w64-mingw32. Ok for apply?
Regards,
Kai
New testcase in g++.dg/cpp1y as pr63996.C
// { dg-do compile { target c++14 } }
constexpr int
foo (int i)
{
int a[i] = { };
}
constexpr int j = foo (1); // { dg-error "is not a constant expression" }
Index: constexpr.c
===================================================================
--- constexpr.c (Revision 218570)
+++ constexpr.c (Arbeitskopie)
@@ -2841,7 +2870,7 @@ cxx_eval_loop_expr (const constexpr_ctx *ctx, tree
{
cxx_eval_statement_list (ctx, body,
non_constant_p, overflow_p, jump_target);
- if (returns (jump_target) || breaks (jump_target))
+ if (returns (jump_target) || breaks (jump_target) || *non_constant_p)
break;
}
if (breaks (jump_target))
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch c++]: Fix PR/63996
2014-12-12 10:58 [patch c++]: Fix PR/63996 Kai Tietz
@ 2014-12-12 15:49 ` Jason Merrill
2014-12-12 20:27 ` Paolo Carlini
2014-12-14 11:00 ` Andreas Schwab
2 siblings, 0 replies; 6+ messages in thread
From: Jason Merrill @ 2014-12-12 15:49 UTC (permalink / raw)
To: Kai Tietz, GCC Patches
OK.
Jason
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch c++]: Fix PR/63996
2014-12-12 10:58 [patch c++]: Fix PR/63996 Kai Tietz
2014-12-12 15:49 ` Jason Merrill
@ 2014-12-12 20:27 ` Paolo Carlini
2014-12-14 11:00 ` Andreas Schwab
2 siblings, 0 replies; 6+ messages in thread
From: Paolo Carlini @ 2014-12-12 20:27 UTC (permalink / raw)
To: Kai Tietz, GCC Patches; +Cc: Jason Merrill
Hi,
On 12/12/2014 11:58 AM, Kai Tietz wrote:
> New testcase in g++.dg/cpp1y as pr63996.C
>
> // { dg-do compile { target c++14 } }
>
> constexpr int
> foo (int i)
> {
> int a[i] = { };
> }
>
> constexpr int j = foo (1); // { dg-error "is not a constant expression" }
The testcase fails spuriously because of Jason's VLA reversion commit,
please adjust it.
Thanks,
Paolo.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch c++]: Fix PR/63996
2014-12-12 10:58 [patch c++]: Fix PR/63996 Kai Tietz
2014-12-12 15:49 ` Jason Merrill
2014-12-12 20:27 ` Paolo Carlini
@ 2014-12-14 11:00 ` Andreas Schwab
2014-12-15 10:49 ` Paolo Carlini
2 siblings, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2014-12-14 11:00 UTC (permalink / raw)
To: Kai Tietz; +Cc: GCC Patches, Jason Merrill
Kai Tietz <ktietz70@googlemail.com> writes:
> New testcase in g++.dg/cpp1y as pr63996.C
>
> // { dg-do compile { target c++14 } }
>
> constexpr int
> foo (int i)
> {
> int a[i] = { };
> }
>
> constexpr int j = foo (1); // { dg-error "is not a constant expression" }
FAIL: g++.dg/cpp1y/pr63996.C -std=c++14 (test for excess errors)
Excess errors:
/usr/local/gcc/gcc-20141214/gcc/testsuite/g++.dg/cpp1y/pr63996.C:6:10: error: ISO C++ forbids variable length array 'a' [-Wvla]
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch c++]: Fix PR/63996
2014-12-14 11:00 ` Andreas Schwab
@ 2014-12-15 10:49 ` Paolo Carlini
2014-12-15 11:34 ` Kai Tietz
0 siblings, 1 reply; 6+ messages in thread
From: Paolo Carlini @ 2014-12-15 10:49 UTC (permalink / raw)
To: Andreas Schwab, Kai Tietz; +Cc: GCC Patches, Jason Merrill
[-- Attachment #1: Type: text/plain, Size: 67 bytes --]
... committed as obvious the below.
Paolo.
/////////////////////
[-- Attachment #2: CL --]
[-- Type: text/plain, Size: 87 bytes --]
2014-12-15 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/cpp1y/pr63996.C: Fix.
[-- Attachment #3: patchlet --]
[-- Type: text/plain, Size: 392 bytes --]
Index: g++.dg/cpp1y/pr63996.C
===================================================================
--- g++.dg/cpp1y/pr63996.C (revision 218737)
+++ g++.dg/cpp1y/pr63996.C (working copy)
@@ -3,7 +3,7 @@
constexpr int
foo (int i)
{
- int a[i] = { };
+ int a[i] = { }; // { dg-error "forbids variable length" }
}
constexpr int j = foo (1); // { dg-error "is not a constant expression" }
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [patch c++]: Fix PR/63996
2014-12-15 10:49 ` Paolo Carlini
@ 2014-12-15 11:34 ` Kai Tietz
0 siblings, 0 replies; 6+ messages in thread
From: Kai Tietz @ 2014-12-15 11:34 UTC (permalink / raw)
To: Paolo Carlini; +Cc: Andreas Schwab, GCC Patches, Jason Merrill
2014-12-15 11:48 GMT+01:00 Paolo Carlini <paolo.carlini@oracle.com>:
> ... committed as obvious the below.
>
> Paolo.
>
> /////////////////////
Thanks
Kai
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-12-15 11:33 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-12 10:58 [patch c++]: Fix PR/63996 Kai Tietz
2014-12-12 15:49 ` Jason Merrill
2014-12-12 20:27 ` Paolo Carlini
2014-12-14 11:00 ` Andreas Schwab
2014-12-15 10:49 ` Paolo Carlini
2014-12-15 11:34 ` Kai Tietz
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).