This commit is contained in:
Jakub Jelinek 2017-09-15 12:38:59 +02:00
parent 085992df86
commit 3dcf8052da
8 changed files with 571 additions and 4 deletions

1
.gitignore vendored
View File

@ -23,3 +23,4 @@
/gcc-7.1.1-20170718.tar.bz2 /gcc-7.1.1-20170718.tar.bz2
/gcc-7.1.1-20170802.tar.bz2 /gcc-7.1.1-20170802.tar.bz2
/gcc-7.2.1-20170829.tar.bz2 /gcc-7.2.1-20170829.tar.bz2
/gcc-7.2.1-20170915.tar.bz2

View File

@ -1,10 +1,10 @@
%global DATE 20170829 %global DATE 20170915
%global SVNREV 251415 %global SVNREV 252800
%global gcc_version 7.2.1 %global gcc_version 7.2.1
%global gcc_major 7 %global gcc_major 7
# Note, gcc_release must be integer, if you want to add suffixes to # Note, gcc_release must be integer, if you want to add suffixes to
# %{release}, append them after %{gcc_release} on Release: line. # %{release}, append them after %{gcc_release} on Release: line.
%global gcc_release 1 %global gcc_release 2
%global nvptx_tools_gitrev c28050f60193b3b95a18866a96f03334e874e78f %global nvptx_tools_gitrev c28050f60193b3b95a18866a96f03334e874e78f
%global nvptx_newlib_gitrev aadc8eb0ec43b7cd0dd2dfb484bae63c8b05ef24 %global nvptx_newlib_gitrev aadc8eb0ec43b7cd0dd2dfb484bae63c8b05ef24
%global _unpackaged_files_terminate_build 0 %global _unpackaged_files_terminate_build 0
@ -232,6 +232,11 @@ Patch8: gcc7-no-add-needed.patch
Patch9: gcc7-aarch64-async-unw-tables.patch Patch9: gcc7-aarch64-async-unw-tables.patch
Patch10: gcc7-foffload-default.patch Patch10: gcc7-foffload-default.patch
Patch11: gcc7-Wno-format-security.patch Patch11: gcc7-Wno-format-security.patch
Patch12: gcc7-pr81314.patch
Patch13: gcc7-pr81325.patch
Patch14: gcc7-pr82112-1.patch
Patch15: gcc7-pr82112-2.patch
Patch16: gcc7-pr81929.patch
Patch1000: nvptx-tools-no-ptxas.patch Patch1000: nvptx-tools-no-ptxas.patch
Patch1001: nvptx-tools-build.patch Patch1001: nvptx-tools-build.patch
@ -821,6 +826,11 @@ package or when debugging this package.
%patch9 -p0 -b .aarch64-async-unw-tables~ %patch9 -p0 -b .aarch64-async-unw-tables~
%patch10 -p0 -b .foffload-default~ %patch10 -p0 -b .foffload-default~
%patch11 -p0 -b .Wno-format-security~ %patch11 -p0 -b .Wno-format-security~
%patch12 -p0 -b .pr81314~
%patch13 -p0 -b .pr81325~
%patch14 -p0 -b .pr82112-1~
%patch15 -p0 -b .pr82112-2~
%patch16 -p0 -b .pr81929~
cd nvptx-tools-%{nvptx_tools_gitrev} cd nvptx-tools-%{nvptx_tools_gitrev}
%patch1000 -p1 -b .nvptx-tools-no-ptxas~ %patch1000 -p1 -b .nvptx-tools-no-ptxas~
@ -3238,6 +3248,23 @@ fi
%endif %endif
%changelog %changelog
* Fri Sep 15 2017 Jakub Jelinek <jakub@redhat.com> 7.2.1-2
- update from the 7 branch
- PRs ada/62235, ada/79441, ada/79542, bootstrap/81926, c++/81355,
c++/81852, c++/82039, c++/82040, c/45784, c/81687, driver/81650,
fortran/81770, inline-asm/82001, ipa/81128, libstdc++/70483,
libstdc++/81338, libstdc++/81468, libstdc++/81599, libstdc++/81835,
libstdc++/81891, libstdc++/81912, middle-end/81052, middle-end/81768,
other/39851, sanitizer/63361, sanitizer/81923, target/80695,
target/81504, target/81593, target/81621, target/81833, target/81988,
target/82181, testsuite/82114, testsuite/82120, tree-opt/81696,
tree-optimization/81503, tree-optimization/81987
- fix OpenMP implicit firstprivate handling of references (PR c++/81314)
- fix -fcompare-debug failures with PowerPC atomics (PR target/81325)
- fix compile time hog in C++ replace_placeholders (PR sanitizer/81929)
- fix __atomic* and PowerPC vec_ld/vec_st handling of array arguments
(PR target/82112)
* Tue Aug 29 2017 Jakub Jelinek <jakub@redhat.com> 7.2.1-1 * Tue Aug 29 2017 Jakub Jelinek <jakub@redhat.com> 7.2.1-1
- update from the 7 branch - update from the 7 branch
- 7.2 release - 7.2 release

