This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, fortran, 4.9] Improve efficiency of array constructor operators


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]