On Wed, 2 Nov 2011, DJ Delorie wrote:

> > > Index: configure.ac
> > > +    # Dereferencing -1 is a compile-time error
> > 
> > This (those lines) look a little cryptic (and lack punctuation ;)
> > Wild improvement guess: "Too small 'int'?".
> 
> No, the compiler specifically tests for unaligned accesses and gives a
> compile-time error, at Renesas's requrest.  The chip can't do
> unaligned accesses correctly, but it doesn't fault - it just silently
> accesses the wrong memory.  So the compiler errors instead.

That's not permitted by standard C for code that might not be executed.  
The standard GCC practice if you can determine at compile time that a 
given path will result in undefined behavior at runtime but don't want to 
deduce that this path is unreachable is to generate an abort and output an 
informative notice with inform ().  This is done when float is passed to 
va_arg, for example, or for calling a function through a function pointer 
cast to an incompatible type.

(I don't see what actually generates the error, since there are only two 
calls to error () in the port, both of which I've commented on 
separately.)

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to