aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorGeorg-Johann Lay <avr@gjlay.de>2024-12-03 14:19:40 +0100
committerGeorg-Johann Lay <avr@gjlay.de>2024-12-03 21:52:06 +0100
commitb6a43fe2c5498f823b5df735a4702f35a812e5bd (patch)
tree8a1b3ede7f40ca0abf0073da7a8763f7302c097c /gcc/testsuite
parent96f5fd3089075b56ea9ea85060213cc4edd7251a (diff)
downloadgcc-b6a43fe2c5498f823b5df735a4702f35a812e5bd.zip
gcc-b6a43fe2c5498f823b5df735a4702f35a812e5bd.tar.gz
gcc-b6a43fe2c5498f823b5df735a4702f35a812e5bd.tar.bz2
AVR: Improve location of late diagnostics.
Some diagnostics are issues late, e.g. in avr_print_operand(). This patch uses the insn's location as a proxy for the operand location. Without the patch, the location is usually input_location, which points to the closing } of the function body. gcc/ * config/avr/avr.cc (avr_insn_location): New variable. (avr_final_prescan_insn): Set avr_insn_location. (avr_asm_final_postscan_insn): Unset avr_insn_location after last insn. (avr_print_operand): Pass avr_insn_location to warning_at. gcc/testsuite/ * gcc.dg/Warray-bounds-33.c: Adjust for avr diagnostics. * gcc.dg/pr56228.c: Same. * gcc.dg/pr86124.c: Same. * gcc.dg/pr94291.c: Same. * gcc.dg/tree-ssa/pr82059.c: Same.
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/gcc.dg/Warray-bounds-33.c3
-rw-r--r--gcc/testsuite/gcc.dg/pr56228.c3
-rw-r--r--gcc/testsuite/gcc.dg/pr86124.c3
-rw-r--r--gcc/testsuite/gcc.dg/pr94291.c4
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr82059.c3
5 files changed, 6 insertions, 10 deletions
diff --git a/gcc/testsuite/gcc.dg/Warray-bounds-33.c b/gcc/testsuite/gcc.dg/Warray-bounds-33.c
index 13efabe..5f06471 100644
--- a/gcc/testsuite/gcc.dg/Warray-bounds-33.c
+++ b/gcc/testsuite/gcc.dg/Warray-bounds-33.c
@@ -2,7 +2,6 @@
an object of incomplete type
{ dg-do compile }
{ dg-options "-O2 -Wall" } */
-/* { dg-skip-if "acessing data memory with program memory address" { "avr-*-*" } } */
struct S
{
@@ -30,7 +29,7 @@ void test_incomplete_enum (void)
void test_func (void)
{
struct S *b = (struct S*)&f;
- if (b->s)
+ if (b->s) /* { dg-warning "accessing data memory with program memory address.*" "" { target avr-*-* } } */
f ();
}
diff --git a/gcc/testsuite/gcc.dg/pr56228.c b/gcc/testsuite/gcc.dg/pr56228.c
index 6e2b4b1..79699a2 100644
--- a/gcc/testsuite/gcc.dg/pr56228.c
+++ b/gcc/testsuite/gcc.dg/pr56228.c
@@ -1,7 +1,6 @@
/* PR target/56228 */
/* { dg-do assemble } */
/* { dg-options "-O2" } */
-/* { dg-skip-if "accessing program memory with data memory address" { "avr-*-*" } } */
short a[14] = { 1, 2 };
short b[15] = { 3, 4 };
@@ -11,7 +10,7 @@ foo ()
{
void (*fna) (void) = (void (*) (void)) a;
void (*fnb) (void) = (void (*) (void)) b;
- fna ();
+ fna (); /* { dg-warning "accessing program memory with data memory address.*" "" { target avr-*-* } } */
fnb ();
return a[1] == b[1];
}
diff --git a/gcc/testsuite/gcc.dg/pr86124.c b/gcc/testsuite/gcc.dg/pr86124.c
index c8a66ff..ebcaed7 100644
--- a/gcc/testsuite/gcc.dg/pr86124.c
+++ b/gcc/testsuite/gcc.dg/pr86124.c
@@ -1,6 +1,5 @@
/* { dg-do compile } */
/* { dg-options "-O -fipa-pta" } */
-/* { dg-skip-if "acessing data memory with program memory address" { "avr-*-*" } } */
extern void a (void);
@@ -8,5 +7,5 @@ void b (void)
{
void *c;
c = a;
- *(char *)c = 1;
+ *(char *)c = 1; /* { dg-warning "accessing data memory with program memory address.*" "" { target avr-*-* } } */
}
diff --git a/gcc/testsuite/gcc.dg/pr94291.c b/gcc/testsuite/gcc.dg/pr94291.c
index 7d9331b..400524c 100644
--- a/gcc/testsuite/gcc.dg/pr94291.c
+++ b/gcc/testsuite/gcc.dg/pr94291.c
@@ -1,7 +1,6 @@
/* PR rtl-optimization/94291 */
/* { dg-do compile } */
/* { dg-options "-Og" } */
-/* { dg-skip-if "accessing data memory with program memory address" { "avr-*-*" } } */
unsigned a;
@@ -10,6 +9,7 @@ foo (void)
{
unsigned x
= (__builtin_sub_overflow ((long long) a, 0, &x)
- ? 1 : (__INTPTR_TYPE__) __builtin_memmove (&x, foo, 1));
+ ? 1 : (__INTPTR_TYPE__) __builtin_memmove (&x, foo, 1)); /* { dg-warning "accessing data memory with program memory address.*" "" { target avr-*-* } } */
+
return a;
}
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr82059.c b/gcc/testsuite/gcc.dg/tree-ssa/pr82059.c
index 6421101..ffa643f 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr82059.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr82059.c
@@ -1,7 +1,6 @@
/* PR tree-optimization/82059 */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-isolate-paths" } */
-/* { dg-skip-if "accessing data memory with program memory address" { avr-*-* } } */
struct a
{
@@ -19,5 +18,5 @@ h ()
if (!i)
d ();
i->c = &f;
- i->b = *(char *) h;
+ i->b = *(char *) h; /* { dg-warning "accessing data memory with program memory address.*" "" { target avr-*-* } } */
}