public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][testsuite] Fix gcc.dg/pr60114.c on arm/aarch64
@ 2014-04-28 11:21 Kyrill Tkachov
  2014-04-28 12:10 ` Marek Polacek
  0 siblings, 1 reply; 2+ messages in thread
From: Kyrill Tkachov @ 2014-04-28 11:21 UTC (permalink / raw)
  To: GCC Patches; +Cc: polacek

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

Hi all,

I noticed this test is failing on aarch64:

FAIL: gcc.dg/pr60114.c  (test for warnings, line 7)
FAIL: gcc.dg/pr60114.c  (test for warnings, line 8)
FAIL: gcc.dg/pr60114.c  (test for warnings, line 21)
FAIL: gcc.dg/pr60114.c  (test for warnings, line 22)
FAIL: gcc.dg/pr60114.c  (test for warnings, line 23)
FAIL: gcc.dg/pr60114.c  (test for warnings, line 25)
FAIL: gcc.dg/pr60114.c (test for excess errors)

The test was recently added with 
http://gcc.gnu.org/ml/gcc-patches/2014-02/msg00592.html

The offending code is of the form:


const char z[] = {
   [0] = 0x100, /* { dg-warning "9:overflow in implicit constant conversion" } */
   [2] = 0x101, /* { dg-warning "9:overflow in implicit constant conversion" } */
};


On aarch64 (and arm) chars are unsigned by default so instead we get the warning 
"large integer implicitly truncated to unsigned type".

This patch explicitly uses signed chars in the test as suggested by richi in the PR.

Ok for trunk?

Thanks,
Kyrill

2014-04-28  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     PR c/60983
     * gcc.dg/pr60114.c: Use signed chars.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: test-overflow.patch --]
[-- Type: text/x-patch; name=test-overflow.patch, Size: 1505 bytes --]

diff --git a/gcc/testsuite/gcc.dg/pr60114.c b/gcc/testsuite/gcc.dg/pr60114.c
index 83f9852..c656a95 100644
--- a/gcc/testsuite/gcc.dg/pr60114.c
+++ b/gcc/testsuite/gcc.dg/pr60114.c
@@ -3,7 +3,7 @@
 /* { dg-options "-Wconversion" } */
 
 struct S { int n, u[2]; };
-const char z[] = {
+const signed char z[] = {
   [0] = 0x100, /* { dg-warning "9:overflow in implicit constant conversion" } */
   [2] = 0x101, /* { dg-warning "9:overflow in implicit constant conversion" } */
 };
@@ -18,11 +18,11 @@ typedef int H[];
 void
 foo (void)
 {
-  char a[][3] = { { 0x100, /* { dg-warning "21:overflow in implicit constant conversion" } */
+  signed char a[][3] = { { 0x100, /* { dg-warning "28: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 signed char []) { 0x100 }; /* { dg-warning "28: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" } */

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH][testsuite] Fix gcc.dg/pr60114.c on arm/aarch64
  2014-04-28 11:21 [PATCH][testsuite] Fix gcc.dg/pr60114.c on arm/aarch64 Kyrill Tkachov
@ 2014-04-28 12:10 ` Marek Polacek
  0 siblings, 0 replies; 2+ messages in thread
From: Marek Polacek @ 2014-04-28 12:10 UTC (permalink / raw)
  To: Kyrill Tkachov; +Cc: GCC Patches

On Mon, Apr 28, 2014 at 12:18:05PM +0100, Kyrill Tkachov wrote:
> Hi all,
> 
> I noticed this test is failing on aarch64:
> 
> FAIL: gcc.dg/pr60114.c  (test for warnings, line 7)
> FAIL: gcc.dg/pr60114.c  (test for warnings, line 8)
> FAIL: gcc.dg/pr60114.c  (test for warnings, line 21)
> FAIL: gcc.dg/pr60114.c  (test for warnings, line 22)
> FAIL: gcc.dg/pr60114.c  (test for warnings, line 23)
> FAIL: gcc.dg/pr60114.c  (test for warnings, line 25)
> FAIL: gcc.dg/pr60114.c (test for excess errors)
> 
> The test was recently added with
> http://gcc.gnu.org/ml/gcc-patches/2014-02/msg00592.html
 
Sorry, I tested x86_64, both -m64 and -m32, but I don't test ARM.

> The offending code is of the form:
> 
> 
> const char z[] = {
>   [0] = 0x100, /* { dg-warning "9:overflow in implicit constant conversion" } */
>   [2] = 0x101, /* { dg-warning "9:overflow in implicit constant conversion" } */
> };
> 
> 
> On aarch64 (and arm) chars are unsigned by default so instead we get
> the warning "large integer implicitly truncated to unsigned type".
> 
> This patch explicitly uses signed chars in the test as suggested by richi in the PR.
> 
> Ok for trunk?

Looks good.

	Marek

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-28 12:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-28 11:21 [PATCH][testsuite] Fix gcc.dg/pr60114.c on arm/aarch64 Kyrill Tkachov
2014-04-28 12:10 ` Marek Polacek

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).