[cfe-dev] Complex values handling in Clang

rajesh viswabramana viswabramana.rajesh at gmail.com
Thu Jan 31 21:06:31 PST 2013


Hi all,

Could someone comment about it.

Thanks,
Rajesh

On Mon, Jan 28, 2013 at 7:16 PM, rajesh viswabramana <
viswabramana.rajesh at gmail.com> wrote:

> 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) +
> index);*
> *    printf("%x", cval);*
> *    index++;*
> * }*
> *}*
>
> Outputs of clang compiled, gcc compiled values are:
> For Clang,
> long long int val:
> *dcb2ab00000a76ad35e0000*
> For GCC,
> long long int val:
> *dcb2ab0af9aa94ea76ad35e53fab969*
>
> 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.
>
>
>
> -rajesh
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130201/66f688c9/attachment.html>


More information about the cfe-dev mailing list