From patchwork Fri Apr 25 16:10:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 342932 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id E4DE714011C for ; Sat, 26 Apr 2014 02:19:01 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=gPDovEtSat4aMJ1hiIGkQkEUNsztT+Gl8Oihj+/KO37NnaOQIIsMd bOnmm3cICxZuGkPyELD9DYtyLM/mZpkL9Jy6ujg8C1sJAptq80QP0++O6H44HWma QJ8PNvPoMsjy+dIwS/NTQPu4OGKYWbT/kECJEVB98iqWylctMEgKR0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=tfQeUKvgaUgRXSHcNaiA0eQlpRQ=; b=u0nbIUTac8cpxEpj8vef nup/bdc9qZvbpesNrFEpYHzDO7iUQVZQtwElkVSyPjlXh11+vfQQK1QOAsGmamcX lh5XjZV4ovQv/W2+DrM3/DVajfYJrZb5s6rHKu8uwf9KHciKF5Xps4ctizwhMKeA BBJgA9H7IIeabKa8O08sKM8= Received: (qmail 11390 invoked by alias); 25 Apr 2014 16:18:53 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 11368 invoked by uid 89); 25 Apr 2014 16:18:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 25 Apr 2014 16:18:48 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s3PGIjEZ009499 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 25 Apr 2014 12:18:46 -0400 Received: from localhost (vpn1-5-174.ams2.redhat.com [10.36.5.174]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s3PGAYNG011879; Fri, 25 Apr 2014 12:10:35 -0400 Date: Fri, 25 Apr 2014 17:10:34 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [patch] libstdc++/60958 disable invalid code in Message-ID: <20140425161034.GJ928@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Rather than making small fixes to code that doesn't work anyway, this just disables the whole block. (I've included a tweak to the regex testsuite code with this patch, as I wanted to make that change anyway.) I'm tempted to do something like this in : #ifndef _GLIBCXX_TR1_REGEX_WARTS_AND_ALL #error The code in this header doesn't work. If you really want to include it anyway define _GLIBCXX_TR1_REGEX_WARTS_AND_ALL #endif Tested x86_64-linux, committed to trunk. commit d247576be63070905e03bf5ffd926c25380d5de8 Author: Jonathan Wakely Date: Fri Apr 25 11:15:58 2014 +0100 PR libstdc++/60958 * include/tr1/regex (regex_traits::isctype): Comment out broken code. * testsuite/util/testsuite_regex.h (regex_match_debug): Improve comment. diff --git a/libstdc++-v3/include/tr1/regex b/libstdc++-v3/include/tr1/regex index 3cff23a..0387472 100644 --- a/libstdc++-v3/include/tr1/regex +++ b/libstdc++-v3/include/tr1/regex @@ -678,7 +678,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (__ctype.is(__c, __f)) return true; - +#if 0 // special case of underscore in [[:w:]] if (__c == __ctype.widen('_')) { @@ -698,7 +698,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (__f | __bt) return true; } - +#endif return false; } diff --git a/libstdc++-v3/testsuite/util/testsuite_regex.h b/libstdc++-v3/testsuite/util/testsuite_regex.h index 9460ed6..c2031e9 100644 --- a/libstdc++-v3/testsuite/util/testsuite_regex.h +++ b/libstdc++-v3/testsuite/util/testsuite_regex.h @@ -131,7 +131,7 @@ namespace __gnu_test // regex_match_debug behaves like regex_match, but will run *two* executors // (if there's no back-reference) and check if their results agree. If not, - // an exception throws. One can use them just in the way of using regex_match. + // an exception is thrown. The arguments are the same as for regex_match. template bool @@ -153,7 +153,7 @@ namespace __gnu_test // __m is unspecified if return value is false. if (__res1 == __res2 && (!__res1 || __m == __mm)) return __res1; - throw(std::exception()); + throw std::exception(); } // No match_results version commit dc1913c558963725ad349c1eab971a781c8f83da Author: ktkachov Date: Fri Apr 25 14:32:39 2014 +0000 [ARM] Initialise T16-related fields in Cortex-A8 tuning struct. * config/arm/arm.c (arm_cortex_a8_tune): Initialise T16-related fields. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209806 138bc75d-0d04-0410-961f-82ee72b054a4 diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 09b5c52..de457a3 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -1710,7 +1710,8 @@ const struct tune_params arm_cortex_a8_tune = false, /* Prefer LDRD/STRD. */ {true, true}, /* Prefer non short circuit. */ &arm_default_vec_cost, /* Vectorizer costs. */ - false /* Prefer Neon for 64-bits bitops. */ + false, /* Prefer Neon for 64-bits bitops. */ + false, false /* Prefer 32-bit encodings. */ }; const struct tune_params arm_cortex_a7_tune = commit 05a4798aec534cf3e0e7180eed2512b86c8f06d7 Author: wschmidt Date: Fri Apr 25 14:28:58 2014 +0000 [gcc] 2014-04-25 Bill Schmidt PR tree-optimization/60930 * gimple-ssa-strength-reduction.c (create_mul_imm_cand): Reject creating a multiply candidate by folding two constant multiplicands when the result overflows. [gcc/testsuite] 2014-04-25 Bill Schmidt PR tree-optimization/60930 * gcc.dg/torture/pr60930.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209805 138bc75d-0d04-0410-961f-82ee72b054a4 diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c index ff55d0e..321cb15 100644 --- a/gcc/gimple-ssa-strength-reduction.c +++ b/gcc/gimple-ssa-strength-reduction.c @@ -1114,15 +1114,18 @@ create_mul_imm_cand (gimple gs, tree base_in, tree stride_in, bool speed) X = Y * c ============================ X = (B + i') * (S * c) */ - base = base_cand->base_expr; - index = base_cand->index; temp = tree_to_double_int (base_cand->stride) * tree_to_double_int (stride_in); - stride = double_int_to_tree (TREE_TYPE (stride_in), temp); - ctype = base_cand->cand_type; - if (has_single_use (base_in)) - savings = (base_cand->dead_savings - + stmt_cost (base_cand->cand_stmt, speed)); + if (double_int_fits_to_tree_p (TREE_TYPE (stride_in), temp)) + { + base = base_cand->base_expr; + index = base_cand->index; + stride = double_int_to_tree (TREE_TYPE (stride_in), temp); + ctype = base_cand->cand_type; + if (has_single_use (base_in)) + savings = (base_cand->dead_savings + + stmt_cost (base_cand->cand_stmt, speed)); + } } else if (base_cand->kind == CAND_ADD && integer_onep (base_cand->stride)) { diff --git a/gcc/testsuite/gcc.dg/torture/pr60930.c b/gcc/testsuite/gcc.dg/torture/pr60930.c new file mode 100644 index 0000000..5e35f19 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr60930.c @@ -0,0 +1,22 @@ +/* { dg-do run } */ + +int x = 1; + +__attribute__((noinline, noclone)) void +foo (unsigned long long t) +{ + asm volatile ("" : : "r" (&t)); + if (t == 1) + __builtin_abort (); +} + +int +main () +{ +#if __SIZEOF_LONG_LONG__ >= 8 + unsigned long long t = 0xffffffffffffffffULL * (0xffffffffUL * x); + if (t != 0xffffffff00000001ULL) + foo (t);; +#endif + return 0; +} commit 7ecc75116f240af25961f8d098c44d13b17ebd82 Author: jakub Date: Fri Apr 25 13:52:52 2014 +0000 PR tree-optimization/60960 * tree-vect-generic.c (expand_vector_operation): Only call expand_vector_divmod if type's mode satisfies VECTOR_MODE_P. * gcc.c-torture/execute/pr60960.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209802 138bc75d-0d04-0410-961f-82ee72b054a4 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr60960.c b/gcc/testsuite/gcc.c-torture/execute/pr60960.c new file mode 100644 index 0000000..b4f08d4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr60960.c @@ -0,0 +1,38 @@ +/* PR tree-optimization/60960 */ + +typedef unsigned char v4qi __attribute__ ((vector_size (4))); + +__attribute__((noinline, noclone)) v4qi +f1 (v4qi v) +{ + return v / 2; +} + +__attribute__((noinline, noclone)) v4qi +f2 (v4qi v) +{ + return v / (v4qi) { 2, 2, 2, 2 }; +} + +__attribute__((noinline, noclone)) v4qi +f3 (v4qi x, v4qi y) +{ + return x / y; +} + +int +main () +{ + v4qi x = { 5, 5, 5, 5 }; + v4qi y = { 2, 2, 2, 2 }; + v4qi z = f1 (x); + if (__builtin_memcmp (&y, &z, sizeof (y)) != 0) + __builtin_abort (); + z = f2 (x); + if (__builtin_memcmp (&y, &z, sizeof (y)) != 0) + __builtin_abort (); + z = f3 (x, y); + if (__builtin_memcmp (&y, &z, sizeof (y)) != 0) + __builtin_abort (); + return 0; +} diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c index d8b2200..2ca19f0 100644 --- a/gcc/tree-vect-generic.c +++ b/gcc/tree-vect-generic.c @@ -971,7 +971,8 @@ expand_vector_operation (gimple_stmt_iterator *gsi, tree type, tree compute_type if (!optimize || !VECTOR_INTEGER_TYPE_P (type) - || TREE_CODE (rhs2) != VECTOR_CST) + || TREE_CODE (rhs2) != VECTOR_CST + || !VECTOR_MODE_P (TYPE_MODE (type))) break; ret = expand_vector_divmod (gsi, type, rhs1, rhs2, code); commit fb34a6cf92e4bef271061011000ab36c636a6fe5 Author: mpolacek Date: Fri Apr 25 13:22:13 2014 +0000 * gcc.dg/pr18079-2.c: Fix quoting in dg-warning. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209801 138bc75d-0d04-0410-961f-82ee72b054a4 diff --git a/gcc/testsuite/gcc.dg/pr18079-2.c b/gcc/testsuite/gcc.dg/pr18079-2.c index 5091dd41b..2c83b70 100644 --- a/gcc/testsuite/gcc.dg/pr18079-2.c +++ b/gcc/testsuite/gcc.dg/pr18079-2.c @@ -3,14 +3,14 @@ /* { dg-options "-Wall" } */ __attribute__ ((always_inline)) void fndecl1 (void); -__attribute__ ((noinline)) void fndecl1 (void); /* { dg-warning "attribute noinline follows declaration with attribute always_inline" } */ +__attribute__ ((noinline)) void fndecl1 (void); /* { dg-warning "attribute 'noinline' follows declaration with attribute 'always_inline'" } */ __attribute__ ((noinline)) void fndecl2 (void); -__attribute__ ((always_inline)) void fndecl2 (void); /* { dg-warning "attribute always_inline follows declaration with attribute noinline" } */ +__attribute__ ((always_inline)) void fndecl2 (void); /* { dg-warning "attribute 'always_inline' follows declaration with attribute 'noinline'" } */ __attribute__ ((hot)) void fndecl3 (void); -__attribute__ ((cold)) void fndecl3 (void); /* { dg-warning "attribute cold follows declaration with attribute hot" } */ +__attribute__ ((cold)) void fndecl3 (void); /* { dg-warning "attribute 'cold' follows declaration with attribute 'hot'" } */ __attribute__ ((cold)) void fndecl4 (void); -__attribute__ ((hot)) void fndecl4 (void); /* { dg-warning "attribute hot follows declaration with attribute cold" } */ +__attribute__ ((hot)) void fndecl4 (void); /* { dg-warning "attribute 'hot' follows declaration with attribute 'cold'" } */ commit e67cfba4ebc667ea3f7c6230677fd5a4a8011593 Author: vries Date: Fri Apr 25 11:21:40 2014 +0000 Add clobber_reg 2014-04-25 Tom de Vries * expr.c (clobber_reg_mode): New function. * expr.h (clobber_reg): New function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209800 138bc75d-0d04-0410-961f-82ee72b054a4 diff --git a/gcc/expr.c b/gcc/expr.c index 825a244..fec6194 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -2396,6 +2396,18 @@ use_reg_mode (rtx *call_fusage, rtx reg, enum machine_mode mode) = gen_rtx_EXPR_LIST (mode, gen_rtx_USE (VOIDmode, reg), *call_fusage); } +/* Add a CLOBBER expression for REG to the (possibly empty) list pointed + to by CALL_FUSAGE. REG must denote a hard register. */ + +void +clobber_reg_mode (rtx *call_fusage, rtx reg, enum machine_mode mode) +{ + gcc_assert (REG_P (reg) && REGNO (reg) < FIRST_PSEUDO_REGISTER); + + *call_fusage + = gen_rtx_EXPR_LIST (mode, gen_rtx_CLOBBER (VOIDmode, reg), *call_fusage); +} + /* Add USE expressions to *CALL_FUSAGE for each of NREGS consecutive regs, starting at REGNO. All of these registers must be hard registers. */ diff --git a/gcc/expr.h b/gcc/expr.h index 524da67..1823feb 100644 --- a/gcc/expr.h +++ b/gcc/expr.h @@ -346,6 +346,7 @@ extern void copy_blkmode_from_reg (rtx, rtx, tree); /* Mark REG as holding a parameter for the next CALL_INSN. Mode is TYPE_MODE of the non-promoted parameter, or VOIDmode. */ extern void use_reg_mode (rtx *, rtx, enum machine_mode); +extern void clobber_reg_mode (rtx *, rtx, enum machine_mode); extern rtx copy_blkmode_to_reg (enum machine_mode, tree); @@ -356,6 +357,13 @@ use_reg (rtx *fusage, rtx reg) use_reg_mode (fusage, reg, VOIDmode); } +/* Mark REG as clobbered by the call with FUSAGE as CALL_INSN_FUNCTION_USAGE. */ +static inline void +clobber_reg (rtx *fusage, rtx reg) +{ + clobber_reg_mode (fusage, reg, VOIDmode); +} + /* Mark NREGS consecutive regs, starting at REGNO, as holding parameters for the next CALL_INSN. */ extern void use_regs (rtx *, int, int); commit 6792947daef09bed4fc29ae2e9dd2a806165c3a2 Author: vries Date: Fri Apr 25 11:21:29 2014 +0000 Register CALL_INSN_FUNCTION_USAGE in find_all_hard_reg_sets 2014-04-25 Tom de Vries * rtlanal.c (find_all_hard_reg_sets): Note INSN_CALL_FUNCTION_USAGE clobbers. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209799 138bc75d-0d04-0410-961f-82ee72b054a4 diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index 284c475..f3471b1 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -1052,8 +1052,14 @@ find_all_hard_reg_sets (const_rtx insn, HARD_REG_SET *pset, bool implicit) CLEAR_HARD_REG_SET (*pset); note_stores (PATTERN (insn), record_hard_reg_sets, pset); - if (implicit && CALL_P (insn)) - IOR_HARD_REG_SET (*pset, call_used_reg_set); + if (CALL_P (insn)) + { + if (implicit) + IOR_HARD_REG_SET (*pset, call_used_reg_set); + + for (link = CALL_INSN_FUNCTION_USAGE (insn); link; link = XEXP (link, 1)) + record_hard_reg_sets (XEXP (link, 0), NULL, pset); + } for (link = REG_NOTES (insn); link; link = XEXP (link, 1)) if (REG_NOTE_KIND (link) == REG_INC) record_hard_reg_sets (XEXP (link, 0), NULL, pset); commit 1630ba6e1381668e565a77a5d63966e716f138e3 Author: vries Date: Fri Apr 25 11:21:18 2014 +0000 Add implicit parameter to find_all_hard_reg_sets 2014-04-25 Radovan Obradovic Tom de Vries * rtlanal.c (find_all_hard_reg_sets): Add bool implicit parameter and handle. * rtl.h (find_all_hard_reg_sets): Add bool parameter. * haifa-sched.c (recompute_todo_spec, check_clobbered_conditions): Add new argument to find_all_hard_reg_sets call. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209798 138bc75d-0d04-0410-961f-82ee72b054a4 diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index 2d66e5c..5d16b4d 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -1299,7 +1299,7 @@ recompute_todo_spec (rtx next, bool for_backtrack) { HARD_REG_SET t; - find_all_hard_reg_sets (prev, &t); + find_all_hard_reg_sets (prev, &t, true); if (TEST_HARD_REG_BIT (t, regno)) return HARD_DEP; if (prev == pro) @@ -3082,7 +3082,7 @@ check_clobbered_conditions (rtx insn) if ((current_sched_info->flags & DO_PREDICATION) == 0) return; - find_all_hard_reg_sets (insn, &t); + find_all_hard_reg_sets (insn, &t, true); restart: for (i = 0; i < ready.n_ready; i++) diff --git a/gcc/rtl.h b/gcc/rtl.h index 3a526a1..595b699 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -2042,7 +2042,7 @@ extern const_rtx set_of (const_rtx, const_rtx); extern void record_hard_reg_sets (rtx, const_rtx, void *); extern void record_hard_reg_uses (rtx *, void *); #ifdef HARD_CONST -extern void find_all_hard_reg_sets (const_rtx, HARD_REG_SET *); +extern void find_all_hard_reg_sets (const_rtx, HARD_REG_SET *, bool); #endif extern void note_stores (const_rtx, void (*) (rtx, const_rtx, void *), void *); extern void note_uses (rtx *, void (*) (rtx *, void *), void *); diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index 98fbacc..284c475 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -1046,13 +1046,13 @@ record_hard_reg_sets (rtx x, const_rtx pat ATTRIBUTE_UNUSED, void *data) /* Examine INSN, and compute the set of hard registers written by it. Store it in *PSET. Should only be called after reload. */ void -find_all_hard_reg_sets (const_rtx insn, HARD_REG_SET *pset) +find_all_hard_reg_sets (const_rtx insn, HARD_REG_SET *pset, bool implicit) { rtx link; CLEAR_HARD_REG_SET (*pset); note_stores (PATTERN (insn), record_hard_reg_sets, pset); - if (CALL_P (insn)) + if (implicit && CALL_P (insn)) IOR_HARD_REG_SET (*pset, call_used_reg_set); for (link = REG_NOTES (insn); link; link = XEXP (link, 1)) if (REG_NOTE_KIND (link) == REG_INC) commit 4ea1b263c9144dd6c9c9db0a838b166998e90964 Author: ktkachov Date: Fri Apr 25 11:09:03 2014 +0000 [ARM] Wrap long literals in HOST_WIDE_INT_C in aarch-common.c * config/arm/aarch-common.c (aarch_rev16_shright_mask_imm_p): Use HOST_WIDE_INT_C for mask literal. (aarch_rev16_shleft_mask_imm_p): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209797 138bc75d-0d04-0410-961f-82ee72b054a4 diff --git a/gcc/config/arm/aarch-common.c b/gcc/config/arm/aarch-common.c index 884d4b3..d31191a 100644 --- a/gcc/config/arm/aarch-common.c +++ b/gcc/config/arm/aarch-common.c @@ -195,14 +195,18 @@ bool aarch_rev16_shright_mask_imm_p (rtx val, enum machine_mode mode) { return CONST_INT_P (val) - && INTVAL (val) == trunc_int_for_mode (0xff00ff00ff00ff, mode); + && INTVAL (val) + == trunc_int_for_mode (HOST_WIDE_INT_C (0xff00ff00ff00ff), + mode); } bool aarch_rev16_shleft_mask_imm_p (rtx val, enum machine_mode mode) { return CONST_INT_P (val) - && INTVAL (val) == trunc_int_for_mode (0xff00ff00ff00ff00, mode); + && INTVAL (val) + == trunc_int_for_mode (HOST_WIDE_INT_C (0xff00ff00ff00ff00), + mode); } commit 4a026b4805910fdfa7588b48cb44bd358903b163 Author: mpolacek Date: Fri Apr 25 11:04:40 2014 +0000 PR c/18079 c/ * c-decl.c (diagnose_mismatched_decls): Warn for mismatched always_inline/noinline and hot/cold attributes. c-family/ * c-common.c (handle_noinline_attribute): Warn if the attribute conflicts with always_inline attribute. (handle_always_inline_attribute): Warn if the attribute conflicts with noinline attribute. testsuite/ * gcc.dg/pr18079.c: New test. * gcc.dg/pr18079-2.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209796 138bc75d-0d04-0410-961f-82ee72b054a4 diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 97d16c1..0ad955d 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -6568,8 +6568,8 @@ handle_hot_attribute (tree *node, tree name, tree ARG_UNUSED (args), { if (lookup_attribute ("cold", DECL_ATTRIBUTES (*node)) != NULL) { - warning (OPT_Wattributes, "%qE attribute conflicts with attribute %s", - name, "cold"); + warning (OPT_Wattributes, "%qE attribute ignored due to conflict " + "with attribute %qs", name, "cold"); *no_add_attrs = true; } /* Most of the rest of the hot processing is done later with @@ -6596,8 +6596,8 @@ handle_cold_attribute (tree *node, tree name, tree ARG_UNUSED (args), { if (lookup_attribute ("hot", DECL_ATTRIBUTES (*node)) != NULL) { - warning (OPT_Wattributes, "%qE attribute conflicts with attribute %s", - name, "hot"); + warning (OPT_Wattributes, "%qE attribute ignored due to conflict " + "with attribute %qs", name, "hot"); *no_add_attrs = true; } /* Most of the rest of the cold processing is done later with @@ -6670,7 +6670,16 @@ handle_noinline_attribute (tree *node, tree name, int ARG_UNUSED (flags), bool *no_add_attrs) { if (TREE_CODE (*node) == FUNCTION_DECL) - DECL_UNINLINABLE (*node) = 1; + { + if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (*node))) + { + warning (OPT_Wattributes, "%qE attribute ignored due to conflict " + "with attribute %qs", name, "always_inline"); + *no_add_attrs = true; + } + else + DECL_UNINLINABLE (*node) = 1; + } else { warning (OPT_Wattributes, "%qE attribute ignored", name); @@ -6708,9 +6717,16 @@ handle_always_inline_attribute (tree *node, tree name, { if (TREE_CODE (*node) == FUNCTION_DECL) { - /* Set the attribute and mark it for disregarding inline - limits. */ - DECL_DISREGARD_INLINE_LIMITS (*node) = 1; + if (lookup_attribute ("noinline", DECL_ATTRIBUTES (*node))) + { + warning (OPT_Wattributes, "%qE attribute ignored due to conflict " + "with %qs attribute", name, "noinline"); + *no_add_attrs = true; + } + else + /* Set the attribute and mark it for disregarding inline + limits. */ + DECL_DISREGARD_INLINE_LIMITS (*node) = 1; } else { diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index df84980..e30876c 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -2099,18 +2099,38 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl, /* Diagnose inline __attribute__ ((noinline)) which is silly. */ if (DECL_DECLARED_INLINE_P (newdecl) && lookup_attribute ("noinline", DECL_ATTRIBUTES (olddecl))) - { - warned |= warning (OPT_Wattributes, - "inline declaration of %qD follows " - "declaration with attribute noinline", newdecl); - } + warned |= warning (OPT_Wattributes, + "inline declaration of %qD follows " + "declaration with attribute noinline", newdecl); else if (DECL_DECLARED_INLINE_P (olddecl) && lookup_attribute ("noinline", DECL_ATTRIBUTES (newdecl))) - { - warned |= warning (OPT_Wattributes, - "declaration of %q+D with attribute " - "noinline follows inline declaration ", newdecl); - } + warned |= warning (OPT_Wattributes, + "declaration of %q+D with attribute " + "noinline follows inline declaration ", newdecl); + else if (lookup_attribute ("noinline", DECL_ATTRIBUTES (newdecl)) + && lookup_attribute ("always_inline", DECL_ATTRIBUTES (olddecl))) + warned |= warning (OPT_Wattributes, + "declaration of %q+D with attribute " + "%qs follows declaration with attribute %qs", + newdecl, "noinline", "always_inline"); + else if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (newdecl)) + && lookup_attribute ("noinline", DECL_ATTRIBUTES (olddecl))) + warned |= warning (OPT_Wattributes, + "declaration of %q+D with attribute " + "%qs follows declaration with attribute %qs", + newdecl, "always_inline", "noinline"); + else if (lookup_attribute ("cold", DECL_ATTRIBUTES (newdecl)) + && lookup_attribute ("hot", DECL_ATTRIBUTES (olddecl))) + warned |= warning (OPT_Wattributes, + "declaration of %q+D with attribute %qs follows " + "declaration with attribute %qs", newdecl, "cold", + "hot"); + else if (lookup_attribute ("hot", DECL_ATTRIBUTES (newdecl)) + && lookup_attribute ("cold", DECL_ATTRIBUTES (olddecl))) + warned |= warning (OPT_Wattributes, + "declaration of %q+D with attribute %qs follows " + "declaration with attribute %qs", newdecl, "hot", + "cold"); } else /* PARM_DECL, VAR_DECL */ { diff --git a/gcc/testsuite/gcc.dg/pr18079-2.c b/gcc/testsuite/gcc.dg/pr18079-2.c new file mode 100644 index 0000000..5091dd41b --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr18079-2.c @@ -0,0 +1,16 @@ +/* PR c/18079 */ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +__attribute__ ((always_inline)) void fndecl1 (void); +__attribute__ ((noinline)) void fndecl1 (void); /* { dg-warning "attribute noinline follows declaration with attribute always_inline" } */ + +__attribute__ ((noinline)) void fndecl2 (void); +__attribute__ ((always_inline)) void fndecl2 (void); /* { dg-warning "attribute always_inline follows declaration with attribute noinline" } */ + + +__attribute__ ((hot)) void fndecl3 (void); +__attribute__ ((cold)) void fndecl3 (void); /* { dg-warning "attribute cold follows declaration with attribute hot" } */ + +__attribute__ ((cold)) void fndecl4 (void); +__attribute__ ((hot)) void fndecl4 (void); /* { dg-warning "attribute hot follows declaration with attribute cold" } */ diff --git a/gcc/testsuite/gcc.dg/pr18079.c b/gcc/testsuite/gcc.dg/pr18079.c new file mode 100644 index 0000000..b84cdeb --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr18079.c @@ -0,0 +1,33 @@ +/* PR c/18079 */ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +__attribute__ ((noinline)) +__attribute__ ((always_inline)) +int +fn1 (int r) +{ /* { dg-warning "attribute ignored due to conflict" } */ + return r & 4; +} + +__attribute__ ((noinline, always_inline)) +int +fn2 (int r) +{ /* { dg-warning "attribute ignored due to conflict" } */ + return r & 4; +} + +__attribute__ ((always_inline)) +__attribute__ ((noinline)) +inline int +fn3 (int r) +{ /* { dg-warning "attribute ignored due to conflict" } */ + return r & 8; +} + +__attribute__ ((always_inline, noinline)) +inline int +fn4 (int r) +{ /* { dg-warning "attribute ignored due to conflict" } */ + return r & 8; +} commit d0c5249511a243b18468e025013bed267ff36026 Author: uros Date: Fri Apr 25 10:51:24 2014 +0000 * c-c++-common/gomp/pr60823-2.c: Require effective target vect_simd_clones. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209795 138bc75d-0d04-0410-961f-82ee72b054a4 diff --git a/gcc/testsuite/c-c++-common/gomp/pr60823-2.c b/gcc/testsuite/c-c++-common/gomp/pr60823-2.c index e0bf570..4c87620 100644 --- a/gcc/testsuite/c-c++-common/gomp/pr60823-2.c +++ b/gcc/testsuite/c-c++-common/gomp/pr60823-2.c @@ -1,5 +1,6 @@ /* PR tree-optimization/60823 */ /* { dg-do run } */ +/* { dg-require-effective-target vect_simd_clones } */ /* { dg-options "-O2 -fopenmp-simd" } */ #pragma omp declare simd simdlen(4) notinbranch commit adc93f318aa9da3277035ea5a1179a1e07c2a967 Author: mpolacek Date: Fri Apr 25 10:49:56 2014 +0000 PR c/60114 c/ * c-parser.c (c_parser_initelt): Pass input_location to process_init_element. (c_parser_initval): Pass loc to process_init_element. * c-tree.h (process_init_element): Adjust declaration. * c-typeck.c (push_init_level): Pass input_location to process_init_element. (pop_init_level): Likewise. (set_designator): Likewise. (output_init_element): Add location_t parameter. Pass loc to digest_init. (output_pending_init_elements): Pass input_location to output_init_element. (process_init_element): Add location_t parameter. Pass loc to output_init_element. testsuite/ * gcc.dg/pr60114.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209794 138bc75d-0d04-0410-961f-82ee72b054a4 diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index c229bdb..56f79f6 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -4219,7 +4219,8 @@ c_parser_initelt (c_parser *parser, struct obstack * braced_init_obstack) init.original_type = NULL; c_parser_error (parser, "expected identifier"); c_parser_skip_until_found (parser, CPP_COMMA, NULL); - process_init_element (init, false, braced_init_obstack); + process_init_element (input_location, init, false, + braced_init_obstack); return; } } @@ -4351,7 +4352,8 @@ c_parser_initelt (c_parser *parser, struct obstack * braced_init_obstack) init.original_type = NULL; c_parser_error (parser, "expected %<=%>"); c_parser_skip_until_found (parser, CPP_COMMA, NULL); - process_init_element (init, false, braced_init_obstack); + process_init_element (input_location, init, false, + braced_init_obstack); return; } } @@ -4372,18 +4374,19 @@ c_parser_initval (c_parser *parser, struct c_expr *after, { struct c_expr init; gcc_assert (!after || c_dialect_objc ()); + location_t loc = c_parser_peek_token (parser)->location; + if (c_parser_next_token_is (parser, CPP_OPEN_BRACE) && !after) init = c_parser_braced_init (parser, NULL_TREE, true); else { - location_t loc = c_parser_peek_token (parser)->location; init = c_parser_expr_no_commas (parser, after); if (init.value != NULL_TREE && TREE_CODE (init.value) != STRING_CST && TREE_CODE (init.value) != COMPOUND_LITERAL_EXPR) init = convert_lvalue_to_rvalue (loc, init, true, true); } - process_init_element (init, false, braced_init_obstack); + process_init_element (loc, init, false, braced_init_obstack); } /* Parse a compound statement (possibly a function body) (C90 6.6.2, diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h index 85df885..53768d6 100644 --- a/gcc/c/c-tree.h +++ b/gcc/c/c-tree.h @@ -612,7 +612,8 @@ extern void push_init_level (int, struct obstack *); extern struct c_expr pop_init_level (int, struct obstack *); extern void set_init_index (tree, tree, struct obstack *); extern void set_init_label (tree, struct obstack *); -extern void process_init_element (struct c_expr, bool, struct obstack *); +extern void process_init_element (location_t, struct c_expr, bool, + struct obstack *); extern tree build_compound_literal (location_t, tree, tree, bool); extern void check_compound_literal_type (location_t, struct c_type_name *); extern tree c_start_case (location_t, location_t, tree); diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 65aad45..62c72df 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -102,8 +102,8 @@ static int spelling_length (void); static char *print_spelling (char *); static void warning_init (int, const char *); static tree digest_init (location_t, tree, tree, tree, bool, bool, int); -static void output_init_element (tree, tree, bool, tree, tree, int, bool, - struct obstack *); +static void output_init_element (location_t, tree, tree, bool, tree, tree, int, + bool, struct obstack *); static void output_pending_init_elements (int, struct obstack *); static int set_designator (int, struct obstack *); static void push_range_stack (tree, struct obstack *); @@ -7183,13 +7183,15 @@ push_init_level (int implicit, struct obstack * braced_init_obstack) if ((TREE_CODE (constructor_type) == RECORD_TYPE || TREE_CODE (constructor_type) == UNION_TYPE) && constructor_fields == 0) - process_init_element (pop_init_level (1, braced_init_obstack), + process_init_element (input_location, + pop_init_level (1, braced_init_obstack), true, braced_init_obstack); else if (TREE_CODE (constructor_type) == ARRAY_TYPE && constructor_max_index && tree_int_cst_lt (constructor_max_index, constructor_index)) - process_init_element (pop_init_level (1, braced_init_obstack), + process_init_element (input_location, + pop_init_level (1, braced_init_obstack), true, braced_init_obstack); else break; @@ -7389,10 +7391,9 @@ pop_init_level (int implicit, struct obstack * braced_init_obstack) /* When we come to an explicit close brace, pop any inner levels that didn't have explicit braces. */ while (constructor_stack->implicit) - { - process_init_element (pop_init_level (1, braced_init_obstack), - true, braced_init_obstack); - } + process_init_element (input_location, + pop_init_level (1, braced_init_obstack), + true, braced_init_obstack); gcc_assert (!constructor_range_stack); } @@ -7570,10 +7571,9 @@ set_designator (int array, struct obstack * braced_init_obstack) /* Designator list starts at the level of closest explicit braces. */ while (constructor_stack->implicit) - { - process_init_element (pop_init_level (1, braced_init_obstack), - true, braced_init_obstack); - } + process_init_element (input_location, + pop_init_level (1, braced_init_obstack), + true, braced_init_obstack); constructor_designated = 1; return 0; } @@ -8193,9 +8193,9 @@ find_init_member (tree field, struct obstack * braced_init_obstack) existing initializer. */ static void -output_init_element (tree value, tree origtype, bool strict_string, tree type, - tree field, int pending, bool implicit, - struct obstack * braced_init_obstack) +output_init_element (location_t loc, tree value, tree origtype, + bool strict_string, tree type, tree field, int pending, + bool implicit, struct obstack * braced_init_obstack) { tree semantic_type = NULL_TREE; bool maybe_const = true; @@ -8293,8 +8293,8 @@ output_init_element (tree value, tree origtype, bool strict_string, tree type, if (semantic_type) value = build1 (EXCESS_PRECISION_EXPR, semantic_type, value); - value = digest_init (input_location, type, value, origtype, npc, - strict_string, require_constant_value); + value = digest_init (loc, type, value, origtype, npc, strict_string, + require_constant_value); if (value == error_mark_node) { constructor_erroneous = 1; @@ -8421,8 +8421,8 @@ output_pending_init_elements (int all, struct obstack * braced_init_obstack) { if (tree_int_cst_equal (elt->purpose, constructor_unfilled_index)) - output_init_element (elt->value, elt->origtype, true, - TREE_TYPE (constructor_type), + output_init_element (input_location, elt->value, elt->origtype, + true, TREE_TYPE (constructor_type), constructor_unfilled_index, 0, false, braced_init_obstack); else if (tree_int_cst_lt (constructor_unfilled_index, @@ -8476,8 +8476,8 @@ output_pending_init_elements (int all, struct obstack * braced_init_obstack) if (tree_int_cst_equal (elt_bitpos, ctor_unfilled_bitpos)) { constructor_unfilled_fields = elt->purpose; - output_init_element (elt->value, elt->origtype, true, - TREE_TYPE (elt->purpose), + output_init_element (input_location, elt->value, elt->origtype, + true, TREE_TYPE (elt->purpose), elt->purpose, 0, false, braced_init_obstack); } @@ -8550,7 +8550,7 @@ output_pending_init_elements (int all, struct obstack * braced_init_obstack) existing initializer. */ void -process_init_element (struct c_expr value, bool implicit, +process_init_element (location_t loc, struct c_expr value, bool implicit, struct obstack * braced_init_obstack) { tree orig_value = value.value; @@ -8594,14 +8594,14 @@ process_init_element (struct c_expr value, bool implicit, if ((TREE_CODE (constructor_type) == RECORD_TYPE || TREE_CODE (constructor_type) == UNION_TYPE) && constructor_fields == 0) - process_init_element (pop_init_level (1, braced_init_obstack), + process_init_element (loc, pop_init_level (1, braced_init_obstack), true, braced_init_obstack); else if ((TREE_CODE (constructor_type) == ARRAY_TYPE || TREE_CODE (constructor_type) == VECTOR_TYPE) && constructor_max_index && tree_int_cst_lt (constructor_max_index, constructor_index)) - process_init_element (pop_init_level (1, braced_init_obstack), + process_init_element (loc, pop_init_level (1, braced_init_obstack), true, braced_init_obstack); else break; @@ -8679,7 +8679,7 @@ process_init_element (struct c_expr value, bool implicit, if (value.value) { push_member_name (constructor_fields); - output_init_element (value.value, value.original_type, + output_init_element (loc, value.value, value.original_type, strict_string, fieldtype, constructor_fields, 1, implicit, braced_init_obstack); @@ -8771,7 +8771,7 @@ process_init_element (struct c_expr value, bool implicit, if (value.value) { push_member_name (constructor_fields); - output_init_element (value.value, value.original_type, + output_init_element (loc, value.value, value.original_type, strict_string, fieldtype, constructor_fields, 1, implicit, braced_init_obstack); @@ -8823,7 +8823,7 @@ process_init_element (struct c_expr value, bool implicit, if (value.value) { push_array_bounds (tree_to_uhwi (constructor_index)); - output_init_element (value.value, value.original_type, + output_init_element (loc, value.value, value.original_type, strict_string, elttype, constructor_index, 1, implicit, braced_init_obstack); @@ -8858,7 +8858,7 @@ process_init_element (struct c_expr value, bool implicit, { if (TREE_CODE (value.value) == VECTOR_CST) elttype = TYPE_MAIN_VARIANT (constructor_type); - output_init_element (value.value, value.original_type, + output_init_element (loc, value.value, value.original_type, strict_string, elttype, constructor_index, 1, implicit, braced_init_obstack); @@ -8887,7 +8887,7 @@ process_init_element (struct c_expr value, bool implicit, else { if (value.value) - output_init_element (value.value, value.original_type, + output_init_element (loc, value.value, value.original_type, strict_string, constructor_type, NULL_TREE, 1, implicit, braced_init_obstack); @@ -8906,8 +8906,8 @@ process_init_element (struct c_expr value, bool implicit, while (constructor_stack != range_stack->stack) { gcc_assert (constructor_stack->implicit); - process_init_element (pop_init_level (1, - braced_init_obstack), + process_init_element (loc, + pop_init_level (1, braced_init_obstack), true, braced_init_obstack); } for (p = range_stack; @@ -8915,7 +8915,8 @@ process_init_element (struct c_expr value, bool implicit, p = p->prev) { gcc_assert (constructor_stack->implicit); - process_init_element (pop_init_level (1, braced_init_obstack), + process_init_element (loc, + pop_init_level (1, braced_init_obstack), true, braced_init_obstack); } diff --git a/gcc/testsuite/gcc.dg/pr60114.c b/gcc/testsuite/gcc.dg/pr60114.c new file mode 100644 index 0000000..83f9852 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr60114.c @@ -0,0 +1,31 @@ +/* PR c/60114 */ +/* { dg-do compile } */ +/* { dg-options "-Wconversion" } */ + +struct S { int n, u[2]; }; +const char z[] = { + [0] = 0x100, /* { dg-warning "9:overflow in implicit constant conversion" } */ + [2] = 0x101, /* { dg-warning "9:overflow in implicit constant conversion" } */ +}; +int A[] = { + 0, 0x80000000, /* { dg-warning "16:conversion of unsigned constant value to negative integer" } */ + 0xA, 0x80000000, /* { dg-warning "18:conversion of unsigned constant value to negative integer" } */ + 0xA, 0xA, 0x80000000 /* { dg-warning "23:conversion of unsigned constant value to negative integer" } */ + }; +int *p = (int []) { 0x80000000 }; /* { dg-warning "21:conversion of unsigned constant value to negative integer" } */ +union { int k; } u = { .k = 0x80000000 }; /* { dg-warning "29:conversion of unsigned constant value to negative integer" } */ +typedef int H[]; +void +foo (void) +{ + char a[][3] = { { 0x100, /* { dg-warning "21:overflow in implicit constant conversion" } */ + 1, 0x100 }, /* { dg-warning "24:overflow in implicit constant conversion" } */ + { '\0', 0x100, '\0' } /* { dg-warning "27:overflow in implicit constant conversion" } */ + }; + (const char []) { 0x100 }; /* { dg-warning "21:overflow in implicit constant conversion" } */ + (const float []) { 1e0, 1e1, 1e100 }; /* { dg-warning "32:conversion" } */ + struct S s1 = { 0x80000000 }; /* { dg-warning "19:conversion of unsigned constant value to negative integer" } */ + struct S s2 = { .n = 0x80000000 }; /* { dg-warning "24:conversion of unsigned constant value to negative integer" } */ + struct S s3 = { .u[1] = 0x80000000 }; /* { dg-warning "27:conversion of unsigned constant value to negative integer" } */ + H h = { 1, 2, 0x80000000 }; /* { dg-warning "17:conversion of unsigned constant value to negative integer" } */ +} commit 49eafa822f36dcbcf388c1fcff5ae0f0863cb8f8 Author: ebotcazou Date: Fri Apr 25 10:39:14 2014 +0000 PR target/60941 * config/sparc/sparc.md (ashlsi3_extend): Delete. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209790 138bc75d-0d04-0410-961f-82ee72b054a4 diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md index 8b6c647..e2a4669 100644 --- a/gcc/config/sparc/sparc.md +++ b/gcc/config/sparc/sparc.md @@ -5795,19 +5795,6 @@ } [(set_attr "type" "shift")]) -(define_insn "*ashlsi3_extend" - [(set (match_operand:DI 0 "register_operand" "=r") - (zero_extend:DI - (ashift:SI (match_operand:SI 1 "register_operand" "r") - (match_operand:SI 2 "arith_operand" "rI"))))] - "TARGET_ARCH64" -{ - if (GET_CODE (operands[2]) == CONST_INT) - operands[2] = GEN_INT (INTVAL (operands[2]) & 0x1f); - return "sll\t%1, %2, %0"; -} - [(set_attr "type" "shift")]) - (define_expand "ashldi3" [(set (match_operand:DI 0 "register_operand" "=r") (ashift:DI (match_operand:DI 1 "register_operand" "r") diff --git a/gcc/testsuite/gcc.c-torture/execute/20140425-1.c b/gcc/testsuite/gcc.c-torture/execute/20140425-1.c new file mode 100644 index 0000000..c447ef9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20140425-1.c @@ -0,0 +1,23 @@ +/* PR target/60941 */ +/* Reported by Martin Husemann */ + +extern void abort (void); + +static void __attribute__((noinline)) +set (unsigned long *l) +{ + *l = 31; +} + +int main (void) +{ + unsigned long l; + int i; + + set (&l); + i = (int) l; + l = (unsigned long)(2U << i); + if (l != 0) + abort (); + return 0; +}