[cfe-dev] Complex values handling in Clang

rajesh viswabramana viswabramana.rajesh at gmail.com
Mon Jan 28 05:46:41 PST 2013

Hi All,
Complex values stored in variable
value mismatches if program compiled clang and gcc.

Below is the sample program printing byte by byte stored "complex long long
int" value,

*int main()*
* _Complex unsigned long long int lli_val= (5668231682443686620ULL +
7618395480654047911ULL*__extension__ 1i);*
*// _Complex long double ld_val = (5668231682443686620ULL +
7618395480654047911ULL*__extension__ 1i);*
* int size = sizeof(lli_val);*
* int index = 0;*
* printf("long long int val:\n");*
* while (size != index)*
* {  *
*    unsigned char cval = (unsigned char)*(((unsigned char*)&lli_val) +
*    printf("%x", cval);*
*    index++;*
* }*

Outputs of clang compiled, gcc compiled values are:
For Clang,
long long int val:
For GCC,
long long int val:

Similar behaviour observed for "_Complex float, _Complex double, _Complex
long double" types.
Complex values in clang are not handled in similar to GCC, Could someone
comment about it.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130128/cd4384e2/attachment.html>

More information about the cfe-dev mailing list