72
gcc7-pr81314.patch Normal file
View File

@ -0,0 +1,72 @@
2017-09-15 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
2017-09-14 Jakub Jelinek <jakub@redhat.com>
PR c++/81314
* cp-gimplify.c (omp_var_to_track): Look through references.
(omp_cxx_notice_variable): Likewise.
* testsuite/libgomp.c++/pr81314.C: New test.
--- gcc/cp/cp-gimplify.c (revision 252769)
+++ gcc/cp/cp-gimplify.c (revision 252770)
@@ -895,6 +895,8 @@ omp_var_to_track (tree decl)
tree type = TREE_TYPE (decl);
if (is_invisiref_parm (decl))
type = TREE_TYPE (type);
+ else if (TREE_CODE (type) == REFERENCE_TYPE)
+ type = TREE_TYPE (type);
while (TREE_CODE (type) == ARRAY_TYPE)
type = TREE_TYPE (type);
if (type == error_mark_node || !CLASS_TYPE_P (type))
@@ -947,6 +949,8 @@ omp_cxx_notice_variable (struct cp_gener
tree type = TREE_TYPE (decl);
if (is_invisiref_parm (decl))
type = TREE_TYPE (type);
+ else if (TREE_CODE (type) == REFERENCE_TYPE)
+ type = TREE_TYPE (type);
while (TREE_CODE (type) == ARRAY_TYPE)
type = TREE_TYPE (type);
get_copy_ctor (type, tf_none);
--- libgomp/testsuite/libgomp.c++/pr81314.C (nonexistent)
+++ libgomp/testsuite/libgomp.c++/pr81314.C (revision 252770)
@@ -0,0 +1,38 @@
+// PR c++/81314
+// { dg-do link }
+
+template <int N>
+struct S {
+ S () { s = 0; }
+ S (const S &x) { s = x.s; }
+ ~S () {}
+ int s;
+};
+
+void
+foo (S<2> &x)
+{
+ #pragma omp taskloop
+ for (int i = 0; i < 100; ++i)
+ x.s++;
+}
+
+void
+bar (S<3> &x)
+{
+ #pragma omp task
+ x.s++;
+}
+
+int
+main ()
+{
+ S<2> s;
+ S<3> t;
+ #pragma omp parallel
+ #pragma omp master
+ {
+ foo (s);
+ bar (t);
+ }
+}

199
gcc7-pr81325.patch Normal file
View File

@ -0,0 +1,199 @@
2017-09-15 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
2017-09-14 Jakub Jelinek <jakub@redhat.com>
PR target/81325
* cfgbuild.c (find_bb_boundaries): Ignore debug insns in decisions
if and where to split a bb, except for splitting before debug insn
sequences followed by non-label real insn. Delete debug insns
in between basic blocks.
* g++.dg/cpp0x/pr81325.C: New test.
--- gcc/cfgbuild.c (revision 252751)
+++ gcc/cfgbuild.c (revision 252752)
@@ -442,9 +442,10 @@ find_bb_boundaries (basic_block bb)
rtx_insn *end = BB_END (bb), *x;
rtx_jump_table_data *table;
rtx_insn *flow_transfer_insn = NULL;
+ rtx_insn *debug_insn = NULL;
edge fallthru = NULL;
- if (insn == BB_END (bb))
+ if (insn == end)
return;
if (LABEL_P (insn))
@@ -455,27 +456,49 @@ find_bb_boundaries (basic_block bb)
{
enum rtx_code code = GET_CODE (insn);
+ if (code == DEBUG_INSN)
+ {
+ if (flow_transfer_insn && !debug_insn)
+ debug_insn = insn;
+ }
/* In case we've previously seen an insn that effects a control
flow transfer, split the block. */
- if ((flow_transfer_insn || code == CODE_LABEL)
- && inside_basic_block_p (insn))
+ else if ((flow_transfer_insn || code == CODE_LABEL)
+ && inside_basic_block_p (insn))
{
- fallthru = split_block (bb, PREV_INSN (insn));
+ rtx_insn *prev = PREV_INSN (insn);
+
+ /* If the first non-debug inside_basic_block_p insn after a control
+ flow transfer is not a label, split the block before the debug
+ insn instead of before the non-debug insn, so that the debug
+ insns are not lost. */
+ if (debug_insn && code != CODE_LABEL && code != BARRIER)
+ prev = PREV_INSN (debug_insn);
+ fallthru = split_block (bb, prev);
if (flow_transfer_insn)
{
BB_END (bb) = flow_transfer_insn;
+ rtx_insn *next;
/* Clean up the bb field for the insns between the blocks. */
for (x = NEXT_INSN (flow_transfer_insn);
x != BB_HEAD (fallthru->dest);
- x = NEXT_INSN (x))
- if (!BARRIER_P (x))
- set_block_for_insn (x, NULL);
+ x = next)
+ {
+ next = NEXT_INSN (x);
+ /* Debug insns should not be in between basic blocks,
+ drop them on the floor. */
+ if (DEBUG_INSN_P (x))
+ delete_insn (x);
+ else if (!BARRIER_P (x))
+ set_block_for_insn (x, NULL);
+ }
}
bb = fallthru->dest;
remove_edge (fallthru);
flow_transfer_insn = NULL;
+ debug_insn = NULL;
if (code == CODE_LABEL && LABEL_ALT_ENTRY_P (insn))
make_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun), bb, 0);
}
@@ -498,17 +521,23 @@ find_bb_boundaries (basic_block bb)
/* In case expander replaced normal insn by sequence terminating by
return and barrier, or possibly other sequence not behaving like
ordinary jump, we need to take care and move basic block boundary. */
- if (flow_transfer_insn)
+ if (flow_transfer_insn && flow_transfer_insn != end)
{
BB_END (bb) = flow_transfer_insn;
/* Clean up the bb field for the insns that do not belong to BB. */
- x = flow_transfer_insn;
- while (x != end)
+ rtx_insn *next;
+ for (x = NEXT_INSN (flow_transfer_insn); ; x = next)
{
- x = NEXT_INSN (x);
- if (!BARRIER_P (x))
+ next = NEXT_INSN (x);
+ /* Debug insns should not be in between basic blocks,
+ drop them on the floor. */
+ if (DEBUG_INSN_P (x))
+ delete_insn (x);
+ else if (!BARRIER_P (x))
set_block_for_insn (x, NULL);
+ if (x == end)
+ break;
}
}
--- gcc/testsuite/g++.dg/cpp0x/pr81325.C (nonexistent)
+++ gcc/testsuite/g++.dg/cpp0x/pr81325.C (revision 252752)
@@ -0,0 +1,84 @@
+// PR target/81325
+// { dg-do compile { target c++11 } }
+// { dg-options "-O2 -fcompare-debug" }
+
+struct A { A(const char *, const int & = 0); };
+template <typename> struct B;
+template <typename> struct C {
+ int _M_i;
+ void m_fn1() { __atomic_fetch_add(&_M_i, 0, __ATOMIC_RELAXED); }
+};
+struct D {
+ int *Data;
+ long Length = 0;
+ D(int) : Data() {}
+};
+template <> struct B<int> : C<int> {};
+struct F {
+ B<int> RefCount;
+ void m_fn2() { RefCount.m_fn1(); }
+};
+struct G {
+ F *Obj;
+ G(const G &p1) : Obj(p1.Obj) {
+ if (Obj) {
+ F *a = 0;
+ a->m_fn2();
+ }
+ }
+};
+struct H {
+ int CPlusPlus : 1;
+};
+struct I {
+ enum {} KindId;
+};
+template <typename ResultT, typename ArgT> struct J {
+ void operator()();
+ ResultT operator()(ArgT) {}
+};
+struct K {
+ int AllowBind;
+ I SupportedKind;
+ I RestrictKind;
+ G Implementation;
+};
+struct L {
+ L(int) : Implementation(Implementation) {}
+ K Implementation;
+};
+struct M {
+ int Param1;
+};
+struct N {
+ N(int, L &p2) : Param2(p2) {}
+ L Param2;
+};
+struct O {
+ L m_fn3();
+};
+L ignoringImpCasts(L);
+J<O, L> b;
+L hasName(const A &);
+M hasOverloadedOperatorName(D);
+J<O, int> c;
+struct P {
+ void m_fn4(L, int);
+};
+struct Q {
+ void m_fn5(P *);
+};
+H d;
+void Q::m_fn5(P *p1) {
+ if (!d.CPlusPlus) {
+ c();
+ L e = 0, f = ignoringImpCasts(e);
+ b(ignoringImpCasts(f)).m_fn3();
+ }
+ hasOverloadedOperatorName(0);
+ hasName("");
+ L g = 0;
+ N(0, g);
+ L h(0);
+ p1->m_fn4(h, 0);
+}

