On Tue, Aug 16, 2022, 6:07 PM Chris Johns <chr...@rtems.org> wrote: > On 17/8/2022 6:11 am, Ryan Long wrote: > > Fixed four warnings disabled were for "-Wuse-after-free" and one for a > > "-Wfree-nonheap-object." > > Is this a gcc warning bug? If p1 was used to access the memory the warning > is > right but we are only referencing the address and not the data. It is no > different to: > > void* p = 0x111111111; > printf("P is %p\n", p); > > This is fine and has to be or we could never access any hardware. >
That example is different I think. Semantically after a call to free, the address is no longer valid for any use. Ensuring you don't call another member of the malloc family is a legitimate way to avoid double frees. If we have an issue with a specific use case pattern that GCC is tripping, then we discuss it with them. I'm sure all of these were well thought out. Besides this code is pushing deliberate error conditions so we should not be surprised that the compiler is detecting issues with the code. --joel > > Chris > _______________________________________________ > devel mailing list > devel@rtems.org > http://lists.rtems.org/mailman/listinfo/devel >
_______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel