6.0.0-0.16

This commit is contained in:
Jakub Jelinek 2016-03-11 21:57:17 +01:00
parent 005db08c91
commit aed55db9d5
4 changed files with 176 additions and 4 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
/gcc-6.0.0-20160227.tar.bz2
/gcc-6.0.0-20160302.tar.bz2
/gcc-6.0.0-20160305.tar.bz2
/gcc-6.0.0-20160311.tar.bz2

View File

@ -1,9 +1,9 @@
%global DATE 20160305
%global SVNREV 234005
%global DATE 20160311
%global SVNREV 234148
%global gcc_version 6.0.0
# Note, gcc_release must be integer, if you want to add suffixes to
# %{release}, append them after %{gcc_release} on Release: line.
%global gcc_release 0.15
%global gcc_release 0.16
%global _unpackaged_files_terminate_build 0
%global _performance_build 1
# Hardening slows the compiler way too much.
@ -206,6 +206,7 @@ Patch10: gcc6-no-add-needed.patch
Patch11: gcc6-libgo-p224.patch
Patch12: gcc6-aarch64-async-unw-tables.patch
Patch13: gcc6-libsanitize-aarch64-va42.patch
Patch14: gcc6-pr70001.patch
# On ARM EABI systems, we do want -gnueabi to be part of the
# target triple.
@ -772,6 +773,7 @@ package or when debugging this package.
rm -f libgo/go/crypto/elliptic/p224{,_test}.go
%patch12 -p0 -b .aarch64-async-unw-tables~
%patch13 -p0 -b .libsanitize-aarch64-va42~
%patch14 -p0 -b .pr70001~
%if 0%{?_enable_debug_packages}
mkdir dwz-wrapper
@ -3064,6 +3066,21 @@ fi
%doc rpm.doc/changelogs/libcc1/ChangeLog*
%changelog
* Fri Mar 11 2016 Jakub Jelinek <jakub@redhat.com> 6.0.0-0.15
- update from the trunk
- PRs c++/62096, c++/70001, c++/70105, c++/70135, c++/70153, c/68473,
c/70085, c/70143, lto/69589, middle-end/69916, rtl-opt/70061,
rtl-optimization/19705, rtl-optimization/47992,
rtl-optimization/69195, rtl-optimization/70174, target/62281,
target/70002, target/70044, target/70049, target/70064, target/70086,
target/70110, target/70113, target/70160, target/70168,
testsuite/68915, testsuite/70009, testsuite/70109,
tree-optimization/70013, tree-optimization/70115,
tree-optimization/70116, tree-optimization/70127,
tree-optimization/70128, tree-optimization/70138,
tree-optimization/70152, tree-optimization/70169,
tree-optimization/70177
* Sat Mar 5 2016 Jakub Jelinek <jakub@redhat.com> 6.0.0-0.15
- update from the trunk
- PRs c++/51406, c++/66786, c++/67164, c++/69203, c++/70035, c++/70054,

154
gcc6-pr70001.patch Normal file
View File

