gcc generates invalid instructions when it detects a NULL ptr deref - General Discussion and Assistance - CHDK Forum

gcc generates invalid instructions when it detects a NULL ptr deref

  • 0 Replies
  • 2051 Views
*

Offline reyalp

  • ******
  • 14128
Advertisements
Just FYI
https://bugs.launchpad.net/gcc-arm-embedded/+bug/1586033

This is apparently a feature, not a bug  >:(

Of course this only applies to NULLs that can be detected at compile time, but it's "smart" enough to do this if you do

if(x == NULL)
 y=*x;

So if you actually want to read address zero, you need to resort to a function call or maybe inline ASM.

edit:
It's smart enough to detect some function calls too.

edit:
Or maybe compiler options https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63803
« Last Edit: 23 / April / 2017, 19:33:59 by reyalp »
Don't forget what the H stands for.

 

Related Topics


SimplePortal © 2008-2014, SimplePortal