C
cyber citizen
Hi Folks,
We are encountering the following code issue on compiler susch as "xlc","gcc" but "icc" passes it successfully.
Sample code:
int main(void)
{
typedef unsigned char oratext;
typedef oratext text;
oratext c[2];
oratext * c_ptr = c;
text ** c_pptr;
c_pptr = &(oratext *)c_ptr;
}
Error:
"a.c", line 11.11: 1506-017 (S) Operand of address operator must be an lvalue or function designator.
It seems the compiler is unable to resolve all the addresses in its single pass. If we split this into to steps it works.
Modified code:
int main(void)
{
typedef unsigned char oratext;
typedef oratext text;
oratext c[2];
oratext * c_ptr = c;
text * c_ptr1;
c_ptr1 = (oratext *)c_ptr;
text ** c_pptr;
c_pptr = &c_ptr1;
}
Is this a known issue? are there any other work arounds for such a problem?
TIA
Himanshu
We are encountering the following code issue on compiler susch as "xlc","gcc" but "icc" passes it successfully.
Sample code:
int main(void)
{
typedef unsigned char oratext;
typedef oratext text;
oratext c[2];
oratext * c_ptr = c;
text ** c_pptr;
c_pptr = &(oratext *)c_ptr;
}
Error:
"a.c", line 11.11: 1506-017 (S) Operand of address operator must be an lvalue or function designator.
It seems the compiler is unable to resolve all the addresses in its single pass. If we split this into to steps it works.
Modified code:
int main(void)
{
typedef unsigned char oratext;
typedef oratext text;
oratext c[2];
oratext * c_ptr = c;
text * c_ptr1;
c_ptr1 = (oratext *)c_ptr;
text ** c_pptr;
c_pptr = &c_ptr1;
}
Is this a known issue? are there any other work arounds for such a problem?
TIA
Himanshu