public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] avr: Set param_min_pagesize to 0 [PR105523]
@ 2023-04-26  9:00 SenthilKumar.Selvaraj
  2023-04-26  9:42 ` Richard Biener
  0 siblings, 1 reply; 12+ messages in thread
From: SenthilKumar.Selvaraj @ 2023-04-26  9:00 UTC (permalink / raw)
  To: gcc-patches

Hi,

This patch fixes PR 105523 by setting param_min_pagesize to 0 for the
avr target. For this target, zero and offsets from zero are perfectly
valid addresses, and the default value of param_min_pagesize ends up
triggering warnings on valid memory accesses.

Ok for trunk and backporting to 13 and 12 branches?

Regards
Senthil
    
	PR target/105523
    
	gcc/ChangeLog:
	
			* config/avr/avr.cc (avr_option_override): Set
			param_min_pagesize to 0.
	
	gcc/testsuite/ChangeLog:
	
			* gcc.target/avr/pr105523.c: New test.

diff --git a/gcc/config/avr/avr.cc b/gcc/config/avr/avr.cc
index c193430cf07..3b862f4e4ac 100644
--- a/gcc/config/avr/avr.cc
+++ b/gcc/config/avr/avr.cc
@@ -56,6 +56,7 @@
 #include "tree-pass.h"
 #include "print-rtl.h"
 #include "rtl-iter.h"
+#include "opts.h"
 
 /* This file should be included last.  */
 #include "target-def.h"
@@ -769,6 +770,9 @@ avr_option_override (void)
   avr_gasisr_prologues = 0;
 #endif
 
+  SET_OPTION_IF_UNSET (&global_options, &global_options_set,
+                       param_min_pagesize, 0);
+
   if (!avr_set_core_architecture())
     return;
 
diff --git a/gcc/testsuite/gcc.target/avr/pr105523.c b/gcc/testsuite/gcc.target/avr/pr105523.c
new file mode 100644
index 00000000000..fbbf7bf4422
--- /dev/null
+++ b/gcc/testsuite/gcc.target/avr/pr105523.c
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-options "-Os -Wall" } */
+
+/* Verify no "array subscript 0 is outside array bounds of" is generated
+   for accessing memory addresses in the 0-4096 range. */
+
+typedef __UINT8_TYPE__ uint8_t;
+
+#define SREG (*(volatile uint8_t*) (0x3F + __AVR_SFR_OFFSET__ ))
+
+void bar (void)
+{
+    SREG = 0;
+}


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

end of thread, other threads:[~2023-06-17 16:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-26  9:00 [PATCH] avr: Set param_min_pagesize to 0 [PR105523] SenthilKumar.Selvaraj
2023-04-26  9:42 ` Richard Biener
2023-04-26  9:43   ` Richard Biener
2023-04-26 10:56     ` SenthilKumar.Selvaraj
2023-04-26 12:19       ` Richard Biener
2023-05-19  5:58         ` SenthilKumar.Selvaraj
2023-05-19 14:02           ` Bernhard Reutner-Fischer
2023-05-19 16:51             ` Jeff Law
2023-05-22 12:05           ` Richard Biener
2023-06-02  7:02             ` SenthilKumar.Selvaraj
2023-06-16 10:17               ` [Ping] " SenthilKumar.Selvaraj
2023-06-17 16:56                 ` Jeff Law

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