On Wed, May 25, 2011 at 02:18:33PM -0400, Jesse M Draper wrote:
> CIL issues an "Error: Unexpected operand for addrof" message when it 
> encounters &"stringliteral" 
> even though GCC will compile this expression even with -ansi and/or -pedantic 
> flags. Although the 
> construct is a little odd, I think that it is ANSI compliant.

ISO/IEC 9899, section 6.5.3.2, §1:
"The operand of the unary & operator shall be either a function
designator, the result of a [] or unary * operator, or an lvalue that
designates an object that is not a bit-field and is not declared with
the register storage-class specifier."
and section 6.5.1, §4:
"A string literal is a primary expression. It is an lvalue with type as
detailed in 6.4.5."

So this is a bug indeed.

I see how to fix this (create a new temporary variable to hold the
string and return the address of this variable) but I have no idea when
I'll have time to fix this.  Probably not before two months, sadly.

If you feel like trying to do it, I'd be glad to help you with any
question you might have.

Best,
-- 
Gabriel

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
CIL-users mailing list
CIL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cil-users

Reply via email to