diff mbox series

[committed] MSP430: Skip gcc.dg/pr55940.c in the small memory model

Message ID 20200902132120.ugd5gqxwq7w6nnpw@jozef-acer-manjaro
State New
Headers show
Series [committed] MSP430: Skip gcc.dg/pr55940.c in the small memory model | expand

Commit Message

Jozef Lawrynowicz Sept. 2, 2020, 1:21 p.m. UTC
In the MSP430 small memory model, there is a 16-bit address space and
pointer arithmetic wraps around the address space, so any calculated
address is always within this range.

In this test, pointer arithmetic wraps when 0x1000 is added to the
address of a variable, causing the resulting address to be unexpectedly
less than 0x2000, which breaks the test.

Committed as obvious.
From d45a6c7099a346153e970476688be5bd6a016cef Mon Sep 17 00:00:00 2001
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
Date: Wed, 2 Sep 2020 13:42:39 +0100
Subject: [PATCH] MSP430: Skip gcc.dg/pr55940.c in the small memory model

In the MSP430 small memory model, there is a 16-bit address space and
pointer arithmetic wraps around the address space, so any calculated
address is always within this range.

In this test, pointer arithmetic wraps when 0x1000 is added to the
address of a variable, causing the resulting address to be unexpectedly
less than 0x2000, which breaks the test.

gcc/testsuite/ChangeLog:

	* gcc.dg/pr55940.c: Skip for msp430 unless -mlarge is specified.
---
 gcc/testsuite/gcc.dg/pr55940.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.dg/pr55940.c b/gcc/testsuite/gcc.dg/pr55940.c
index d046d0b6912..85761f6c31f 100644
--- a/gcc/testsuite/gcc.dg/pr55940.c
+++ b/gcc/testsuite/gcc.dg/pr55940.c
@@ -1,5 +1,6 @@ 
 /* PR target/55940 */
 /* { dg-do run } */
+/* { dg-skip-if "pointer arithmetic can wrap" { msp430-*-* } { "*" } { "-mlarge" } } */
 /* { dg-options "-Os" } */
 /* { dg-additional-options "-mpreferred-stack-boundary=2" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */