This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch, fortran, 4.9] Improve efficiency of array constructor operators
- From: Thomas Koenig <tkoenig at netcologne dot de>
- To: fortran at gcc dot gnu dot org, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 29 Mar 2013 14:42:15 +0100
- Subject: Re: [patch, fortran, 4.9] Improve efficiency of array constructor operators
- References: <51458DD6 dot 8000200 at netcologne dot de> <514F743D dot 6020704 at netcologne dot de> <51548D37 dot 2040402 at net-b dot de> <5154B72B dot 9040500 at netcologne dot de>
I wrote:
PS: Regarding the string comparison patch: As Janne, think it should be
fine with also supporting kind=4 (don't forget to multiply the length by
the kind, e.g. ts.kind or more properly (but equivalently)
gfc_character_kinds[<index>].bit_size/BITS_PER_BYTE).
I'll do that.
Oops, it turns out we can't do this, at least not on little-endian
systems.
Consider:
#include <stdio.h>
int main()
{
unsigned int i,j;
i = 0x102;
j = 0x201;
printf("%d %d\n", i>j, memcmp(&i, &j, sizeof(i)));
return 0;
}
On a little-endian system, the output is
0 1
because i = 02 01 00 00 and j = 01 02 00 00 (in hex).
So, is the original patch OK for trunk?
Thomas