public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH 5/5] MSP430: Skip index-1.c test
Date: Thu, 23 Jul 2020 16:57:09 +0100	[thread overview]
Message-ID: <20200723155709.djdmun6uuoxkdjzu@jozef-acer-manjaro> (raw)
In-Reply-To: <20200723154356.63ws2xairlmdufji@jozef-acer-manjaro>

[-- Attachment #1: Type: text/plain, Size: 521 bytes --]

To access the "n - 100000"th element of "a" in this test, GCC will
generate the following code for msp430-elf with -mcpu=msp430x:

  RLAM.W  #1, R12
  MOV.W a-3392(R12), R12

Since there aren't actually 100,000 elements in a, this means that
"a-3392" offset calculated by the linker can overflow, as the address of
"a" can validly be less than 3392.

The relocations used for -mcpu=msp430 and -mlarge are not as strict and
the calculated value is allowed to wrap around the address space,
avoiding relocation overflows.


[-- Attachment #2: 0005-MSP430-Skip-index-1.c-test.patch --]
[-- Type: text/plain, Size: 1364 bytes --]

From bfafc633013952c1a5cac2dbb10b774f66be920e Mon Sep 17 00:00:00 2001
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
Date: Thu, 16 Jul 2020 11:35:25 +0100
Subject: [PATCH 5/5] MSP430: Skip index-1.c test

To access the "n - 100000"th element of "a" in this test, GCC will
generate the following code for msp430-elf with -mcpu=msp430x:

  RLAM.W  #1, R12
  MOV.W a-3392(R12), R12

Since there aren't actually 100,000 elements in a, this means that
"a-3392" offset calculated by the linker can overflow, as the address of
"a" can validly be less than 3392.

The relocations used for -mcpu=msp430 and -mlarge are not as strict and
the calculated value is allowed to wrap around the address space,
avoiding relocation overflows.

gcc/testsuite/ChangeLog:

	* gcc.c-torture/execute/index-1.c: Skip for the default MSP430 430X ISA.
---
 gcc/testsuite/gcc.c-torture/execute/index-1.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/testsuite/gcc.c-torture/execute/index-1.c b/gcc/testsuite/gcc.c-torture/execute/index-1.c
index b00090d834a..d96be4c77b8 100644
--- a/gcc/testsuite/gcc.c-torture/execute/index-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/index-1.c
@@ -1,3 +1,5 @@
+/* { dg-skip-if "strict reloc overflow checking" { msp430-*-* } { "*" } { "-mcpu=msp430" "-mlarge"} } */
+
 int a[] =
 {
   0,  1,  2,  3,  4,  5,  6,  7,  8,  9,
-- 
2.27.0


  parent reply	other threads:[~2020-07-23 15:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-23 15:43 [PATCH 0/5] MSP430: Implement macros to describe relative costs of operations Jozef Lawrynowicz
2020-07-23 15:47 ` [PATCH 1/5] MSP430: Implement TARGET_MEMORY_MOVE_COST Jozef Lawrynowicz
2020-07-23 15:49 ` [PATCH 2/5] MSP430: Implement TARGET_RTX_COSTS Jozef Lawrynowicz
2020-07-23 15:54 ` [PATCH 3/5] MSP430: Add defaulting to the insn length attribute Jozef Lawrynowicz
2020-07-23 15:56 ` [PATCH 4/5] MSP430: Implement TARGET_INSN_COST Jozef Lawrynowicz
2020-07-23 18:34   ` Segher Boessenkool
2020-07-24 11:50     ` Jozef Lawrynowicz
2020-07-24 12:25       ` Segher Boessenkool
2020-07-23 15:57 ` Jozef Lawrynowicz [this message]
2020-08-07 11:02 ` ping [PATCH 0/5] MSP430: Implement macros to describe relative costs of operations Jozef Lawrynowicz
2020-09-15 20:30   ` ping x2 " Jozef Lawrynowicz
2020-10-14 15:31     ` ping x3 " Jozef Lawrynowicz
2020-11-06 20:51       ` ping x4 " Jozef Lawrynowicz
2020-11-06 20:53     ` ping x2 " Jeff Law
2020-11-06 21:23       ` Jozef Lawrynowicz
2020-11-06 21:29         ` Jeff Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200723155709.djdmun6uuoxkdjzu@jozef-acer-manjaro \
    --to=jozef.l@mittosystems.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).