@ -0,0 +1,154 @@
2016-03-10 Jakub Jelinek <jakub@redhat.com>
PR c++/70001
* constexpr.c (cxx_eval_vec_init_1): Reuse CONSTRUCTOR initializers
for 1..max even for multi-dimensional arrays. Call unshare_expr
on it.
* g++.dg/cpp0x/constexpr-70001-4.C: New test.
* g++.dg/cpp1y/pr70001.C: New test.
--- gcc/cp/constexpr.c.jj 2016-03-10 12:52:04.000000000 +0100
+++ gcc/cp/constexpr.c 2016-03-10 19:24:28.435537864 +0100
@@ -2340,7 +2340,6 @@ cxx_eval_vec_init_1 (const constexpr_ctx
vec<constructor_elt, va_gc> **p = &CONSTRUCTOR_ELTS (ctx->ctor);
vec_alloc (*p, max + 1);
bool pre_init = false;
- tree pre_init_elt = NULL_TREE;
unsigned HOST_WIDE_INT i;
/* For the default constructor, build up a call to the default
@@ -2370,6 +2369,7 @@ cxx_eval_vec_init_1 (const constexpr_ctx
{
tree idx = build_int_cst (size_type_node, i);
tree eltinit;
+ bool reuse = false;
constexpr_ctx new_ctx;
init_subob_ctx (ctx, new_ctx, idx, pre_init ? init : elttype);
if (new_ctx.ctor != ctx->ctor)
@@ -2378,7 +2378,10 @@ cxx_eval_vec_init_1 (const constexpr_ctx
{
/* A multidimensional array; recurse. */
if (value_init || init == NULL_TREE)
- eltinit = NULL_TREE;
+ {
+ eltinit = NULL_TREE;
+ reuse = i == 0;
+ }
else
eltinit = cp_build_array_ref (input_location, init, idx,
tf_warning_or_error);
@@ -2390,18 +2393,9 @@ cxx_eval_vec_init_1 (const constexpr_ctx
{
/* Initializing an element using value or default initialization
we just pre-built above. */
- if (pre_init_elt == NULL_TREE)
- pre_init_elt
- = cxx_eval_constant_expression (&new_ctx, init, lval,
- non_constant_p, overflow_p);
- eltinit = pre_init_elt;
- /* Don't reuse the result of cxx_eval_constant_expression
- call if it isn't a constant initializer or if it requires
- relocations. */
- if (initializer_constant_valid_p (pre_init_elt,
- TREE_TYPE (pre_init_elt))
- != null_pointer_node)
- pre_init_elt = NULL_TREE;
+ eltinit = cxx_eval_constant_expression (&new_ctx, init, lval,
+ non_constant_p, overflow_p);
+ reuse = i == 0;
}
else
{
@@ -2427,6 +2421,23 @@ cxx_eval_vec_init_1 (const constexpr_ctx
}
else
CONSTRUCTOR_APPEND_ELT (*p, idx, eltinit);
+ /* Reuse the result of cxx_eval_constant_expression call
+ from the first iteration to all others if it is a constant
+ initializer that doesn't require relocations. */
+ if (reuse
+ && max > 1
+ && (initializer_constant_valid_p (eltinit, TREE_TYPE (eltinit))
+ == null_pointer_node))
+ {
+ if (new_ctx.ctor != ctx->ctor)
+ eltinit = new_ctx.ctor;
+ for (i = 1; i < max; ++i)
+ {
+ idx = build_int_cst (size_type_node, i);
+ CONSTRUCTOR_APPEND_ELT (*p, idx, unshare_expr (eltinit));
+ }
+ break;
+ }
}
if (!*non_constant_p)
--- gcc/testsuite/g++.dg/cpp0x/constexpr-70001-4.C.jj 2016-03-10 19:28:13.386481311 +0100
+++ gcc/testsuite/g++.dg/cpp0x/constexpr-70001-4.C 2016-03-10 19:28:43.295074924 +0100
@@ -0,0 +1,13 @@
+// PR c++/70001
+// { dg-do compile { target c++11 } }
+
+struct B
+{
+ int a;
+ constexpr B () : a (0) { }
+};
+
+struct A
+{
+ B b[1 << 19][1][1][1];
+} c;
--- gcc/testsuite/g++.dg/cpp1y/pr70001.C.jj 2016-03-11 18:22:15.526046513 +0100
+++ gcc/testsuite/g++.dg/cpp1y/pr70001.C 2016-03-11 18:21:43.000000000 +0100
@@ -0,0 +1,49 @@
+// PR c++/70001
+// { dg-do compile { target c++14 } }
+
+struct B
+{
+ int a;
+ constexpr B () : a (0) { }
+ constexpr B (int x) : a (x) { }
+};
+struct C
+{
+ B c;
+ constexpr C () : c (0) { }
+};
+struct A
+{
+ B b[1 << 4];
+};
+struct D
+{
+ C d[1 << 4];
+};
+
+constexpr int
+foo (int a, int b)
+{
+ A c;
+ c.b[a].a += b;
+ c.b[b].a += a;
+ return c.b[0].a + c.b[a].a + c.b[b].a;
+}
+
+constexpr int
+bar (int a, int b)
+{
+ D c;
+ c.d[a].c.a += b;
+ c.d[b].c.a += a;
+ return c.d[0].c.a + c.d[a].c.a + c.d[b].c.a;
+}
+
+constexpr int d = foo (1, 2);
+constexpr int e = foo (0, 3);
+constexpr int f = foo (2, 4);
+constexpr int g = bar (1, 2);
+constexpr int h = bar (0, 3);
+constexpr int i = bar (2, 4);
+static_assert (d == 3 && e == 6 && f == 6, "");
+static_assert (g == 3 && h == 6 && i == 6, "");

View File

@ -1 +1 @@
0e37dfdb7bd3c1a797bfac30b1991acb gcc-6.0.0-20160305.tar.bz2
77eacd68eb92e8f3a510553e442d29c1 gcc-6.0.0-20160311.tar.bz2