public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jankowski938 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/106582] Wrong code generation resulting in HardFault
Date: Thu, 11 Aug 2022 21:10:52 +0000	[thread overview]
Message-ID: <bug-106582-4-TPlmgUlHFl@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106582-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from Piotr <jankowski938 at gmail dot com> ---
(In reply to Andrew Pinski from comment #4)
> >
> 080157fe:   movs    r3, #0
> 08015800:   ldr.w   r2, [r9, #20]
> 08015804:   str     r2, [r3, #12]
> 
> This is doing a store at the address 12 which is invalid normally.
> I suspect for your code you need -fno-delete-null-pointer-checks .
> 
> Or you are missing a null pointer check.
> 
> The code does:
>    if (pQueryChunk && ioIsValid(pRawChunk))
>    {
>     pQueryChunk->pSrcDriver = pRawChunk->pSrcDriver;
>    }
>    else
>    {
>     if (pParser)
>     {
>      pQueryChunk->pSrcDriver = pParser->pSourceDriver;
>     }
>    }
> 
> But the store for "pQueryChunk->pSrcDriver" is not checked to see if
> pQueryChunk was a non-null pointer before doing the store after the check
> that pParser was a non-null pointer.
> 
> 
> That is I don't think this is a bug in GCC.

Thank you for debugging our code :) 

1. that chunk was vetted earlier in this function, so there is no need to check
it again here.
2. Offset 12 is not invalid as it is a 32bits (not 64) platform and it is
natively aligned

  parent reply	other threads:[~2022-08-11 21:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-11  8:47 [Bug c/106582] New: " jankowski938 at gmail dot com
2022-08-11  9:49 ` [Bug c/106582] " rguenth at gcc dot gnu.org
2022-08-11 10:17 ` jankowski938 at gmail dot com
2022-08-11 10:19 ` jankowski938 at gmail dot com
2022-08-11 14:43 ` pinskia at gcc dot gnu.org
2022-08-11 21:10 ` jankowski938 at gmail dot com [this message]
2022-08-11 21:29 ` [Bug middle-end/106582] " jankowski938 at gmail dot com
2022-08-11 21:49 ` pinskia at gcc dot gnu.org
2022-08-12  6:37 ` rguenth 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-106582-4-TPlmgUlHFl@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).