From: Richard Biener <richard.guenther@gmail.com>
To: SenthilKumar.Selvaraj@microchip.com
Cc: gcc-patches@gcc.gnu.org, Denis Chertykov <chertykov@gmail.com>
Subject: Re: [PATCH] avr: Set param_min_pagesize to 0 [PR105523]
Date: Wed, 26 Apr 2023 14:19:55 +0200 [thread overview]
Message-ID: <CAFiYyc3PwGh8_BVbnXJ8Gc2aX0YYLm1++DG7juapbv+F8SwHOw@mail.gmail.com> (raw)
In-Reply-To: <8089B1FC-D297-4D78-B11D-6FBB4A7CFFBF@microchip.com>
On Wed, Apr 26, 2023 at 12:56 PM <SenthilKumar.Selvaraj@microchip.com> wrote:
>
> On Wed, Apr 26, 2023 at 3:15 PM Richard Biener via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> >
> > On Wed, Apr 26, 2023 at 11:42 AM Richard Biener
> > <richard.guenther@gmail.com> wrote:
> > >
> > > On Wed, Apr 26, 2023 at 11:01 AM SenthilKumar.Selvaraj--- via
> > > Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> > > >
> > > > 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.
> > >
> > > I think the proper configuration is to have
> > > DEFAULT_ADDR_SPACE_ZERO_ADDRESS_VALID
> >
> > Err, TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID
>
> That worked. Ok for trunk and backporting to 13 and 12 branches
> (pending regression testing)?
OK, but please let Denis time to comment.
Richard.
> Regards,
> Senthil
>
> PR 105523
>
> gcc/ChangeLog:
>
> * config/avr/avr.cc (avr_addr_space_zero_address_valid):
> (TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID): Return true.
>
> 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..5439eb8e55c 100644
> --- a/gcc/config/avr/avr.cc
> +++ b/gcc/config/avr/avr.cc
> @@ -9788,6 +9788,16 @@ avr_addr_space_diagnose_usage (addr_space_t as, location_t loc)
> (void) avr_addr_space_supported_p (as, loc);
> }
>
> +/* Implement `TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID. Zero is a valid
> + address in all address spaces. Even in ADDR_SPACE_FLASH1 etc.,
> + a zero address is valid and means 0x<RAMPZ>0000, where RAMPZ is
> + set to the appropriate segment value. */
> +
> +static bool
> +avr_addr_space_zero_address_valid (addr_space_t as)
> +{
> + return true;
> +}
>
> /* Look if DECL shall be placed in program memory space by
> means of attribute `progmem' or some address-space qualifier.
> @@ -14688,6 +14698,9 @@ avr_float_lib_compare_returns_bool (machine_mode mode, enum rtx_code)
> #undef TARGET_ADDR_SPACE_DIAGNOSE_USAGE
> #define TARGET_ADDR_SPACE_DIAGNOSE_USAGE avr_addr_space_diagnose_usage
>
> +#undef TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID
> +#define TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID avr_addr_space_zero_address_valid
> +
> #undef TARGET_MODE_DEPENDENT_ADDRESS_P
> #define TARGET_MODE_DEPENDENT_ADDRESS_P avr_mode_dependent_address_p
>
> 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;
> +}
>
>
next prev parent reply other threads:[~2023-04-26 12:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-26 9:00 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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFiYyc3PwGh8_BVbnXJ8Gc2aX0YYLm1++DG7juapbv+F8SwHOw@mail.gmail.com \
--to=richard.guenther@gmail.com \
--cc=SenthilKumar.Selvaraj@microchip.com \
--cc=chertykov@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).