From patchwork Thu Apr 3 13:27:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charles Baylis X-Patchwork-Id: 27687 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f69.google.com (mail-pa0-f69.google.com [209.85.220.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BEBD820490 for ; Thu, 3 Apr 2014 13:27:58 +0000 (UTC) Received: by mail-pa0-f69.google.com with SMTP id fb1sf6655402pad.8 for ; Thu, 03 Apr 2014 06:27:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mailing-list:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:sender :delivered-to:mime-version:date:message-id:subject:from:to :x-original-sender:x-original-authentication-results:content-type; bh=OvA4YnpMAh4XHUjcnOhuBUJtpHw3NlOggD8LcDVTDRQ=; b=VnNOWM9mLn1eKctLZ9xm2/RkKY7TkwLtZTu7WJv2fgPJGz50j1Jhn2FQ3YQ+P5dnlC 2ytQHnAPXoZ0PgMTSxFxpTu6NGIV9v+fBgu3D1zcwOLy/jmfOuuyBTvhMLbqaZkgsXH+ K7ViWC6ZnLX0B7dsjNV0hLUy7SU20FUO/dHjG9v3V+jZ+cTJNYpotQl0bzE+w+2J66iS EZWIBenyD/qI/pQKRtIOP33c04pOCuZ7nmEvkG3K/38Fc+cNRBbF7rFQ2i9b6Ol/6HFr QHYTxaEovrw8i3Nu+x0cPGSi0Vs12D7kLuX2sVxzfWfSx0qD8oMeSPlB3cTIPdHnTTdy b2IQ== X-Gm-Message-State: ALoCoQkwrJT0pjSHzt2fGmIO+QP1wlqvstBDZKLOw4yLy6/4dhsMo0VIxMwhFhv4feWAUObMIlnS X-Received: by 10.66.137.105 with SMTP id qh9mr1094064pab.30.1396531677408; Thu, 03 Apr 2014 06:27:57 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.17.3 with SMTP id 3ls638322qgc.83.gmail; Thu, 03 Apr 2014 06:27:57 -0700 (PDT) X-Received: by 10.221.27.8 with SMTP id ro8mr2881399vcb.30.1396531677267; Thu, 03 Apr 2014 06:27:57 -0700 (PDT) Received: from mail-ve0-x22c.google.com (mail-ve0-x22c.google.com [2607:f8b0:400c:c01::22c]) by mx.google.com with ESMTPS id yb7si226568vec.109.2014.04.03.06.27.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 03 Apr 2014 06:27:57 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::22c is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::22c; Received: by mail-ve0-f172.google.com with SMTP id jx11so252214veb.31 for ; Thu, 03 Apr 2014 06:27:57 -0700 (PDT) X-Received: by 10.52.78.231 with SMTP id e7mr6490029vdx.28.1396531677156; Thu, 03 Apr 2014 06:27:57 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.12.8 with SMTP id v8csp28121vcv; Thu, 3 Apr 2014 06:27:55 -0700 (PDT) X-Received: by 10.66.185.39 with SMTP id ez7mr2929600pac.134.1396531675466; Thu, 03 Apr 2014 06:27:55 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id tv5si3083558pbc.287.2014.04.03.06.27.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Apr 2014 06:27:55 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-364417-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 23865 invoked by alias); 3 Apr 2014 13:27:43 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list 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 23851 invoked by uid 89); 3 Apr 2014 13:27:42 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-la0-f45.google.com Received: from mail-la0-f45.google.com (HELO mail-la0-f45.google.com) (209.85.215.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 03 Apr 2014 13:27:40 +0000 Received: by mail-la0-f45.google.com with SMTP id hr17so1334530lab.18 for ; Thu, 03 Apr 2014 06:27:37 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.112.52.225 with SMTP id w1mr4535665lbo.22.1396531657312; Thu, 03 Apr 2014 06:27:37 -0700 (PDT) Received: by 10.112.110.104 with HTTP; Thu, 3 Apr 2014 06:27:37 -0700 (PDT) Date: Thu, 3 Apr 2014 14:27:37 +0100 Message-ID: Subject: [PATCH, ARM] Fix PR60609 (Error: value of 256 too large for field of 1 bytes) From: Charles Baylis To: GCC Patches , Richard Earnshaw , Ramana Radhakrishnan X-IsSubscribed: yes X-Original-Sender: charles.baylis@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::22c is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@gcc.gnu.org X-Google-Group-Id: 836684582541 Hi This bug causes the compiler to create a Thumb-2 TBB instruction with a jump table containing an out of range value in a .byte field: whatever.s:148: Error: value of 256 too large for field of 1 bytes at 100 This occurs because the jump table is followed with a ".align 1" due to ASM_OUTPUT_CASE_END, but the 'shorten' phase does not account for the space taken by this align directive. This patch addresses the issue by removing ASM_OUTPUT_CASE_END from arm.h, and ensuring that the alignment after an ADDR_DIFF_VEC is instead inserted by aligning the label following the barrier which follows it. This is achieved by defining LABEL_ALIGN_AFTER_BARRIER appropriately. Bootstrapped/checked on arm-unknown-linux-gnueabihf. OK for trunk, and backporting to 4.8? 2014-04-02 Charles Baylis PR target/60609 * config/arm/arm.h (ASM_OUTPUT_CASE_END) Remove. (LABEL_ALIGN_AFTER_BARRIER) Align barriers which occur after ADDR_DIFF_VEC. 2014-04-02 Charles Baylis PR target/60609 * g++.dg/torture/pr60609.C: New test. >From 9b0c1ada23e2b210b02ebaee2f599bb5205a91d6 Mon Sep 17 00:00:00 2001 From: Charles Baylis Date: Thu, 3 Apr 2014 10:57:33 +0100 Subject: [PATCH] fix for PR target/60609 2014-04-02 Charles Baylis PR target/60609 * config/arm/arm.h (ASM_OUTPUT_CASE_END) Remove. (LABEL_ALIGN_AFTER_BARRIER) Align barriers which occur after ADDR_DIFF_VEC. 2014-04-02 Charles Baylis PR target/60609 * g++.dg/torture/pr60609.C: New test. --- gcc/config/arm/arm.h | 11 +- gcc/testsuite/g++.dg/torture/pr60609.C | 252 +++++++++++++++++++++++++++++++++ 2 files changed, 255 insertions(+), 8 deletions(-) create mode 100644 gcc/testsuite/g++.dg/torture/pr60609.C diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 7ca47a7..a4bbd12 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -2194,14 +2194,9 @@ extern int making_const_table; #undef ASM_OUTPUT_BEFORE_CASE_LABEL #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE, PREFIX, NUM, TABLE) /* Empty. */ -/* Make sure subsequent insns are aligned after a TBB. */ -#define ASM_OUTPUT_CASE_END(FILE, NUM, JUMPTABLE) \ - do \ - { \ - if (GET_MODE (PATTERN (JUMPTABLE)) == QImode) \ - ASM_OUTPUT_ALIGN (FILE, 1); \ - } \ - while (0) +#define LABEL_ALIGN_AFTER_BARRIER(LABEL) \ + (GET_CODE (PATTERN (prev_active_insn (LABEL))) == ADDR_DIFF_VEC \ + ? 1 : 0) #define ARM_DECLARE_FUNCTION_NAME(STREAM, NAME, DECL) \ do \ diff --git a/gcc/testsuite/g++.dg/torture/pr60609.C b/gcc/testsuite/g++.dg/torture/pr60609.C new file mode 100644 index 0000000..9ddec0b --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr60609.C @@ -0,0 +1,252 @@ +/* { dg-do assemble } */ + +class exception +{ +}; +class bad_alloc:exception +{ +}; +class logic_error:exception +{ +}; +class domain_error:logic_error +{ +}; +class invalid_argument:logic_error +{ +}; +class length_error:logic_error +{ +}; +class overflow_error:exception +{ +}; +typedef int mpz_t[]; +template < class > class __gmp_expr; +template <> class __gmp_expr < mpz_t > +{ + ~__gmp_expr (); +}; + +class PIP_Solution_Node; +class internal_exception +{ + ~internal_exception (); +}; +class not_an_integer:internal_exception +{ +}; +class not_a_variable:internal_exception +{ +}; +class not_an_optimization_mode:internal_exception +{ +}; +class not_a_bounded_integer_type_width:internal_exception +{ +}; +class not_a_bounded_integer_type_representation:internal_exception +{ +}; +class not_a_bounded_integer_type_overflow:internal_exception +{ +}; +class not_a_complexity_class:internal_exception +{ +}; +class not_a_control_parameter_name:internal_exception +{ +}; +class not_a_control_parameter_value:internal_exception +{ +}; +class not_a_pip_problem_control_parameter_name:internal_exception +{ +}; +class not_a_pip_problem_control_parameter_value:internal_exception +{ +}; +class not_a_relation:internal_exception +{ +}; +class ppl_handle_mismatch:internal_exception +{ +}; +class timeout_exception +{ + ~timeout_exception (); +}; +class deterministic_timeout_exception:timeout_exception +{ +}; +void __assert_fail (const char *, const char *, int, int *) +__attribute__ ((__noreturn__)); +void PL_get_pointer (void *); +int Prolog_is_address (); +inline int +Prolog_get_address (void **p1) +{ + Prolog_is_address ()? static_cast < + void >(0) : __assert_fail ("Prolog_is_address", "./swi_cfli.hh", 0, 0); + PL_get_pointer (p1); + return 0; +} + +class non_linear:internal_exception +{ +}; +class not_unsigned_integer:internal_exception +{ +}; +class not_universe_or_empty:internal_exception +{ +}; +class not_a_nil_terminated_list:internal_exception +{ +}; +class PPL_integer_out_of_range +{ + __gmp_expr < mpz_t > n; +}; +void handle_exception (); +template < typename T > T * term_to_handle (int, const char *) +{ + if (Prolog_is_address ()) + { + void *p; + Prolog_get_address (&p); + return static_cast < T * >(0); + } + throw; +} + +void +ppl_new_MIP_Problem_from_MIP_Problem () +try +{ + term_to_handle < int >(0, "ppl_new_MIP_Problem_from_MIP_Problem/2"); +} + +catch (exception &) +{ +} + +int +ppl_PIP_Tree_Node_parametric_values () +{ + try + { + PIP_Solution_Node *a = term_to_handle < PIP_Solution_Node > (0, 0); + (void)a; + return 1; + } + catch (internal_exception &) + { + } + catch (not_unsigned_integer &) + { + handle_exception (); + } + catch (non_linear &) + { + handle_exception (); + } + catch (not_a_variable &) + { + handle_exception (); + } + catch (not_an_integer &) + { + handle_exception (); + } + catch (ppl_handle_mismatch &) + { + handle_exception (); + } + catch (not_an_optimization_mode &) + { + handle_exception (); + } + catch (not_a_complexity_class &) + { + handle_exception (); + } + catch (not_a_bounded_integer_type_width &) + { + handle_exception (); + } + catch (not_a_bounded_integer_type_representation &) + { + handle_exception (); + } + catch (not_a_bounded_integer_type_overflow &) + { + handle_exception (); + } + catch (not_a_control_parameter_name &) + { + handle_exception (); + } + catch (not_a_control_parameter_value &) + { + handle_exception (); + } + catch (not_a_pip_problem_control_parameter_name &) + { + handle_exception (); + } + catch (not_a_pip_problem_control_parameter_value &) + { + handle_exception (); + } + catch (not_universe_or_empty &) + { + handle_exception (); + } + catch (not_a_relation &) + { + handle_exception (); + } + catch (not_a_nil_terminated_list &) + { + handle_exception (); + } + catch (PPL_integer_out_of_range &) + { + handle_exception (); + } + catch (int &) + { + } catch (timeout_exception &) + { + handle_exception (); + } catch (deterministic_timeout_exception &) + { + handle_exception (); + } catch (overflow_error &) + { + handle_exception (); + } catch (domain_error &) + { + handle_exception (); + } catch (length_error &) + { + handle_exception (); + } catch (invalid_argument &) + { + handle_exception (); + } catch (logic_error &) + { + handle_exception (); + } catch (bad_alloc &) + { + handle_exception (); + } catch (exception &) + { + handle_exception (); + } catch ( ...) + { + handle_exception (); + } + return 0; +} -- 1.8.3.2