public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/106582] Wrong code generation resulting in HardFault
Date: Thu, 11 Aug 2022 14:43:33 +0000	[thread overview]
Message-ID: <bug-106582-4-fhZ7c7cgyB@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 #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>
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.

  parent reply	other threads:[~2022-08-11 14:43 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 [this message]
2022-08-11 21:10 ` [Bug middle-end/106582] " jankowski938 at gmail dot com
2022-08-11 21:29 ` 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-fhZ7c7cgyB@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).