[Bug middle-end/106582] Wrong code generation resulting in HardFault
jankowski938 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Aug 11 21:10:52 GMT 2022
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
More information about the Gcc-bugs
mailing list