Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs
On Thu, Apr 19, 2018 at 03:08:06PM -0700, H.J. Lu wrote: > > As -fcf-protection and -mcet/-mibt/-mshstk are are disjoint and > > control different parts I agree with > > > > + if ((isa_flag & OPTION_MASK_ISA_SHSTK)) > > +def_or_undef (parse_in, "__SHSTK__"); > > + if (flag_cf_protection != CF_NONE) > > +def_or_undef (parse_in, "__CET__"); > > > > Why __CET_IBT__ and __CET_SHSTK__ are needed? Moreover the naming is > > confusing as 'IBT' and 'SHSTK' are related to HW features which are > > controlled > > by -m options. __CET__ seems to be enough. > > > > One needs to know if IBT and SHSTK are enabled by -fcf-protection. They will > be checked by and glibc. So can't you define __CET__ to 3 if CF_FULL, to 1 if CF_BRANCH and 2 if CF_RETURN? Then if code doesn't care which one it is, it can just #ifdef __CET__, otherwise it can test which of those is enabled. Implementation-wise it would probably need to be: if (flag_cf_protection != CF_NONE) { if (def_or_undef == cpp_undef) def_or_undef (parse_in, "__CET__"); else if ((flag_cf_protection & CF_FULL) == CF_FULL) def_or_undef (parse_in, "__CET__=3"); else if (flag_cf_protection & CF_BRANCH) def_or_undef (parse_in, "__CET__=1"); else if (flag_cf_protection & CF_RETURN) def_or_undef (parse_in, "__CET__=2"); } or so. Actually, because it doesn't depend on something that can change depending on target attributes, it probably doesn't even belong in this function, but to ix86_target_macros and there you can just cpp_define it, don't deal with cpp_undef at all. Jakub
Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs
On Fri, Apr 20, 2018 at 06:25:10AM +, Tsimbalist, Igor V wrote: > > Something like this? > > Shouldn't this > > -# ifdef __IBT__ > +# if (__CET__ & 1) != 0 > > Be as > > -# ifdef __IBT__ > +#ifdef __CET__ > +# if (__CET__ & 1) != 0 > > OK otherwise. Only if you use -Wundef warning (not part of -Wall or -W) and, if this is a system header, only with -Wundef -Wsystem-headers. But perhaps it doesn't hurt to wrap it. Jakub
[PR 85447] Check that clones of edges exist during IPA-CP
Hi, the details of what leads to this bug are in Bugzilla (comment 3), the basic problem is that when IPA-CP is looking for a clone of an edge it is not there because speculation resolution removed it. After conversation with Honza, he preferred this smaller local fix rather than incorporating the clone-of-callee redirection into the cgraph cloning infrastructure. He has pre-approved the patch below in person, and since it has passed bootstrap, LTO bootstrap and testing on x86_64-linux (and a lot of further testing together with the patch for PR 85449 which I am going to post in a minute), I will commit it to trunk in a few moments. Thanks, Martin 2018-04-19 Martin Jambor ipa/85447 * ipa-cp.c (create_specialized_node): Check that clones of self-recursive edges exist during IPA-CP. testsuite/ * g++.dg/ipa/pr85447.C: New file. * gcc.dg/ipa/ipcp-self-recursion-1.c: Likewise. --- gcc/ipa-cp.c | 14 ++-- gcc/testsuite/g++.dg/ipa/pr85447.C | 23 gcc/testsuite/gcc.dg/ipa/ipcp-self-recursion-1.c | 46 3 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/ipa/pr85447.C create mode 100644 gcc/testsuite/gcc.dg/ipa/ipcp-self-recursion-1.c diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 4e0e20af409..9388482bbea 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -3867,9 +3867,17 @@ create_specialized_node (struct cgraph_node *node, for (unsigned j = 0; j < self_recursive_calls.length (); j++) { cgraph_edge *cs = next_edge_clone[self_recursive_calls[j]->uid]; - gcc_checking_assert (cs); - gcc_assert (cs->caller == new_node); - cs->redirect_callee_duplicating_thunks (new_node); + /* Cloned edges can disappear during cloning as speculation can be +resolved, check that we have one and that it comes from the last +cloning. */ + if (cs && cs->caller == new_node) + cs->redirect_callee_duplicating_thunks (new_node); + /* Any future code that would make more than one clone of an outgoing +edge would confuse this mechanism, so let's check that does not +happen. */ + gcc_checking_assert (!cs + || !next_edge_clone[cs->uid] + || next_edge_clone[cs->uid]->caller != new_node); } if (have_self_recursive_calls) new_node->expand_all_artificial_thunks (); diff --git a/gcc/testsuite/g++.dg/ipa/pr85447.C b/gcc/testsuite/g++.dg/ipa/pr85447.C new file mode 100644 index 000..d7a7716af2e --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr85447.C @@ -0,0 +1,23 @@ +// { dg-do compile } +// { dg-options "-O3 -std=gnu++11" } + +typedef int a; +enum b : a; +class c { +public: + enum { d }; + virtual b e(int *, int, const int *) = 0; +}; +class f : c { + b e(int *, int, const int *); + b g(); +}; +b f::e(int *h, int i, const int *j) { + if (i == d) +return g(); + for (;;) +e(h, i, j); +} +int k; +c *l; +void m() { l->e(&k, c::d, nullptr); } diff --git a/gcc/testsuite/gcc.dg/ipa/ipcp-self-recursion-1.c b/gcc/testsuite/gcc.dg/ipa/ipcp-self-recursion-1.c new file mode 100644 index 000..7ecbf79de61 --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/ipcp-self-recursion-1.c @@ -0,0 +1,46 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -fno-early-inlining" } */ + +int array[128]; + +volatile int v = 0; +volatile int blah = 0; +volatile int counter = 0; + +int __attribute__((noipa)) +obscured_one () +{ + return 1; +} + +static void +f (int c, int l) +{ + int i; + for (i = 0; i < c; i++) +array[i] = 455; + + counter++; + if (counter > 6) +__builtin_abort (); + + v = l; + if (l > 0) +f (c, l - 1); + blah = l; +} + +int +main (int argc, char *argv[]) +{ + int i; + for (i = 0; i < 100; i++) +{ + counter = 0; + f (0, 5); + if (obscured_one ()) + break; +} + + return 0; +} -- 2.16.3
[PR 85449] Fix IPA-CP test for self-feeding recursive dependency
Hi, the issue in PR 85449 is that the code for gathering call graph edges to redirect to a new clone that identified self-recursive PASS-THROUGHs also triggered for clones of these (self recursively calling a previous clone of the same function) and redirected them too. Fixed by the patch below which moves the test to the section that deals with non-clones. The patch has been pre-approved by Honza and, on top of the fix for PR 85447, it has passed LTO bootstrap and testing on x86_64-linux, regular bootstrap and testing on x86_64-linux, i686-linux and aarch64linux. I have also used it to LTO-build all of spec 2006 and 2017 and Firefox. I am going to commit it to trunk in a few moments. Martin 2018-04-19 Martin Jambor ipa/85449 * ipa-cp.c (cgraph_edge_brings_value_p): Move check for self-feeding recursion dependency to only apply to non-clones. testsuite/ * gcc.dg/ipa/pr85449.c: New test. --- gcc/ipa-cp.c | 11 +++-- gcc/testsuite/gcc.dg/ipa/pr85449.c | 90 ++ 2 files changed, 98 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/ipa/pr85449.c diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index 9388482bbea..1b8f335fd32 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -3489,9 +3489,8 @@ cgraph_edge_brings_value_p (cgraph_edge *cs, ipcp_value_source *src, || availability <= AVAIL_INTERPOSABLE || caller_info->node_dead) return false; - /* At the moment we do not propagate over arithmetic jump functions in SCCs, - so it is safe to detect self-feeding recursive calls in this way. */ - if (!src->val || src->val == dest_val) + + if (!src->val) return true; if (caller_info->ipcp_orig_node) @@ -3506,6 +3505,12 @@ cgraph_edge_brings_value_p (cgraph_edge *cs, ipcp_value_source *src, } else { + /* At the moment we do not propagate over arithmetic jump functions in +SCCs, so it is safe to detect self-feeding recursive calls in this +way. */ + if (src->val == dest_val) + return true; + struct ipcp_agg_lattice *aglat; struct ipcp_param_lattices *plats = ipa_get_parm_lattices (caller_info, src->index); diff --git a/gcc/testsuite/gcc.dg/ipa/pr85449.c b/gcc/testsuite/gcc.dg/ipa/pr85449.c new file mode 100644 index 000..57dfce263de --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/pr85449.c @@ -0,0 +1,90 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -fno-early-inlining" } */ + +int array[128]; + +volatile int v = 0; +volatile int blah = 0; + +int __attribute__((noipa)) +obscured_zero () +{ + return 0; +} + +int __attribute__((noipa)) +obscured_one () +{ + return 1; +} + +int __attribute__((noipa)) +obscured_two () +{ + return 2; +} + +static +void cb1 (int l) +{ + v = 25; +} + +static +void cb2 (int l) +{ + v = 125; +} + +typedef void (*silly_callback)(int); + +silly_callback __attribute__((noipa)) +get_callback () +{ + return cb1; +} + +static void +f (int c, int l, silly_callback p) +{ + int i; + + for (i = 0; i < c; i++) +array[i] = 455; + + for (i = 0; i < 200; i++) +{ + p (l); + if (obscured_one ()) + break; +} + + if (l > 0) +f (c * 2, l - 1, p); + blah = l; +} + +int +main (int argc, char *argv[]) +{ + int i; + for (i = 0; i < 1000; i++) +{ + f (0, 5, get_callback ()); + if (v != 25) + __builtin_abort (); + if (obscured_one ()) + break; +} + + for (i = 0; i < 1000; i++) +{ + f (obscured_zero (), obscured_two (), cb2); + if (v != 125) + __builtin_abort (); + if (obscured_one ()) + break; +} + + return 0; +} -- 2.16.3
[PATCH] Fix PR85475
The following fixes exponential complexity with /* Reassociate (X * CST) * Y to (X * Y) * CST. This does not introduce signed overflow for CST != 0 && CST != -1. */ (simplify (mult:c (mult:s @0 INTEGER_CST@1) @2) (if (TREE_CODE (@2) != INTEGER_CST && !integer_zerop (@1) && !integer_minus_onep (@1)) (mult (mult @0 @2) @1))) when the inner multiply is present multiple times in the expression. :s doesn't protect us here because it fires too late. Maybe already bootstrapped & tested but the machine died on me so, re-bootstrapping and testing on x86_64-unknown-linux-gnu. Richard. 2018-04-20 Richard Biener PR middle-end/85475 * match.pd ((X * CST) * Y -> (X * Y) * CST): Avoid exponential complexity by forcing a single use of the multiply operand. * gcc.dg/torture/pr85475.c: New testcase. Index: gcc/match.pd === --- gcc/match.pd(revision 259515) +++ gcc/match.pd(working copy) @@ -2578,8 +2578,9 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) /* Reassociate (X * CST) * Y to (X * Y) * CST. This does not introduce signed overflow for CST != 0 && CST != -1. */ (simplify - (mult:c (mult:s @0 INTEGER_CST@1) @2) + (mult:c (mult:s@3 @0 INTEGER_CST@1) @2) (if (TREE_CODE (@2) != INTEGER_CST + && single_use (@3) && !integer_zerop (@1) && !integer_minus_onep (@1)) (mult (mult @0 @2) @1))) Index: gcc/testsuite/gcc.dg/torture/pr85475.c === --- gcc/testsuite/gcc.dg/torture/pr85475.c (nonexistent) +++ gcc/testsuite/gcc.dg/torture/pr85475.c (working copy) @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-fpeel-loops" } */ + +int +nj (int le) +{ + int zb; + + for (zb = 0; zb < 16; ++zb) +le += le; + + return le * le; +}
Re: [PATCH] Fix ICE with single element vector
On 04/18/2018 10:25 AM, Richard Biener wrote: > On Mon, Apr 16, 2018 at 6:16 PM, Andreas Krebbel > wrote: >> I did run into an ICE with a single element vector triggered by >> dividing the number of elements by 2 with exact_div here: >> >> tree-vect-data-refs.c:5132 >> >> else >> { >> /* If length is not equal to 3 then only power of 2 is supported. >> */ >> gcc_assert (pow2p_hwi (count)); >> poly_uint64 nelt = GET_MODE_NUNITS (mode); >> >> /* The encoding has 2 interleaved stepped patterns. */ >> vec_perm_builder sel (nelt, 2, 3); >> sel.quick_grow (6); >> for (i = 0; i < 3; i++) >> { >> sel[i * 2] = i; >> sel[i * 2 + 1] = i + nelt; >> } >> vec_perm_indices indices (sel, 2, nelt); >> if (can_vec_perm_const_p (mode, indices)) >> { >> for (i = 0; i < 6; i++) >> sel[i] += exact_div (nelt, 2);<- >> indices.new_vector (sel, 2, nelt); >> if (can_vec_perm_const_p (mode, indices)) >> return true; >> } >> } >> >> The patch adds a check to prevent this. > > Testcase? I had some trouble extracting a testcase since it ran into another ICE pointing towards a different problem. But I have one now and will attach it to the BZ. > What's the group size? 2 > Did it work before the poly-int stuff? Single-element vectors are > somewhat "special" - where do they appear for you? No. The testcase ICEd before poly-int as well. It triggered an ICE in LRA. See BZ. We use single element vectors for long double data types. We used to have long double hardware support before getting vector instructions. The long double values were kept in floating point register pairs and have been passed in memory for historical reasons. We wanted to changed that with z14 (arch12) where we got instructions which can handle long doubles residing in single vector registers. Since we could not change the ABI for the existing long double type we rely on V1TF for that purpose. I've opened BZ85478 to collect the infos. -Andreas- > > Richard. > >> Ok? >> >> -Andreas- >> >> gcc/ChangeLog: >> >> 2018-04-16 Andreas Krebbel >> >> * tree-vect-data-refs.c (vect_grouped_store_supported): Exit for >> single element vectors. >> --- >> gcc/tree-vect-data-refs.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c >> index 161a886..01e28ca 100644 >> --- a/gcc/tree-vect-data-refs.c >> +++ b/gcc/tree-vect-data-refs.c >> @@ -5135,6 +5135,9 @@ vect_grouped_store_supported (tree vectype, unsigned >> HOST_WIDE_INT count) >> gcc_assert (pow2p_hwi (count)); >> poly_uint64 nelt = GET_MODE_NUNITS (mode); >> >> + if (maybe_eq (nelt, 1U)) >> + return false; >> + >> /* The encoding has 2 interleaved stepped patterns. */ >> vec_perm_builder sel (nelt, 2, 3); >> sel.quick_grow (6); >> -- >> 2.9.1 >> >
Re: [PATCH] Fix ICE with single element vector
On Fri, Apr 20, 2018 at 11:05 AM, Andreas Krebbel wrote: > On 04/18/2018 10:25 AM, Richard Biener wrote: >> On Mon, Apr 16, 2018 at 6:16 PM, Andreas Krebbel >> wrote: >>> I did run into an ICE with a single element vector triggered by >>> dividing the number of elements by 2 with exact_div here: >>> >>> tree-vect-data-refs.c:5132 >>> >>> else >>> { >>> /* If length is not equal to 3 then only power of 2 is supported. >>> */ >>> gcc_assert (pow2p_hwi (count)); >>> poly_uint64 nelt = GET_MODE_NUNITS (mode); >>> >>> /* The encoding has 2 interleaved stepped patterns. */ >>> vec_perm_builder sel (nelt, 2, 3); >>> sel.quick_grow (6); >>> for (i = 0; i < 3; i++) >>> { >>> sel[i * 2] = i; >>> sel[i * 2 + 1] = i + nelt; >>> } >>> vec_perm_indices indices (sel, 2, nelt); >>> if (can_vec_perm_const_p (mode, indices)) >>> { >>> for (i = 0; i < 6; i++) >>> sel[i] += exact_div (nelt, 2);<- >>> indices.new_vector (sel, 2, nelt); >>> if (can_vec_perm_const_p (mode, indices)) >>> return true; >>> } >>> } >>> >>> The patch adds a check to prevent this. >> >> Testcase? > > I had some trouble extracting a testcase since it ran into another ICE > pointing towards a different > problem. But I have one now and will attach it to the BZ. > >> What's the group size? > 2 > >> Did it work before the poly-int stuff? Single-element vectors are >> somewhat "special" - where do they appear for you? > > No. The testcase ICEd before poly-int as well. It triggered an ICE in LRA. > See BZ. > > We use single element vectors for long double data types. We used to have > long double hardware > support before getting vector instructions. The long double values were kept > in floating point > register pairs and have been passed in memory for historical reasons. We > wanted to changed that with > z14 (arch12) where we got instructions which can handle long doubles residing > in single vector > registers. Since we could not change the ABI for the existing long double > type we rely on V1TF for > that purpose. I see. I remember patches from last year from James(?) running into various issues with the backend exposing V1mode vectors and actually wanting to allow them for vectorization. We now do that which might cause these kind of problems. > I've opened BZ85478 to collect the infos. I'll try to have a look. Richard. > > -Andreas- > >> >> Richard. >> >>> Ok? >>> >>> -Andreas- >>> >>> gcc/ChangeLog: >>> >>> 2018-04-16 Andreas Krebbel >>> >>> * tree-vect-data-refs.c (vect_grouped_store_supported): Exit for >>> single element vectors. >>> --- >>> gcc/tree-vect-data-refs.c | 3 +++ >>> 1 file changed, 3 insertions(+) >>> >>> diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c >>> index 161a886..01e28ca 100644 >>> --- a/gcc/tree-vect-data-refs.c >>> +++ b/gcc/tree-vect-data-refs.c >>> @@ -5135,6 +5135,9 @@ vect_grouped_store_supported (tree vectype, unsigned >>> HOST_WIDE_INT count) >>> gcc_assert (pow2p_hwi (count)); >>> poly_uint64 nelt = GET_MODE_NUNITS (mode); >>> >>> + if (maybe_eq (nelt, 1U)) >>> + return false; >>> + >>> /* The encoding has 2 interleaved stepped patterns. */ >>> vec_perm_builder sel (nelt, 2, 3); >>> sel.quick_grow (6); >>> -- >>> 2.9.1 >>> >> >
[PATCH] Do not overflow string buffer (PR objc/85476).
Hi. Quite obvious package that causes an ASAN error described in the PR. Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. Ready to be installed? Martin gcc/objc/ChangeLog: 2018-04-20 Martin Liska PR objc/85476 * objc-act.c (finish_class): Do not overflow string buffer. --- gcc/objc/objc-act.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index b87f7cc075e..d08693051ea 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -8003,7 +8003,7 @@ finish_class (tree klass) char *setter_name = (char *) alloca (length); tree ret_type, selector, arg_type, arg_name; - strcpy (setter_name, full_setter_name); + memcpy (setter_name, full_setter_name, length - 1); setter_name[length - 1] = '\0'; ret_type = build_tree_list (NULL_TREE, void_type_node); arg_type = build_tree_list (NULL_TREE, TREE_TYPE (x));
Re: [PATCH] Do not overflow string buffer (PR objc/85476).
On Fri, Apr 20, 2018 at 11:44 AM, Martin Liška wrote: > Hi. > > Quite obvious package that causes an ASAN error described in the PR. > > Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. > > Ready to be installed? Ok. Richard. > Martin > > gcc/objc/ChangeLog: > > 2018-04-20 Martin Liska > > PR objc/85476 > * objc-act.c (finish_class): Do not overflow string buffer. > --- > gcc/objc/objc-act.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >
Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs
On Fri, Apr 20, 2018 at 09:39:58AM +0200, Jakub Jelinek wrote: > On Fri, Apr 20, 2018 at 06:25:10AM +, Tsimbalist, Igor V wrote: > > > Something like this? > > > > Shouldn't this > > > > -# ifdef __IBT__ > > +# if (__CET__ & 1) != 0 > > > > Be as > > > > -# ifdef __IBT__ > > +#ifdef __CET__ > > +# if (__CET__ & 1) != 0 > > > > OK otherwise. > > Only if you use -Wundef warning (not part of -Wall or -W) and, if this > is a system header, only with -Wundef -Wsystem-headers. > But perhaps it doesn't hurt to wrap it. > > Jakub Here is the patch. OK for trunk? Thanks. H.J. --- With revision 259496: commit b1384095a7c1d06a44b70853372ebe037b2f7867 Author: hjl Date: Thu Apr 19 15:15:04 2018 + x86: Enable -fcf-protection with multi-byte NOPs -mibt does nothing and can be removed. Define __CET__ to indicate level protection with -fcf-protection: (__CET__ & 1) != 0: -fcf-protection=branch or -fcf-protection=full (__CET__ & 2) != 0: -fcf-protection=return or -fcf-protection=full gcc/ PR target/85469 * common/config/i386/i386-common.c (OPTION_MASK_ISA_IBT_SET): Removed. (OPTION_MASK_ISA_IBT_UNSET): Likewise. (ix86_handle_option): Don't handle OPT_mibt. * config/i386/cet.h: Check __CET__ instead of __IBT__ and __SHSTK__. * config/i386/driver-i386.c (host_detect_local_cpu): Remove has_ibt and ibt. * config/i386/i386-c.c (ix86_target_macros_internal): Don't check OPTION_MASK_ISA_IBT nor flag_cf_protection. (ix86_target_macros): Define __CET__ with flag_cf_protection for -fcf-protection. * config/i386/i386.c (isa2_opts): Remove -mibt. * config/i386/i386.h (TARGET_IBT): Removed. (TARGET_IBT_P): Likewise. (ix86_valid_target_attribute_inner_p): Don't check OPT_mibt. * config/i386/i386.md (nop_endbr): Don't check TARGET_IBT. * config/i386/i386.opt (mcet): Update help message. (mshstk): Likewise. (mibt): Removed. * doc/invoke.texi: Remove -mibt. Document __CET__. Document -mcet as an alias for -mshstk. gcc/testsuite/ PR target/85469 * gcc.target/i386/pr85044.c (dg-options): Remove -mibt. * gcc.target/i386/sse-26.c (dg-options): Remove -mno-ibt. --- gcc/common/config/i386/i386-common.c| 17 - gcc/config/i386/cet.h | 6 +++--- gcc/config/i386/driver-i386.c | 6 ++ gcc/config/i386/i386-c.c| 20 ++-- gcc/config/i386/i386.c | 2 -- gcc/config/i386/i386.h | 2 -- gcc/config/i386/i386.md | 2 +- gcc/config/i386/i386.opt| 12 gcc/doc/invoke.texi | 28 +++- gcc/testsuite/gcc.target/i386/pr85044.c | 2 +- gcc/testsuite/gcc.target/i386/sse-26.c | 2 +- 11 files changed, 29 insertions(+), 70 deletions(-) diff --git a/gcc/common/config/i386/i386-common.c b/gcc/common/config/i386/i386-common.c index 0bb2783cfab..74a3490f7a3 100644 --- a/gcc/common/config/i386/i386-common.c +++ b/gcc/common/config/i386/i386-common.c @@ -147,7 +147,6 @@ along with GCC; see the file COPYING3. If not see #define OPTION_MASK_ISA_PKU_SET OPTION_MASK_ISA_PKU #define OPTION_MASK_ISA_RDPID_SET OPTION_MASK_ISA_RDPID #define OPTION_MASK_ISA_GFNI_SET OPTION_MASK_ISA_GFNI -#define OPTION_MASK_ISA_IBT_SET OPTION_MASK_ISA_IBT #define OPTION_MASK_ISA_SHSTK_SET OPTION_MASK_ISA_SHSTK #define OPTION_MASK_ISA_VAES_SET OPTION_MASK_ISA_VAES #define OPTION_MASK_ISA_VPCLMULQDQ_SET OPTION_MASK_ISA_VPCLMULQDQ @@ -224,7 +223,6 @@ along with GCC; see the file COPYING3. If not see #define OPTION_MASK_ISA_PKU_UNSET OPTION_MASK_ISA_PKU #define OPTION_MASK_ISA_RDPID_UNSET OPTION_MASK_ISA_RDPID #define OPTION_MASK_ISA_GFNI_UNSET OPTION_MASK_ISA_GFNI -#define OPTION_MASK_ISA_IBT_UNSET OPTION_MASK_ISA_IBT #define OPTION_MASK_ISA_SHSTK_UNSET OPTION_MASK_ISA_SHSTK #define OPTION_MASK_ISA_VAES_UNSET OPTION_MASK_ISA_VAES #define OPTION_MASK_ISA_VPCLMULQDQ_UNSET OPTION_MASK_ISA_VPCLMULQDQ @@ -546,21 +544,6 @@ ix86_handle_option (struct gcc_options *opts, return true; case OPT_mcet: -case OPT_mibt: - if (value) - { - opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA_IBT_SET; - opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA_IBT_SET; - } - else - { - opts->x_ix86_isa_flags2 &= ~OPTION_MASK_ISA_IBT_UNSET; - opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA_IBT_UNSET; - } - if (code != OPT_mcet) - return true; - /* fall through. */ - case OPT_mshstk: if (value) { diff --git a/gcc/config/i386/cet.h b/gcc/config/i386/cet.h index 9dca41bad2d..309f6428735 100644 --- a/gcc/config/i386/cet.h +++ b/gcc/config/i386/cet.h @@ -32,7 +32,7 @@ #ifdef __ASSEMBLER__ -# ifdef __IBT__ +# if defined __CET__ && (__CET__ & 1
RE: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs
> -Original Message- > From: H.J. Lu [mailto:hjl.to...@gmail.com] > Sent: Friday, April 20, 2018 1:15 PM > To: Jakub Jelinek > Cc: Tsimbalist, Igor V ; Richard Biener > ; Uros Bizjak ; gcc- > patc...@gcc.gnu.org > Subject: Re: [PATCH] x86: Allow -fcf-protection with multi-byte NOPs > > On Fri, Apr 20, 2018 at 09:39:58AM +0200, Jakub Jelinek wrote: > > On Fri, Apr 20, 2018 at 06:25:10AM +, Tsimbalist, Igor V wrote: > > > > Something like this? > > > > > > Shouldn't this > > > > > > -# ifdef __IBT__ > > > +# if (__CET__ & 1) != 0 > > > > > > Be as > > > > > > -# ifdef __IBT__ > > > +#ifdef __CET__ > > > +# if (__CET__ & 1) != 0 > > > > > > OK otherwise. > > > > Only if you use -Wundef warning (not part of -Wall or -W) and, if this > > is a system header, only with -Wundef -Wsystem-headers. > > But perhaps it doesn't hurt to wrap it. > > > > Jakub > > Here is the patch. OK for trunk? > > Thanks. OK. Igor > > H.J. > --- > With revision 259496: > > commit b1384095a7c1d06a44b70853372ebe037b2f7867 > Author: hjl > Date: Thu Apr 19 15:15:04 2018 + > > x86: Enable -fcf-protection with multi-byte NOPs > > -mibt does nothing and can be removed. Define __CET__ to indicate level > protection with -fcf-protection: > > (__CET__ & 1) != 0: -fcf-protection=branch or -fcf-protection=full > (__CET__ & 2) != 0: -fcf-protection=return or -fcf-protection=full > > gcc/ > > PR target/85469 > * common/config/i386/i386-common.c > (OPTION_MASK_ISA_IBT_SET): > Removed. > (OPTION_MASK_ISA_IBT_UNSET): Likewise. > (ix86_handle_option): Don't handle OPT_mibt. > * config/i386/cet.h: Check __CET__ instead of __IBT__ and > __SHSTK__. > * config/i386/driver-i386.c (host_detect_local_cpu): Remove > has_ibt and ibt. > * config/i386/i386-c.c (ix86_target_macros_internal): Don't > check OPTION_MASK_ISA_IBT nor flag_cf_protection. > (ix86_target_macros): Define __CET__ with flag_cf_protection > for -fcf-protection. > * config/i386/i386.c (isa2_opts): Remove -mibt. > * config/i386/i386.h (TARGET_IBT): Removed. > (TARGET_IBT_P): Likewise. > (ix86_valid_target_attribute_inner_p): Don't check OPT_mibt. > * config/i386/i386.md (nop_endbr): Don't check TARGET_IBT. > * config/i386/i386.opt (mcet): Update help message. > (mshstk): Likewise. > (mibt): Removed. > * doc/invoke.texi: Remove -mibt. Document __CET__. Document > -mcet as an alias for -mshstk. > > gcc/testsuite/ > > PR target/85469 > * gcc.target/i386/pr85044.c (dg-options): Remove -mibt. > * gcc.target/i386/sse-26.c (dg-options): Remove -mno-ibt. > --- > gcc/common/config/i386/i386-common.c| 17 - > gcc/config/i386/cet.h | 6 +++--- > gcc/config/i386/driver-i386.c | 6 ++ > gcc/config/i386/i386-c.c| 20 ++-- > gcc/config/i386/i386.c | 2 -- > gcc/config/i386/i386.h | 2 -- > gcc/config/i386/i386.md | 2 +- > gcc/config/i386/i386.opt| 12 > gcc/doc/invoke.texi | 28 +++- > gcc/testsuite/gcc.target/i386/pr85044.c | 2 +- > gcc/testsuite/gcc.target/i386/sse-26.c | 2 +- > 11 files changed, 29 insertions(+), 70 deletions(-) > > diff --git a/gcc/common/config/i386/i386-common.c > b/gcc/common/config/i386/i386-common.c > index 0bb2783cfab..74a3490f7a3 100644 > --- a/gcc/common/config/i386/i386-common.c > +++ b/gcc/common/config/i386/i386-common.c > @@ -147,7 +147,6 @@ along with GCC; see the file COPYING3. If not see > #define OPTION_MASK_ISA_PKU_SET OPTION_MASK_ISA_PKU > #define OPTION_MASK_ISA_RDPID_SET OPTION_MASK_ISA_RDPID > #define OPTION_MASK_ISA_GFNI_SET OPTION_MASK_ISA_GFNI > -#define OPTION_MASK_ISA_IBT_SET OPTION_MASK_ISA_IBT > #define OPTION_MASK_ISA_SHSTK_SET OPTION_MASK_ISA_SHSTK > #define OPTION_MASK_ISA_VAES_SET OPTION_MASK_ISA_VAES > #define OPTION_MASK_ISA_VPCLMULQDQ_SET > OPTION_MASK_ISA_VPCLMULQDQ > @@ -224,7 +223,6 @@ along with GCC; see the file COPYING3. If not see > #define OPTION_MASK_ISA_PKU_UNSET OPTION_MASK_ISA_PKU > #define OPTION_MASK_ISA_RDPID_UNSET OPTION_MASK_ISA_RDPID > #define OPTION_MASK_ISA_GFNI_UNSET OPTION_MASK_ISA_GFNI > -#define OPTION_MASK_ISA_IBT_UNSET OPTION_MASK_ISA_IBT > #define OPTION_MASK_ISA_SHSTK_UNSET OPTION_MASK_ISA_SHSTK > #define OPTION_MASK_ISA_VAES_UNSET OPTION_MASK_ISA_VAES > #define OPTION_MASK_ISA_VPCLMULQDQ_UNSET > OPTION_MASK_ISA_VPCLMULQDQ > @@ -546,21 +544,6 @@ ix86_handle_option (struct gcc_options *opts, >return true; > > case OPT_mcet: > -case OPT_mibt: > - if (value) > - { > - opts->x_ix86_isa_flags2 |= OPTION_MASK_ISA_IBT_SET; > - opts->x_ix86_isa_flags2_explicit |= OPTION_MASK_ISA_IBT_SET; > - } > - else > - { > - opts->x_ix86_isa_flags2 &= ~OPTION_MAS
[nvptx, PR85445, committed] Fix calls to vector and worker routines
Hi, Consider this test-case (minimized from the test-case in the patch): ... #pragma acc routine vector static void __attribute__((always_inline)) Vector (int *ptr, int n, const int &inc) { #pragma acc loop vector for (unsigned ix = 0; ix < n; ix++) ptr[ix] += inc; } #pragma acc routine worker void __attribute__((noinline, noclone)) Worker (int *ptr, int m, int n, const int &inc) { #pragma acc loop worker for (unsigned ix = 0; ix < m; ix++) Vector(ptr + ix * n, n, inc); } int main (void) { const int n = 32, m = 32; int ary[m][n]; unsigned ix, iy; #pragma acc parallel copy(ary) Worker (&ary[0][0], m, n, 1 << 16); return 0; } ... The inc parameter is a reference parameter, so the argument 1<<16 (65536) is saved on stack: ... mov.u32 %r25, 65536; st.u32 [%frame], %r25; ... and the address is passed as argument: ... .param.u64 %out_arg4; st.param.u64 [%out_arg4], %frame; call _Z6WorkerPiiiRKi, (%out_arg1, %out_arg2, %out_arg3, %out_arg4); ... The stack is declared with .local: ... .local .align 16 .b8 %frame_ar[16]; .reg.u64 %frame; cvta.local.u64 %frame, %frame_ar; ... which in ptx means: ... Local memory, private to each thread. ... The initialization of the stack is done in thread W0V0, but the stack is read in WAVA mode, so it's reading uninitialized stack memory in all but the W0V0 thread. The patch (r239736 in og7) fixes this by broadcasting the stack from W0V0 to WAVA before the call. Build x86_64 with nvptx accelerator and reg-tested libgomp. Committed to stage4 trunk. Thanks, - Tom [nvptx] Fix calls to vector and worker routines 2019-04-20 Nathan Sidwell Tom de Vries PR target/85445 * config/nvptx/nvptx.c (nvptx_emit_forking, nvptx_emit_joining): Emit insns for calls too. (nvptx_find_par): Always look for worker-level predecessor insn. (nvptx_propagate): Add is_call parm, return bool. Copy frame for calls. (nvptx_vpropagate, nvptx_wpropagate): Adjust. (nvptx_process_pars): Propagate frames for calls. * testsuite/libgomp.oacc-c++/ref-1.C: New. --- gcc/config/nvptx/nvptx.c | 106 - libgomp/testsuite/libgomp.oacc-c++/ref-1.C | 78 + 2 files changed, 138 insertions(+), 46 deletions(-) diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index 131b495..ca3fea3 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -399,8 +399,7 @@ nvptx_emit_forking (unsigned mask, bool is_call) it creates a block with a single successor before entering a partitooned region. That is a good candidate for the end of an SESE region. */ - if (!is_call) - emit_insn (gen_nvptx_fork (op)); + emit_insn (gen_nvptx_fork (op)); emit_insn (gen_nvptx_forked (op)); } } @@ -419,8 +418,7 @@ nvptx_emit_joining (unsigned mask, bool is_call) /* Emit joining for all non-call pars to ensure there's a single predecessor for the block the join insn ends up in. This is needed for skipping entire loops. */ - if (!is_call) - emit_insn (gen_nvptx_joining (op)); + emit_insn (gen_nvptx_joining (op)); emit_insn (gen_nvptx_join (op)); } } @@ -3086,8 +3084,7 @@ nvptx_find_par (bb_insn_map_t *map, parallel *par, basic_block block) par = new parallel (par, mask); par->forked_block = block; par->forked_insn = end; - if (!(mask & GOMP_DIM_MASK (GOMP_DIM_MAX)) - && (mask & GOMP_DIM_MASK (GOMP_DIM_WORKER))) + if (mask & GOMP_DIM_MASK (GOMP_DIM_WORKER)) par->fork_insn = nvptx_discover_pre (block, CODE_FOR_nvptx_fork); } @@ -3102,8 +3099,7 @@ nvptx_find_par (bb_insn_map_t *map, parallel *par, basic_block block) gcc_assert (par->mask == mask); par->join_block = block; par->join_insn = end; - if (!(mask & GOMP_DIM_MASK (GOMP_DIM_MAX)) - && (mask & GOMP_DIM_MASK (GOMP_DIM_WORKER))) + if (mask & GOMP_DIM_MASK (GOMP_DIM_WORKER)) par->joining_insn = nvptx_discover_pre (block, CODE_FOR_nvptx_joining); par = par->parent; @@ -3782,29 +3778,34 @@ nvptx_find_sese (auto_vec &blocks, bb_pair_vec_t ®ions) #undef BB_SET_SESE #undef BB_GET_SESE -/* Propagate live state at the start of a partitioned region. BLOCK - provides the live register information, and might not contain - INSN. Propagation is inserted just after INSN. RW indicates whether - we are reading and/or writing state. This +/* Propagate live state at the start of a partitioned region. IS_CALL + indicates whether the propagation is for a (partitioned) call + instruction. BLOCK provides the live register information, and + might not contain INSN. Propagation is inserted just after INSN. RW + indicates whether we are reading and/or writing state. This separation is needed for worker-level proppagation where we essentially do a spill & fill. FN is the und
Re: [PATCH] [PR c++/85437] accept static_casted ptrmem in constexpr
On 04/18/2018 01:07 AM, Jason Merrill wrote: I wonder if it would work to use CONVERT_EXPR for reinterpret_cast. That's kind of the wrong way round, isn't it? NOP_EXPRs are for things that don't generate code, which a reinterpret_cast is. static_cast adds a constant, which is only zero for conversions through the primary base (or suitably placed empty base). CONVERT_EXPR would seem more natural there? nathan -- Nathan Sidwell
Re: [PATCH, rs6000] Fix PR83969: ICE in final_scan_insn, at final.c:2997
On 4/19/18 5:40 PM, Segher Boessenkool wrote: > On Thu, Apr 19, 2018 at 01:23:51PM -0500, Peter Bergner wrote: >> On 3/9/18 4:25 PM, Peter Bergner wrote: >>> Technically, it is broken there too, but until trunk, we never really >>> generated the altivec mems that trigger this bug, so I think I would >>> lean towards just having this on trunk and if someone, somehow hits >>> it, then we can back port it then. >> >> So as we talked offline, the go test case in PR85436 is fixed by this >> patch, so I have back ported it and am bootstrapping and regtesting it. >> Is it ok for GCC 7 if the testing comes back clean? > > Certainly, thanks. Is it needed for GCC 6 as well? Okay for that too, > if so. Ok, the following is what I ended up committing. Thanks. Neither test case fails on GCC 6, but I haven't tested on BE which is where the PR83969 test case was failing (-m32 BE). I'll do a build on BE and verify whether the tests compile there or not. If they PASS, I'd probably just leave it alone until someone comes up with a test case that FAILs on GCC 6 before back porting it. Peter gcc/ Backport from mainline 2018-03-09 Peter Bergner PR target/83969 * config/rs6000/rs6000.c (rs6000_offsettable_memref_p): New prototype. Add strict argument and use it. (rs6000_split_multireg_move): Update for new strict argument. (mem_operand_gpr): Disallow all non-offsettable addresses. * config/rs6000/rs6000.md (*movdi_internal64): Use YZ constraint. gcc/testsuite/ PR target/85436 * go.dg/pr85436.go: New test. Backport from mainline 2018-03-09 Peter Bergner PR target/83969 * gcc.target/powerpc/pr83969.c: New test. Index: gcc/config/rs6000/rs6000.c === --- gcc/config/rs6000/rs6000.c (revision 259519) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -1372,6 +1372,7 @@ static rtx rs6000_debug_legitimize_reloa int, int, int *); static bool rs6000_mode_dependent_address (const_rtx); static bool rs6000_debug_mode_dependent_address (const_rtx); +static bool rs6000_offsettable_memref_p (rtx, machine_mode, bool); static enum reg_class rs6000_secondary_reload_class (enum reg_class, machine_mode, rtx); static enum reg_class rs6000_debug_secondary_reload_class (enum reg_class, @@ -8564,10 +8565,8 @@ mem_operand_gpr (rtx op, machine_mode mo int extra; rtx addr = XEXP (op, 0); - /* Don't allow altivec type addresses like (mem (and (plus ...))). - See PR target/84279. */ - - if (GET_CODE (addr) == AND) + /* Don't allow non-offsettable addresses. See PRs 83969 and 84279. */ + if (!rs6000_offsettable_memref_p (op, mode, false)) return false; op = address_offset (addr); @@ -10340,7 +10339,7 @@ rs6000_find_base_term (rtx op) in 32-bit mode, that the recog predicate rejects. */ static bool -rs6000_offsettable_memref_p (rtx op, machine_mode reg_mode) +rs6000_offsettable_memref_p (rtx op, machine_mode reg_mode, bool strict) { bool worst_case; @@ -10348,7 +10347,7 @@ rs6000_offsettable_memref_p (rtx op, mac return false; /* First mimic offsettable_memref_p. */ - if (offsettable_address_p (true, GET_MODE (op), XEXP (op, 0))) + if (offsettable_address_p (strict, GET_MODE (op), XEXP (op, 0))) return true; /* offsettable_address_p invokes rs6000_mode_dependent_address, but @@ -10362,7 +10361,7 @@ rs6000_offsettable_memref_p (rtx op, mac worst_case = ((TARGET_POWERPC64 && GET_MODE_CLASS (reg_mode) == MODE_INT) || GET_MODE_SIZE (reg_mode) == 4); return rs6000_legitimate_offset_address_p (GET_MODE (op), XEXP (op, 0), -true, worst_case); +strict, worst_case); } /* Determine the reassociation width to be used in reassociate_bb. @@ -26559,7 +26558,7 @@ rs6000_split_multireg_move (rtx dst, rtx emit_insn (gen_add3_insn (breg, breg, delta_rtx)); src = replace_equiv_address (src, breg); } - else if (! rs6000_offsettable_memref_p (src, reg_mode)) + else if (! rs6000_offsettable_memref_p (src, reg_mode, true)) { if (GET_CODE (XEXP (src, 0)) == PRE_MODIFY) { @@ -26626,7 +26625,7 @@ rs6000_split_multireg_move (rtx dst, rtx emit_insn (gen_add3_insn (breg, breg, delta_rtx)); dst = replace_equiv_address (dst, breg); } - else if (!rs6000_offsettable_memref_p (dst, reg_mode) + else if (!rs6000_offsettable_memref_p (dst, reg_mode, true) && GET_CODE (XEXP (dst, 0)) != LO_SUM) { if (GET_CODE (XEXP (dst, 0)) == PRE_MODIFY) @@ -26665,7 +26664,7 @@ rs6000_split_multireg_move (rtx dst, rtx }
Re: [PATCH, rs6000] Fix PR83969: ICE in final_scan_insn, at final.c:2997
On 4/20/18 9:34 AM, Peter Bergner wrote: > Neither test case fails on GCC 6, but I haven't tested on BE which is > where the PR83969 test case was failing (-m32 BE). I'll do a build on > BE and verify whether the tests compile there or not. If they PASS, > I'd probably just leave it alone until someone comes up with a test > case that FAILs on GCC 6 before back porting it. OK, GCC 6 on BE doesn't ICE on either test case, so I'm going to just leave things as they are there. We can always back port the fixes later if someone comes up with yet another test case that fails there. Peter
Re: [PATCH] PR target/85456, Fix __builtin_powil for -mabi=ieeelongdouble on PowerPC
Hi Mike, On Thu, Apr 19, 2018 at 12:33:45AM -0400, Michael Meissner wrote: > This patch adds __powikf2 to libgcc, and makes GCC use it for __builtin_powil > when long double is IEEE 128-bit (-mabi=ieeelongdouble). > > I tested it on a little endian power8 system with a bootstrap compiler. There > were no regresion failures. Can I check this into GCC 8? This does not need > to be checked into GCC 7, since -mabi=ieeelongdouble was not fully supported > in > that release. > [libgcc] > 2018-04-18 Michael Meissner > > PR target/85456 > * config/rs6000/_powikf2.c: New file. Entry point for > __builtin_powil when -mabi=ieeelongdouble is in effect. > * config/rs6000/float128-ifunc.c (__powikf2_resolve): Add > __powikf2 support. > (__powikf2): Likewise. > * config/rs6000/quad-float128.h (__powikf2_sw): Likewise. > (__powikf2_hw): Likewise. > (__powikf2): Likewise. > * config/rs6000/t-float128 (fp128_ppc_funcs): Likewise. > * config/rs6000/t-float128-hw (fp128_hw_func): Likewise. > (_powikf2-hw.c): Likewise. This changelog does not make too much sense ("__powikf2: Add __powikf2 support." does not really say what it does, for example). Does the leading underscore in the filename have any meaning? The kc files have one, too, but everything else does not. > +#if defined(FLOAT128_HW_INSNS) && !defined(__powikf2) > +#define __powikf2 __powikf2_sw > +#endif This could use a comment (it seems the wrong way around if you don't see how it is built). > +TFtype > +__powikf2 (TFtype x, SItype_ppc m) > +{ > + unsigned int n = m < 0 ? -m : m; > + TFtype y = n % 2 ? x : 1; > + while (n >>= 1) > +{ > + x = x * x; > + if (n % 2) > + y = y * x; > +} > + return m < 0 ? 1/y : y; > +} This work correctly for the most negative integer. Okay. Okay for trunk. Thanks! Segher
Re: [PATCH] Do not overflow string buffer (PR objc/85476).
On 04/20/2018 03:44 AM, Martin Liška wrote: Hi. Quite obvious package that causes an ASAN error described in the PR. Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. As an aside, I went and looked at the rest of code to see if the overflow could be detected at compile time and if it could be why it's not. Here's what the code boils down to: void f (char*); void g (const char *s) { unsigned n = strlen (s); char *d = alloca (n); strcpy (d, s); f (d); } Even though the off-by-one error is obvious it's not detected either with _FORTIFY_SOURCE or without. Both fail because compute_builtin_object_size() only detects constant sizes. But the strlen pass tracks both the size of allocations and the lengths of even non-constant strings (computed by strlen) so detecting the overflow there should be straightforward. In the test case above the pass sees the following: _1 = __builtin_strlen (s_4(D)); _9 = _1 & 4294967295; d_6 = __builtin_alloca (_9); __builtin_strcpy (d_6, s_4(D)); I've raised bug 85484 to try to implement this in GCC 9. (Another way to handle this would be to enhance builtin-object size to track non-constant sizes but that would require bigger changes). Martin Ready to be installed? Martin gcc/objc/ChangeLog: 2018-04-20 Martin Liska PR objc/85476 * objc-act.c (finish_class): Do not overflow string buffer. --- gcc/objc/objc-act.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PR testsuite/85483: Move aarch64/sve/vcond_1.c test to g++.dg/other/
Hi all, I totally botched up this sve test file in 259437. It needs C++, so move it to g++.dg/other and make it a .C file. Also adds the target guards to prevent it from running on non-aarch64 targets. Tested that it passes on aarch64-none-elf and doesn't get run on arm-none-eabi. Committing to trunk as obvious. Sorry for the snafu, Kyrill 2018-04-20 Kyrylo Tkachov PR testsuite/85483 * gcc.target/aarch64/sve/vcond_1.c: Move to... * g++.dg/other/sve_vcond_1.C: ... Here. Add target directives. * gcc.target/aarch64/sve/vcond_1_run.c: Move to... * g++.dg/other/sve_vcond_1_run.C: ... Here. Change include file name. commit f32cc4052354bc7efe12a41a0ce17df7644fcf4b Author: Kyrylo Tkachov Date: Fri Apr 20 17:13:10 2018 +0100 PR testsuite/85483: Move aarch64/sve/vcond_1.c test to g++.dg/other/ diff --git a/gcc/testsuite/g++.dg/other/sve_vcond_1.C b/gcc/testsuite/g++.dg/other/sve_vcond_1.C new file mode 100644 index 000..c1ad0b9 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/sve_vcond_1.C @@ -0,0 +1,243 @@ +/* { dg-do assemble { target { aarch64_asm_sve_ok && { ! ilp32 } } } } */ +/* { dg-options "-march=armv8.2-a+sve -O -msve-vector-bits=256 --save-temps" } */ + +typedef __INT8_TYPE__ vnx16qi __attribute__((vector_size(32))); +typedef __INT16_TYPE__ vnx8hi __attribute__((vector_size(32))); +typedef __INT32_TYPE__ vnx4si __attribute__((vector_size(32))); +typedef __INT64_TYPE__ vnx2di __attribute__((vector_size(32))); + +typedef __UINT8_TYPE__ v32qu __attribute__((vector_size(32))); +typedef __UINT16_TYPE__ v16hu __attribute__((vector_size(32))); +typedef __UINT32_TYPE__ v8su __attribute__((vector_size(32))); +typedef __UINT64_TYPE__ v4du __attribute__((vector_size(32))); + +#define DEF_VCOND_VAR(TYPE, COND, SUFFIX) \ +TYPE vcond_##TYPE##_##SUFFIX (TYPE x, TYPE y, TYPE a, TYPE b) \ +{\ + TYPE r; \ + r = a COND b ? x : y; \ + return r; \ +} + +#define DEF_VCOND_IMM(TYPE, COND, IMM, SUFFIX) \ +TYPE vcond_imm_##TYPE##_##SUFFIX (TYPE x, TYPE y, TYPE a) \ +{\ + TYPE r; \ + r = a COND IMM ? x : y; \ + return r; \ +} + +#define TEST_COND_VAR_SIGNED_ALL(T, COND, SUFFIX) \ + T (vnx16qi, COND, SUFFIX)\ + T (vnx8hi, COND, SUFFIX)\ + T (vnx4si, COND, SUFFIX)\ + T (vnx2di, COND, SUFFIX) + +#define TEST_COND_VAR_UNSIGNED_ALL(T, COND, SUFFIX) \ + T (v32qu, COND, SUFFIX)\ + T (v16hu, COND, SUFFIX)\ + T (v8su, COND, SUFFIX)\ + T (v4du, COND, SUFFIX) + +#define TEST_COND_VAR_ALL(T, COND, SUFFIX) \ + TEST_COND_VAR_SIGNED_ALL (T, COND, SUFFIX) \ + TEST_COND_VAR_UNSIGNED_ALL (T, COND, SUFFIX) + +#define TEST_VAR_ALL(T)\ + TEST_COND_VAR_ALL (T, >, gt) \ + TEST_COND_VAR_ALL (T, <, lt) \ + TEST_COND_VAR_ALL (T, >=, ge) \ + TEST_COND_VAR_ALL (T, <=, le) \ + TEST_COND_VAR_ALL (T, ==, eq) \ + TEST_COND_VAR_ALL (T, !=, ne) + +#define TEST_COND_IMM_SIGNED_ALL(T, COND, IMM, SUFFIX) \ + T (vnx16qi, COND, IMM, SUFFIX)\ + T (vnx8hi, COND, IMM, SUFFIX)\ + T (vnx4si, COND, IMM, SUFFIX)\ + T (vnx2di, COND, IMM, SUFFIX) + +#define TEST_COND_IMM_UNSIGNED_ALL(T, COND, IMM, SUFFIX) \ + T (v32qu, COND, IMM, SUFFIX) \ + T (v16hu, COND, IMM, SUFFIX) \ + T (v8su, COND, IMM, SUFFIX) \ + T (v4du, COND, IMM, SUFFIX) + +#define TEST_COND_IMM_ALL(T, COND, IMM, SUFFIX) \ + TEST_COND_IMM_SIGNED_ALL (T, COND, IMM, SUFFIX) \ + TEST_COND_IMM_UNSIGNED_ALL (T, COND, IMM, SUFFIX) + +#define TEST_IMM_ALL(T) \ + /* Expect immediates to make it into the encoding. */ \ + TEST_COND_IMM_ALL (T, >, 5, gt) \ + TEST_COND_IMM_ALL (T, <, 5, lt) \ + TEST_COND_IMM_ALL (T, >=, 5, ge) \ + TEST_COND_IMM_ALL (T, <=, 5, le) \ + TEST_COND_IMM_ALL (T, ==, 5, eq) \ + TEST_COND_IMM_ALL (T, !=, 5, ne) \ + \ + TEST_COND_IMM_SIGNED_ALL (T, >, 15, gt2)\ + TEST_COND_IMM_SIGNED_ALL (T, <, 15, lt2)\ + TEST_COND_IMM_SIGNED_ALL (T, >=, 15, ge2)\ + TEST_COND_IMM_SIGNED_ALL (T, <=, 15, le2)\ + TEST_COND_IMM_SIGNED_ALL (T, ==, 15, eq2)\ + TEST_COND_IMM_SIGNED_ALL (T, !=, 15, ne2)\ + \ + TEST_COND_IMM_SIGNED_ALL (T, >, -16, gt3)\ + TEST_COND_IMM_SIGNED_ALL (T, <, -16, lt3)\ + TEST_COND_IMM_SIGNED_ALL (T, >=, -16, ge3)\ + TEST_COND_IMM_SIGNED_ALL (T, <=, -16, le3)\ + TEST_COND_IMM_SIGNED_ALL (T, ==, -16, eq3)\ + TEST_COND_IMM_SIGNED_ALL (T, !=, -16, ne3)\ + \ + TEST_COND_IMM_UNSIGNED_ALL (T, >, 0, gt4)\ + /* Testing if an unsigned value >= 0 or < 0 is pointless as it will \ + get folded away by the compiler. */\ + TEST_COND_IMM_UNSIGNED_ALL (T, <=, 0, le4)\ + \ + TEST_COND_IMM_UNSIGNED_ALL (T, >, 31, gt5)\ + TEST_COND_IMM_UNSIGNED_ALL (T, <, 31, lt5)\ + TEST_COND_IMM_UNSIGNED_ALL (T, >=, 31, ge5)\ + TEST_COND_IMM_UNSIGNED_ALL (T, <=, 31, le5)\ + \ + /* Expect immediates to NOT make it into the encoding, and instead be \ + forced into a
[PATCH][i386] PR target/85473, Fix _movdir64b expansion with -mx32
Hi, This fixes PR85473 by fixing _movdir64b expansion for -mx32. Ok for trunk? 2018-04-20 Sebastian Peryt gcc/ChangeLog: PR target/85473 * config/i386/i386.c (ix86_expand_builtin): Change memory operand to XI, op0 extend to Pmode. * config/i386/i386.md: Change unspec volatile and operand 1 mode to XI, change operand 0 mode to P 2018-04-20 Sebastian Peryt gcc/testsuite/ChangeLog: PR target/85473 * gcc.target/i386/pr85473-1.c: New test. * gcc.target/i386/pr85473-2.c: New test. Sebastian fix-PR85473.patch Description: fix-PR85473.patch
Minor testsuite improvements for stack-clash-protection tests
Back in October I added dg-skip-if directives for a small number of stack-clash tests which were sensitive to whether or not the stack protector was enabled. Those skips triggered on -fstack-protector. That worked, but was insufficient to DTRT for -fstack-protector-strong of -fstack-protector-all. This change uses -fstack-protector* to guard those tests. It also adds guards to some of the newer x86/x86_64 tests where the stack protector changes the assembly code in annoying ways. This is strictly a testsuite change. Committed to the trunk. Jeff commit d7fd15ccee259681ae99415e16e25c9bfceb11d8 Author: law Date: Fri Apr 20 17:20:46 2018 + * gcc.dg/stack-check-5.c: Improve dg-skip-if selector for the stack protector. * gcc.dg/stack-check-6.c: Likewise. * gcc.dg/stack-check-6a.c: Likewise. * gcc.target/i386/stack-check-17.c: Add dg-skip-if selector. * gcc.target/i386/stack-check-18.c: Likewise. * gcc.target/i386/stack-check-19.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@259528 138bc75d-0d04-0410-961f-82ee72b054a4 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4bc930152b8..5c33c35892b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2018-04-20 Jeff Law + + * gcc.dg/stack-check-5.c: Improve dg-skip-if selector for the + stack protector. + * gcc.dg/stack-check-6.c: Likewise. + * gcc.dg/stack-check-6a.c: Likewise. + * gcc.target/i386/stack-check-17.c: Add dg-skip-if selector. + * gcc.target/i386/stack-check-18.c: Likewise. + * gcc.target/i386/stack-check-19.c: Likewise. + 2018-04-20 Kyrylo Tkachov PR testsuite/85483 diff --git a/gcc/testsuite/gcc.dg/stack-check-5.c b/gcc/testsuite/gcc.dg/stack-check-5.c index 850e023ea4e..604fa3cf6c5 100644 --- a/gcc/testsuite/gcc.dg/stack-check-5.c +++ b/gcc/testsuite/gcc.dg/stack-check-5.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fstack-clash-protection -fdump-rtl-pro_and_epilogue -fno-optimize-sibling-calls --param stack-clash-protection-probe-interval=12 --param stack-clash-protection-guard-size=12" } */ /* { dg-require-effective-target supports_stack_clash_protection } */ -/* { dg-skip-if "" { *-*-* } { "-fstack-protector" } { "" } } */ +/* { dg-skip-if "" { *-*-* } { "-fstack-protector*" } { "" } } */ /* Otherwise the S/390 back-end might save the stack pointer in f2 () diff --git a/gcc/testsuite/gcc.dg/stack-check-6.c b/gcc/testsuite/gcc.dg/stack-check-6.c index ab4b0e8894c..fe75612b737 100644 --- a/gcc/testsuite/gcc.dg/stack-check-6.c +++ b/gcc/testsuite/gcc.dg/stack-check-6.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fstack-clash-protection -fdump-rtl-pro_and_epilogue -fno-optimize-sibling-calls --param stack-clash-protection-probe-interval=12 --param stack-clash-protection-guard-size=12" } */ /* { dg-require-effective-target supports_stack_clash_protection } */ -/* { dg-skip-if "" { *-*-* } { "-fstack-protector" } { "" } } */ +/* { dg-skip-if "" { *-*-* } { "-fstack-protector*" } { "" } } */ extern void foo (char *); diff --git a/gcc/testsuite/gcc.dg/stack-check-6a.c b/gcc/testsuite/gcc.dg/stack-check-6a.c index 468d649a4fa..8fb9c621585 100644 --- a/gcc/testsuite/gcc.dg/stack-check-6a.c +++ b/gcc/testsuite/gcc.dg/stack-check-6a.c @@ -4,7 +4,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fstack-clash-protection -fdump-rtl-pro_and_epilogue -fno-optimize-sibling-calls --param stack-clash-protection-probe-interval=12 --param stack-clash-protection-guard-size=16" } */ /* { dg-require-effective-target supports_stack_clash_protection } */ -/* { dg-skip-if "" { *-*-* } { "-fstack-protector" } { "" } } */ +/* { dg-skip-if "" { *-*-* } { "-fstack-protector*" } { "" } } */ #include "stack-check-6.c" diff --git a/gcc/testsuite/gcc.target/i386/stack-check-17.c b/gcc/testsuite/gcc.target/i386/stack-check-17.c index d2ef83b348a..25ae9774061 100644 --- a/gcc/testsuite/gcc.target/i386/stack-check-17.c +++ b/gcc/testsuite/gcc.target/i386/stack-check-17.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fstack-clash-protection -mtune=generic -fomit-frame-pointer" } */ /* { dg-require-effective-target supports_stack_clash_protection } */ +/* { dg-skip-if "" { *-*-* } { "-fstack-protector*" } { "" } } */ + int x0, x1; diff --git a/gcc/testsuite/gcc.target/i386/stack-check-18.c b/gcc/testsuite/gcc.target/i386/stack-check-18.c index 6dbff4402da..1cf4bbcfafb 100644 --- a/gcc/testsuite/gcc.target/i386/stack-check-18.c +++ b/gcc/testsuite/gcc.target/i386/stack-check-18.c @@ -1,6 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fstack-clash-protection -mtune=generic -fdump-rtl-expand" } */ /* { dg-require-effective-target supports_stack_clash_protection } */ +/* { dg-skip-if "" { *-*-* } { "-fstack-protector*" } { "" } } */ int f1 (char *); di
Re: [PATCH] [PR c++/85437] accept static_casted ptrmem in constexpr
On Fri, Apr 20, 2018, 8:28 AM Nathan Sidwell wrote: > On 04/18/2018 01:07 AM, Jason Merrill wrote: > > I wonder if it would work to use CONVERT_EXPR for reinterpret_cast. > > That's kind of the wrong way round, isn't it? NOP_EXPRs are for things > that don't generate code, which a reinterpret_cast is. static_cast adds > a constant, which is only zero for conversions through the primary base > (or suitably placed empty base). CONVERT_EXPR would seem more natural > there? > Any time we need an actual adjustment, there will be a PLUS_EXPR. The issue is somehow distinguishing between a reinterpret_cast and one of the many other sources of NOP_EXPR. I'm not really clear on what the difference between NOP and CONVERT is supposed to be, anyway... Jason
[C++ Patch] PR 84588 ("[8 Regression] internal compiler error: Segmentation fault (contains_struct_check())")
Hi, in this error-recovery regression, after sensible diagnostic about "two or more data types in declaration..." we get confused, we issue a cryptic - but useful hint to somebody working on the present bug ;) - "template definition of non-template" error and we finally crash. I think the issue here is that we want to use abort_fully_implicit_template as part of the error recovery done by cp_parser_parameter_declaration_list, when the loop is exited early after a cp_parser_parameter_declaration internally called synthesize_implicit_template_parm. Indeed, if we do that we get the same error recovery behavior we get for the same testcase modified to not use an auto parameter (likewise for related testcases): struct a { void b() {} void c(auto = [] { if (a a(int int){}) ; }) {} }; Tested x86_64-linux. Thanks, Paolo. /// /cp 2018-04-20 Paolo Carlini PR c++/84588 * parser.c (cp_parser_parameter_declaration_list): When the entire parameter-declaration-list is erroneous maybe call abort_fully_implicit_template. /testsuite 2018-04-20 Paolo Carlini PR c++/84588 * g++.dg/cpp1y/pr84588.C: New. Index: cp/parser.c === --- cp/parser.c (revision 259516) +++ cp/parser.c (working copy) @@ -21358,6 +21358,8 @@ cp_parser_parameter_declaration_list (cp_parser* p { *is_error = true; parameters = error_mark_node; + if (parser->fully_implicit_function_template_p) + abort_fully_implicit_template (parser); break; } Index: testsuite/g++.dg/cpp1y/pr84588.C === --- testsuite/g++.dg/cpp1y/pr84588.C(nonexistent) +++ testsuite/g++.dg/cpp1y/pr84588.C(working copy) @@ -0,0 +1,10 @@ +// { dg-do compile { target c++14 } } +// { dg-options "-w" } + +struct a { + void b() {} + void c(auto = [] { +if (a a(int auto){}) // { dg-error "two or more data types" } + ; + }) {} +};
Re: [PATCH] Do not overflow string buffer (PR objc/85476).
On Fri, Apr 20, 2018 at 11:44:35AM +0200, Martin Liška wrote: > Hi. > > Quite obvious package that causes an ASAN error described in the PR. > > Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. > > Ready to be installed? > Martin > > gcc/objc/ChangeLog: > > 2018-04-20 Martin Liska > > PR objc/85476 > * objc-act.c (finish_class): Do not overflow string buffer. Ok, thanks. Jakub
Re: [PATCH] [PR c++/85437] accept static_casted ptrmem in constexpr
On 04/20/2018 01:44 PM, Jason Merrill wrote: Any time we need an actual adjustment, there will be a PLUS_EXPR. The issue is somehow distinguishing between a reinterpret_cast and one of the many other sources of NOP_EXPR. yeah, I see that now. Perhaps VIEW_CONVERT_EXPR is more appropriate for the reinterpret_cast case? Anyway, such a change would require auditing a lot of NOP_EXPR uses. This less invasive patch instead adds a REINTERPRET_CAST_P flag, which we set on NOP_EXPRs coming out of build_reinterpret_1. Then in cxx_eval_constant_expression we reject any NOP_EXPR that has that flag set. We can get rid of the subsequent special casing of a NOP_EXPR involving a PTRMEM_CST. I have to change convert_ptrmem to always expand the constant (into an OFFSET_TYPE) so that initializer_constant_valid_p (used by reduced_constant_expression_p) doesn't get confused by a zero-adjusting conversion of a ptrmem_cst. cpp0x/addressof1.C thinks thinks like 'static_assert (reinterpret_cast (&thing) == &thing.member)' are constant expressions, but AFAICT they are not cpp0x/constexpr-pmf1.C is checking an optimization occurs at the genericization level without turning the optimizer on. IMHO we only need to check this is happening at some point when the optimizer is turned on. (The original bug was wrong code, but then perhaps it should be a runtime check?) WDYT? nathan -- Nathan Sidwell 2018-04-20 Nathan Sidwell PR c++/85437 PR c++/49171 * cp-tree.h (REINTERPRETT_CAST_P): New. * constexpr.c (cxx_eval_constant_expression) : Reject REINTERPET_CAST_P conversions. Remove PTRMEM_CST check. * typeck.c (convert_ptrmem): Expand PTRMEM_CST even in the zero-addition case. (build_nop_reinterpret): New. (build_reinterpret_cast_1): Use it. Set REINTERPRET_CAST_P on NOP_EXPRs returned by cp_convert. 2018-04-20 Jakub Jelinek PR c++/85437 PR c++/49171 * g++.dg/cpp0x/addressof1.C: Comment out reinterpret_cast cases. * g++.dg/cpp0x/constexpr-cast.C: Remove xfails * g++.dg/cpp0x/constexpr-nullptr-2.C: Likewise. * g++.dg/cpp0x/constexpr-pmf1.C: Check when optimized. * g++.dg/cpp0x/pr85437-1.C: New. * g++.dg/cpp0x/pr85437-2.C: New. * g++.dg/cpp0x/pr85437-3.C: New. * g++.dg/cpp0x/pr85437-4.C: New. Index: gcc/cp/constexpr.c === --- gcc/cp/constexpr.c (revision 259523) +++ gcc/cp/constexpr.c (working copy) @@ -1822,8 +1822,8 @@ reduced_constant_expression_p (tree t) } /* Some expressions may have constant operands but are not constant - themselves, such as 1/0. Call this function (or rather, the macro - following it) to check for that condition. + themselves, such as 1/0. Call this function to check for that + condition. We only call this in places that require an arithmetic constant, not in places where we might have a non-constant expression that can be a @@ -4579,9 +4579,18 @@ cxx_eval_constant_expression (const cons non_constant_p, overflow_p); break; +case NOP_EXPR: + if (REINTERPRET_CAST_P (t)) + { + if (!ctx->quiet) + error_at (EXPR_LOC_OR_LOC (t, input_location), + "a reinterpret_cast is not a constant expression"); + *non_constant_p = true; + return t; + } + /* FALLTHROUGH. */ case CONVERT_EXPR: case VIEW_CONVERT_EXPR: -case NOP_EXPR: case UNARY_PLUS_EXPR: { tree oldop = TREE_OPERAND (t, 0); @@ -4595,21 +4604,6 @@ cxx_eval_constant_expression (const cons if (TREE_CODE (op) == PTRMEM_CST && !TYPE_PTRMEM_P (type)) op = cplus_expand_constant (op); - if (TREE_CODE (op) == PTRMEM_CST && tcode == NOP_EXPR) - { - if (same_type_ignoring_top_level_qualifiers_p (type, - TREE_TYPE (op)) - || can_convert_qual (type, op)) - return cp_fold_convert (type, op); - else - { - if (!ctx->quiet) - error_at (EXPR_LOC_OR_LOC (t, input_location), - "a reinterpret_cast is not a constant expression"); - *non_constant_p = true; - return t; - } - } if (POINTER_TYPE_P (type) && TREE_CODE (op) == INTEGER_CST) { @@ -4653,14 +4647,17 @@ cxx_eval_constant_expression (const cons return t; } } + if (op == oldop && tcode != UNARY_PLUS_EXPR) /* We didn't fold at the top so we could check for ptr-int conversion. */ return fold (t); + if (tcode == UNARY_PLUS_EXPR) r = fold_convert (TREE_TYPE (t), op); else r = fold_build1 (tcode, type, op); + /* Conversion of an out-of-range value has implementation-defined behavior; the language considers it different from arithmetic overflow, which is undefined. */ Index: gcc/cp/cp-tree.h === --- gcc/cp/cp-tree.h (revision 259523) +++ gcc/cp/cp-tree.h (working copy) @@ -372,6 +372,7 @@ extern GTY(()) tree cp_global_trees[CPTI TEMPLATE_TYPE_PARM_FOR_CLASS (TEMPLATE_TYPE_PARM) DECL_NAMESPACE_INLINE_P (in NAMESPACE
Re: [PATCH v2] RISC-V: Make sure stack is always aligned during adjusting
On Thu, Apr 19, 2018 at 7:48 PM, Kito Cheng wrote: > 2018-04-18 Kito Cheng > > * config/riscv/riscv.c (riscv_first_stack_step): Round up min > step to make sure stack always aligned. Committed. Jim
Re: [PATCH] PR target/85456, Fix __builtin_powil for -mabi=ieeelongdouble on PowerPC
On Fri, Apr 20, 2018 at 10:52:57AM -0500, Segher Boessenkool wrote: > Hi Mike, > > On Thu, Apr 19, 2018 at 12:33:45AM -0400, Michael Meissner wrote: > > This patch adds __powikf2 to libgcc, and makes GCC use it for > > __builtin_powil > > when long double is IEEE 128-bit (-mabi=ieeelongdouble). > > > > I tested it on a little endian power8 system with a bootstrap compiler. > > There > > were no regresion failures. Can I check this into GCC 8? This does not > > need > > to be checked into GCC 7, since -mabi=ieeelongdouble was not fully > > supported in > > that release. > > > [libgcc] > > 2018-04-18 Michael Meissner > > > > PR target/85456 > > * config/rs6000/_powikf2.c: New file. Entry point for > > __builtin_powil when -mabi=ieeelongdouble is in effect. > > * config/rs6000/float128-ifunc.c (__powikf2_resolve): Add > > __powikf2 support. > > (__powikf2): Likewise. > > * config/rs6000/quad-float128.h (__powikf2_sw): Likewise. > > (__powikf2_hw): Likewise. > > (__powikf2): Likewise. > > * config/rs6000/t-float128 (fp128_ppc_funcs): Likewise. > > * config/rs6000/t-float128-hw (fp128_hw_func): Likewise. > > (_powikf2-hw.c): Likewise. > > This changelog does not make too much sense ("__powikf2: Add __powikf2 > support." does not really say what it does, for example). Ok, I will rewrite it. > Does the leading underscore in the filename have any meaning? The kc > files have one, too, but everything else does not. It comes from all of the libgcc2.c functions are compiled into _3, etc. I kept the same name for consistancy. > > +#if defined(FLOAT128_HW_INSNS) && !defined(__powikf2) > > +#define __powikf2 __powikf2_sw > > +#endif > > This could use a comment (it seems the wrong way around if you don't > see how it is built). Ok. > > +TFtype > > +__powikf2 (TFtype x, SItype_ppc m) > > +{ > > + unsigned int n = m < 0 ? -m : m; > > + TFtype y = n % 2 ? x : 1; > > + while (n >>= 1) > > +{ > > + x = x * x; > > + if (n % 2) > > + y = y * x; > > +} > > + return m < 0 ? 1/y : y; > > +} > > This work correctly for the most negative integer. Okay. It is a copy of the code from libgcc2.c, so it should be correct :-) For simple code like this and mulkc3/divkc3, it was simpler to just extract the code from libgcc2, rather than add appropriate KC/KF support to libgcc2.c. -- Michael Meissner, IBM IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA email: meiss...@linux.vnet.ibm.com, phone: +1 (978) 899-4797
libgo patch committed: Only look for data symbols on big-endian PPC64 non-AIX
The libgo gotest script runs nm to find tests to run. It normally looks only for T (text) symbols, but on ppc64 also looks for D (data) symbols, because on PPC64 ELF ABI v1 function symbols are actually descriptors in the data segment. This patch changes the script to not do this on AIX, and to not do it for ppc64le which always uses ELF ABI v2. Bootstrapped and ran libgo testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian Index: gcc/go/gofrontend/MERGE === --- gcc/go/gofrontend/MERGE (revision 259452) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -b367349d85f315e94e10ee2d76a7c6a46b993dcb +7b37b9c3f9338a1387ee1e2301de89c3d2d87d2b The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: libgo/testsuite/gotest === --- libgo/testsuite/gotest (revision 259359) +++ libgo/testsuite/gotest (working copy) @@ -506,9 +506,13 @@ localname() { { text="T" - case "$goarch" in - ppc64*) text="[TD]" ;; - esac + + # On systems using PPC64 ELF ABI v1 function symbols show up + # as descriptors in the data section. We assume that $goarch + # distinguishes v1 (ppc64) from v2 (ppc64le). + if test "$goos" != "aix" && test "$goarch" = "ppc64"; then + text="[TD]" + fi symtogo='sed -e s/_test\([^A-Za-z0-9]\)/XXXtest\1/ -e s/.*_\([^_]*\.\)/\1/ -e s/XXXtest/_test/'
[PATCH, rs6000, committed] undef-bool-* tests should exclude -m32
Hi, These two new tests don't work with -m32, because they include headers that don't support 32-bit. Require lp64 to stop the noise. Tested on powerpc64-linux-gnu (P7, 32/64) and powerpc64le-linux-gnu (P8, 64), committed as pre-approved. Thanks! Bill [gcc/testsuite] 2018-04-20 Bill Schmidt * g++.dg/ext/undef-bool-1.C: Require lp64. * gcc.target/powerpc/undef-bool-2.c: Likewise. Index: gcc/testsuite/g++.dg/ext/undef-bool-1.C === --- gcc/testsuite/g++.dg/ext/undef-bool-1.C (revision 259521) +++ gcc/testsuite/g++.dg/ext/undef-bool-1.C (working copy) @@ -1,5 +1,6 @@ /* { dg-do compile { target { powerpc*-*-* } } } */ /* { dg-options "-O2 -DNO_WARN_X86_INTRINSICS -mvsx" } */ +/* { dg-require-effective-target lp64 } */ /* Test to ensure that "bool" gets undef'd in xmmintrin.h when we require strict ANSI. */ Index: gcc/testsuite/gcc.target/powerpc/undef-bool-2.c === --- gcc/testsuite/gcc.target/powerpc/undef-bool-2.c (revision 259521) +++ gcc/testsuite/gcc.target/powerpc/undef-bool-2.c (working copy) @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -std=c11 -DNO_WARN_X86_INTRINSICS -mvsx" } */ +/* { dg-require-effective-target lp64 } */ /* Test to ensure that "bool" gets undef'd in xmmintrin.h when we require strict ANSI. Subsequent use of bool needs stdbool.h.
Re: [PATCH] [PR c++/85437] accept static_casted ptrmem in constexpr
On Fri, Apr 20, 2018 at 02:52:32PM -0400, Nathan Sidwell wrote: > On 04/20/2018 01:44 PM, Jason Merrill wrote: > > > Any time we need an actual adjustment, there will be a PLUS_EXPR. The > > issue is somehow distinguishing between a reinterpret_cast and one of > > the many other sources of NOP_EXPR. > > yeah, I see that now. Perhaps VIEW_CONVERT_EXPR is more appropriate for the Thanks for taking this over. > * cp-tree.h (REINTERPRETT_CAST_P): New. s/TT/T/ > +/* Build a NOP_EXPR to TYPE, but mark it as a reinterpret_cast so that > + constexpr evaluation knows to reject it. */ > + > +static tree > +build_nop_reinterpret (tree type, tree expr) > +{ > + expr = build_nop (type, expr); > + REINTERPRET_CAST_P (expr) = true; > + return expr; build_nop can return the expr passed to it if it is error_operand or type is error_mark_node. Shouldn't this e.g. check if build_nop returned something other than expr before setting the flag on it? tree ret = build_nop (type, expr); if (ret != expr) REINTERPRET_CAST_P (ret) = true; return ret; ? Jakub
Re: [patches] Re: [PATCH] RISC-V: Pass --no-relax to linker if -mno-relax is present.
On 04/18/2018 06:59 PM, Kito Cheng wrote: Hi Jim: Turned off both the assembler and the linker sounds good idea to me, but it's not support on current assembler now, and gcc might release in next few month, so I afraid we'll have a short time gap that is -mno-relax is broken due to assembler not support that command line option in the latest release yet? Sorry, I didn't look at this closely enough. We already have a -mrelax/-mno-relax added by Palmer. You even mentioned that. So all your patch is doing is adding support to pass it to the linker, which is OK. You are right that we can't release a compiler that uses the new assembler option until after there is an assembler release, so we can't modify gcc to use it until after the gcc-8 release branch is made. But we don't need it for now, as we have Palmer's patch. I still think it was a good idea to add the assembler option though, to make it a little more user friendly. Anyways, this patch is OK. I have committed it. Jim