73
gcc7-pr81929.patch Normal file
View File

@ -0,0 +1,73 @@
2017-09-14 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/81929
* tree.c (struct replace_placeholders_t): Add pset field.
(replace_placeholders_r): Call cp_walk_tree with d->pset as
last argument instead of NULL. Formatting fix.
(replace_placeholders): Add pset variable, add its address
into data. Pass &pset instead of NULL to cp_walk_tree.
* g++.dg/ubsan/pr81929.C: New test.
--- gcc/cp/tree.c.jj 2017-09-12 09:35:47.000000000 +0200
+++ gcc/cp/tree.c 2017-09-14 17:38:07.717064412 +0200
@@ -3063,6 +3063,7 @@ struct replace_placeholders_t
{
tree obj; /* The object to be substituted for a PLACEHOLDER_EXPR. */
bool seen; /* Whether we've encountered a PLACEHOLDER_EXPR. */
+ hash_set<tree> *pset; /* To avoid walking same trees multiple times. */
};
/* Like substitute_placeholder_in_expr, but handle C++ tree codes and
@@ -3085,8 +3086,8 @@ replace_placeholders_r (tree* t, int* wa
case PLACEHOLDER_EXPR:
{
tree x = obj;
- for (; !(same_type_ignoring_top_level_qualifiers_p
- (TREE_TYPE (*t), TREE_TYPE (x)));
+ for (; !same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (*t),
+ TREE_TYPE (x));
x = TREE_OPERAND (x, 0))
gcc_assert (TREE_CODE (x) == COMPONENT_REF);
*t = x;
@@ -3118,8 +3119,7 @@ replace_placeholders_r (tree* t, int* wa
valp = &TARGET_EXPR_INITIAL (*valp);
}
d->obj = subob;
- cp_walk_tree (valp, replace_placeholders_r,
- data_, NULL);
+ cp_walk_tree (valp, replace_placeholders_r, data_, d->pset);
d->obj = obj;
}
*walk_subtrees = false;
@@ -3151,10 +3151,11 @@ replace_placeholders (tree exp, tree obj
return exp;
tree *tp = &exp;
- replace_placeholders_t data = { obj, false };
+ hash_set<tree> pset;
+ replace_placeholders_t data = { obj, false, &pset };
if (TREE_CODE (exp) == TARGET_EXPR)
tp = &TARGET_EXPR_INITIAL (exp);
- cp_walk_tree (tp, replace_placeholders_r, &data, NULL);
+ cp_walk_tree (tp, replace_placeholders_r, &data, &pset);
if (seen_p)
*seen_p = data.seen;
return exp;
--- gcc/testsuite/g++.dg/ubsan/pr81929.C.jj 2017-09-14 17:48:09.052611540 +0200
+++ gcc/testsuite/g++.dg/ubsan/pr81929.C 2017-09-14 17:49:21.644711332 +0200
@@ -0,0 +1,14 @@
+// PR sanitizer/81929
+// { dg-do compile }
+// { dg-options "-std=c++14 -fsanitize=undefined" }
+
+struct S { S &operator<< (long); S foo (); S (); };
+
+void
+bar ()
+{
+ static_cast<S&>(S () << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0
+ << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0
+ << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0
+ << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0).foo ();
+}

94
gcc7-pr82112-1.patch Normal file
View File

@ -0,0 +1,94 @@
2017-09-15 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
2017-09-12 Jakub Jelinek <jakub@redhat.com>
PR target/82112
* c-common.c (sync_resolve_size): Instead of c_dialect_cxx ()
assertion check that in the condition.
(get_atomic_generic_size): Likewise. Before testing if parameter
has pointer type, if it has array type, call for C++
default_conversion to perform array-to-pointer conversion.
* c-c++-common/pr82112.c: New test.
* gcc.dg/pr82112.c: New test.
--- gcc/c-family/c-common.c (revision 252002)
+++ gcc/c-family/c-common.c (revision 252003)
@@ -6478,10 +6478,9 @@ sync_resolve_size (tree function, vec<tr
}
argtype = type = TREE_TYPE ((*params)[0]);
- if (TREE_CODE (type) == ARRAY_TYPE)
+ if (TREE_CODE (type) == ARRAY_TYPE && c_dialect_cxx ())
{
/* Force array-to-pointer decay for C++. */
- gcc_assert (c_dialect_cxx());
(*params)[0] = default_conversion ((*params)[0]);
type = TREE_TYPE ((*params)[0]);
}
@@ -6646,10 +6645,9 @@ get_atomic_generic_size (location_t loc,
/* Get type of first parameter, and determine its size. */
type_0 = TREE_TYPE ((*params)[0]);
- if (TREE_CODE (type_0) == ARRAY_TYPE)
+ if (TREE_CODE (type_0) == ARRAY_TYPE && c_dialect_cxx ())
{
/* Force array-to-pointer decay for C++. */
- gcc_assert (c_dialect_cxx());
(*params)[0] = default_conversion ((*params)[0]);
type_0 = TREE_TYPE ((*params)[0]);
}
@@ -6688,6 +6686,12 @@ get_atomic_generic_size (location_t loc,
/* __atomic_compare_exchange has a bool in the 4th position, skip it. */
if (n_param == 6 && x == 3)
continue;
+ if (TREE_CODE (type) == ARRAY_TYPE && c_dialect_cxx ())
+ {
+ /* Force array-to-pointer decay for C++. */
+ (*params)[x] = default_conversion ((*params)[x]);
+ type = TREE_TYPE ((*params)[x]);
+ }
if (!POINTER_TYPE_P (type))
{
error_at (loc, "argument %d of %qE must be a pointer type", x + 1,
--- gcc/testsuite/gcc.dg/pr82112.c (nonexistent)
+++ gcc/testsuite/gcc.dg/pr82112.c (revision 252003)
@@ -0,0 +1,21 @@
+/* PR target/82112 */
+/* { dg-do compile } */
+/* { dg-options "-std=gnu90" } */
+
+struct S { int a[10]; } bar (void);
+int b, c;
+
+void
+foo (void)
+{
+ __atomic_load (bar ().a, &b, __ATOMIC_ACQUIRE); /* { dg-error "argument 1 of .__atomic_load. must be a non-void pointer type" } */
+ __atomic_load (&b, bar ().a, __ATOMIC_ACQUIRE); /* { dg-error "argument 2 of .__atomic_load. must be a pointer type" } */
+ __atomic_store (bar ().a, &b, __ATOMIC_SEQ_CST); /* { dg-error "argument 1 of .__atomic_store. must be a non-void pointer type" } */
+ __atomic_store (&b, bar ().a, __ATOMIC_SEQ_CST); /* { dg-error "argument 2 of .__atomic_store. must be a pointer type" } */
+ __atomic_exchange (bar ().a, &b, &c, __ATOMIC_RELAXED); /* { dg-error "argument 1 of .__atomic_exchange. must be a non-void pointer type" } */
+ __atomic_exchange (&b, bar ().a, &c, __ATOMIC_RELAXED); /* { dg-error "argument 2 of .__atomic_exchange. must be a pointer type" } */
+ __atomic_exchange (&b, &c, bar ().a, __ATOMIC_RELAXED); /* { dg-error "argument 3 of .__atomic_exchange. must be a pointer type" } */
+ __atomic_compare_exchange (bar ().a, &b, &c, 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED); /* { dg-error "argument 1 of .__atomic_compare_exchange. must be a non-void pointer type" } */
+ __atomic_compare_exchange (&b, bar ().a, &c, 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED); /* { dg-error "argument 2 of .__atomic_compare_exchange. must be a pointer type" } */
+ __atomic_compare_exchange (&b, &c, bar ().a, 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED); /* { dg-error "argument 3 of .__atomic_compare_exchange. must be a pointer type" } */
+}
--- gcc/testsuite/c-c++-common/pr82112.c (nonexistent)
+++ gcc/testsuite/c-c++-common/pr82112.c (revision 252003)
@@ -0,0 +1,13 @@
+/* PR target/82112 */
+/* { dg-do compile } */
+
+int c[10], d[10], e[10], f[10], g[10], h[10], i[10], j[10], k[10], l[10];
+
+void
+foo (void)
+{
+ __atomic_load (c, d, __ATOMIC_ACQUIRE);
+ __atomic_store (e, f, __ATOMIC_SEQ_CST);
+ __atomic_exchange (g, h, i, __ATOMIC_RELAXED);
+ __atomic_compare_exchange (j, k, l, 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
+}

101
gcc7-pr82112-2.patch Normal file
View File

@ -0,0 +1,101 @@
2017-09-15 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
2017-09-12 Jakub Jelinek <jakub@redhat.com>
PR target/82112
* config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): For
ALTIVEC_BUILTIN_VEC_LD if arg1 has array type call default_conversion
on it early, rather than manual conversion late. For
ALTIVEC_BUILTIN_VEC_ST if arg2 has array type call default_conversion
instead of performing manual conversion.
* gcc.target/powerpc/pr82112.c: New test.
* g++.dg/ext/altivec-18.C: New test.
--- gcc/config/rs6000/rs6000-c.c (revision 252027)
+++ gcc/config/rs6000/rs6000-c.c (revision 252028)
@@ -6489,7 +6489,13 @@ altivec_resolve_overloaded_builtin (loca
/* Strip qualifiers like "const" from the pointer arg. */
tree arg1_type = TREE_TYPE (arg1);
- if (!POINTER_TYPE_P (arg1_type) && TREE_CODE (arg1_type) != ARRAY_TYPE)
+ if (TREE_CODE (arg1_type) == ARRAY_TYPE && c_dialect_cxx ())
+ {
+ /* Force array-to-pointer decay for C++. */
+ arg1 = default_conversion (arg1);
+ arg1_type = TREE_TYPE (arg1);
+ }
+ if (!POINTER_TYPE_P (arg1_type))
goto bad;
tree inner_type = TREE_TYPE (arg1_type);
@@ -6509,15 +6515,6 @@ altivec_resolve_overloaded_builtin (loca
if (!ptrofftype_p (TREE_TYPE (arg0)))
arg0 = build1 (NOP_EXPR, sizetype, arg0);
- tree arg1_type = TREE_TYPE (arg1);
- if (TREE_CODE (arg1_type) == ARRAY_TYPE)
- {
- arg1_type = TYPE_POINTER_TO (TREE_TYPE (arg1_type));
- tree const0 = build_int_cstu (sizetype, 0);
- tree arg1_elt0 = build_array_ref (loc, arg1, const0);
- arg1 = build1 (ADDR_EXPR, arg1_type, arg1_elt0);
- }
-
tree addr = fold_build2_loc (loc, POINTER_PLUS_EXPR, arg1_type,
arg1, arg0);
tree aligned = fold_build2_loc (loc, BIT_AND_EXPR, arg1_type, addr,
@@ -6572,12 +6569,11 @@ altivec_resolve_overloaded_builtin (loca
arg1 = build1 (NOP_EXPR, sizetype, arg1);
tree arg2_type = TREE_TYPE (arg2);
- if (TREE_CODE (arg2_type) == ARRAY_TYPE)
+ if (TREE_CODE (arg2_type) == ARRAY_TYPE && c_dialect_cxx ())
{
- arg2_type = TYPE_POINTER_TO (TREE_TYPE (arg2_type));
- tree const0 = build_int_cstu (sizetype, 0);
- tree arg2_elt0 = build_array_ref (loc, arg2, const0);
- arg2 = build1 (ADDR_EXPR, arg2_type, arg2_elt0);
+ /* Force array-to-pointer decay for C++. */
+ arg2 = default_conversion (arg2);
+ arg2_type = TREE_TYPE (arg2);
}
/* Find the built-in to make sure a compatible one exists; if not
--- gcc/testsuite/gcc.target/powerpc/pr82112.c (nonexistent)
+++ gcc/testsuite/gcc.target/powerpc/pr82112.c (revision 252028)
@@ -0,0 +1,16 @@
+/* PR target/82112 */
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-maltivec -std=gnu90" } */
+
+#include <altivec.h>
+
+struct __attribute__((aligned (16))) S { unsigned char c[64]; } bar (void);
+vector unsigned char v;
+
+void
+foo (void)
+{
+ vec_ld (0, bar ().c); /* { dg-error "invalid parameter combination for AltiVec intrinsic" } */
+ vec_st (v, 0, bar ().c); /* { dg-error "invalid parameter combination for AltiVec intrinsic" } */
+}
--- gcc/testsuite/g++.dg/ext/altivec-18.C (nonexistent)
+++ gcc/testsuite/g++.dg/ext/altivec-18.C (revision 252028)
@@ -0,0 +1,14 @@
+// PR target/82112
+// { dg-do compile { target powerpc*-*-* } }
+// { dg-require-effective-target powerpc_altivec_ok }
+// { dg-options "-maltivec" }
+
+#include <altivec.h>
+
+__attribute__((aligned (16))) extern const unsigned char c[16];
+
+void
+foo (void)
+{
+ vec_ld (0, c);
+}

View File

@ -1,3 +1,3 @@
SHA512 (gcc-7.2.1-20170829.tar.bz2) = 77b0c82d3c648053d4049ae5bbacd395fc5864c40fbbfb8d73ad48037a62c4e0514d7090332f31e1c2179757fa5a4f9fee72dcef0b43a20a6971f0d78ffe2911 SHA512 (gcc-7.2.1-20170915.tar.bz2) = 41cf64b6f9ea7b968d2d1a9b833231c32113311b63d23a4f830e8cbacbdeeb05bfd94ff1d0add62938146fc07c38018befb4efcf9e28b14df76ec6db5159ad1c
SHA512 (nvptx-newlib-aadc8eb0ec43b7cd0dd2dfb484bae63c8b05ef24.tar.bz2) = 38f97c9297ad108568352a4d28277455a3c01fd8b7864e798037e5006b6f757022e874bbf3f165775fe3b873781bc108137bbeb42dd5ed3c7d3e6747746fa918 SHA512 (nvptx-newlib-aadc8eb0ec43b7cd0dd2dfb484bae63c8b05ef24.tar.bz2) = 38f97c9297ad108568352a4d28277455a3c01fd8b7864e798037e5006b6f757022e874bbf3f165775fe3b873781bc108137bbeb42dd5ed3c7d3e6747746fa918
SHA512 (nvptx-tools-c28050f60193b3b95a18866a96f03334e874e78f.tar.bz2) = 95b577a06a93bb044dbc8033e550cb36bcf2ab2687da030a7318cdc90e7467ed49665e247dcafb5ff4a7e92cdc264291d19728bd17fab902fb64b22491269330 SHA512 (nvptx-tools-c28050f60193b3b95a18866a96f03334e874e78f.tar.bz2) = 95b577a06a93bb044dbc8033e550cb36bcf2ab2687da030a7318cdc90e7467ed49665e247dcafb5ff4a7e92cdc264291d19728bd17fab902fb64b22491269330