[testsuite,tentative] Explicitly disable pointer <-> int cast warnings for avr?

Submitted by Senthil Kumar Selvaraj on July 20, 2016, 5:37 a.m.

Details

Message ID 87k2ggj2dv.fsf@atmel.com
State New
Headers show

Commit Message

Senthil Kumar Selvaraj July 20, 2016, 5:37 a.m.
Hi,

  The patch fixes a couple of testsuite failures that show up for the
  avr target because it has different sizes for longs and pointers (4
  bytes versus 2), by explicitly disabling the warning for avr.

  Does this make sense? Skipping the test by requiring ptr32plus would
  have worked, but this lets the test run for avr and for compile tests
  that don't look at output, nothing should hopefully break. Is this a
  good strategy in general?

Regards
Senthil

Comments

Mike Stump July 20, 2016, 5:11 p.m.
On Jul 19, 2016, at 10:37 PM, Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com> wrote:
>  The patch fixes a couple of testsuite failures that show up for the
>  avr target because it has different sizes for longs and pointers (4
>  bytes versus 2), by explicitly disabling the warning for avr.
> 
>  Does this make sense?

I don't feel too strongly about it, but it would be nice either to have a cast in the code to the target type to shut it up, or alternatively, use the intptr_t type so that that the sizes are the same.  Since this is compile only, a cast would work.  As a general rule, if a test case runs, I think we'd need the intptr_t type involved.

Can you give that a try, as then we don't have to have any special flags for any target and the test case is then more portable?

If the edits are too much, your patch is fine.  I'm hoping someone reduced the test case and it is small with very few changes required, but I didn't look at the test case.

Patch hide | download patch | download mbox

diff --git gcc/testsuite/gcc.dg/torture/pr69352.c gcc/testsuite/gcc.dg/torture/pr69352.c
index ad718b9..cf06383 100644
--- gcc/testsuite/gcc.dg/torture/pr69352.c
+++ gcc/testsuite/gcc.dg/torture/pr69352.c
@@ -1,4 +1,5 @@ 
 /* { dg-do compile } */
+/* { dg-additional-options "-Wno-pointer-to-int-cast" { target { "avr-*-*" } } } */
 
 int a[10][14], b, c, d, e, f, g, h, i;
 void bar (void);
diff --git gcc/testsuite/gcc.dg/torture/pr71866.c gcc/testsuite/gcc.dg/torture/pr71866.c
index e1b36cb..c074ad4 100644
--- gcc/testsuite/gcc.dg/torture/pr71866.c
+++ gcc/testsuite/gcc.dg/torture/pr71866.c
@@ -1,5 +1,6 @@ 
 /* { dg-do compile } */
 /* { dg-additional-options "-ftree-pre -fcode-hoisting" } */
+/* { dg-additional-options "-Wno-int-to-pointer-cast" { target { "avr-*-*" } } } */
 
 typedef unsigned char u8;
 extern unsigned long pci_io_base;