[LLVMdev] C embedded extensions and LLVM

John Regehr regehr at cs.utah.edu
Wed Nov 14 12:48:42 PST 2007

> This should just be a bitcast from one pointer to another pointer type.

Here's a likely counterexample: the AVR (8 bit embedded) has a 
byte-addressed data space and word-addressed code space.

Legal C code involving pointer casts can confuse all known versions of 
avr-gcc into generating bad function pointer code that jumps to twice the 
address of the intended target.  Last I heard there's no real plan to fix 

While the embedded C standard permits a way out where the compiler 
understands that code space and data space pointers are different, I don't 
see any way that pointer casts (for example, from an unqualified pointer 
to either code ptr or data ptr) can be nops.

John Regehr

More information about the llvm-dev mailing list