This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/22020] Poor error message for invalid cast in constant initializer


------- Additional Comments From david at gibson dot dropbear dot id dot au  2005-07-28 12:37 -------
This is arguably a real functionality bug, not just a poor diagnostic.

The compiler will refuse to allow such a truncated address as an initializer,
even when the assembler can generate the necessary relocations.  For example
compare attachment 9378, which will not compile (on powerpc64) to attachment
9379 which assembles and works as intended.

In a more complex example, if x is a (64-bit) symbol and OFFSET a constant, the
assembler will allow:
   y = x - OFFSET
   .long   y
Whereas the compiler will not allow the equivalent initalizer:
   uint32_t x = (uint32_t)((uint64_t)&y - OFFSET);


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22020


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]