public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gjl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/105523] Wrong warning array subscript [0] is outside array bounds
Date: Tue, 25 Apr 2023 19:02:45 +0000	[thread overview]
Message-ID: <bug-105523-4-TUdY3NKpCK@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105523-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523

--- Comment #29 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
(In reply to David Brown from comment #20)
> This is not an AVR backend issue - it is much wider than that.  It is
> perhaps reasonable to test a patch just on the AVR, but this needs to be
> fixed in the core of gcc.

Ok, just the fact that the issue is sitting there for > 1 year now lead me to
the conclusion it's an AVR issue...

On older AVR devices, SFR area starts at 0x20, but on newer devices it starts
at 0x0.  There are devices where 0x0 is actually some SFR address like PINB for
ATtiny10 just to mention one.

At least for AVR, the warning does not make sense for dereferencing volatile
pointers to addresses known at compile time.

But there are also cases for addresses known only at link time, like with AVR
attribute __address__ or __io__.

Hence, for any addresses known at link time or earlier (aka. immediates), the
warning makes no sense to me, because you cannot allocate them, anyways. (And
when you can allocate by means of, say, a memory protection unit, GCC is out of
the game.)

  parent reply	other threads:[~2023-04-25 19:02 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-08 12:12 [Bug c++/105523] New: " klaus.doldinger64 at googlemail dot com
2022-05-08 19:53 ` [Bug target/105523] " pinskia at gcc dot gnu.org
2022-05-09  4:00 ` klaus.doldinger64 at googlemail dot com
2022-05-09  4:54 ` klaus.doldinger64 at googlemail dot com
2022-05-09  6:59 ` klaus.doldinger64 at googlemail dot com
2022-05-11 11:50 ` rudi at heitbaum dot com
2022-10-21  5:57 ` lh_mouse at 126 dot com
2022-11-23 17:49 ` gjl at gcc dot gnu.org
2022-11-23 17:53 ` pinskia at gcc dot gnu.org
2022-11-23 17:56 ` pinskia at gcc dot gnu.org
2022-11-23 18:04 ` lh_mouse at 126 dot com
2022-11-23 18:07 ` pinskia at gcc dot gnu.org
2022-11-23 18:11 ` konrad at silmor dot de
2022-11-24  3:35 ` lh_mouse at 126 dot com
2022-12-07  6:32 ` ahmad at a3f dot at
2023-01-22 23:44 ` westfw at westfw dot info
2023-03-31 10:02 ` dcrocker at eschertech dot com
2023-03-31 20:32 ` pinskia at gcc dot gnu.org
2023-04-24 15:21 ` david at westcontrol dot com
2023-04-24 18:41 ` gjl at gcc dot gnu.org
2023-04-25  7:18 ` david at westcontrol dot com
2023-04-25  7:30 ` david at westcontrol dot com
2023-04-25  7:30 ` lh_mouse at 126 dot com
2023-04-25  7:46 ` david at westcontrol dot com
2023-04-25 16:30 ` pinskia at gcc dot gnu.org
2023-04-25 16:45 ` david at westcontrol dot com
2023-04-25 16:57 ` klaus.doldinger64 at googlemail dot com
2023-04-25 16:58 ` klaus.doldinger64 at googlemail dot com
2023-04-25 17:04 ` pinskia at gcc dot gnu.org
2023-04-25 19:02 ` gjl at gcc dot gnu.org [this message]
2023-04-25 19:07 ` konrad at silmor dot de
2023-04-28  5:17 ` lh_mouse at 126 dot com
2023-04-28  5:25 ` pinskia at gcc dot gnu.org
2023-06-19  8:23 ` cvs-commit at gcc dot gnu.org
2023-08-01 13:45 ` gjl at gcc dot gnu.org
2023-08-09 18:53 ` gjl at gcc dot gnu.org
2024-02-12 17:08 ` cvs-commit at gcc dot gnu.org
2024-02-12 17:10 ` gjl at gcc dot gnu.org

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=bug-105523-4-TUdY3NKpCK@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).