discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Odd build behavior?


From: Benhur Stein
Subject: Re: Odd build behavior?
Date: Fri, 24 May 2002 16:54:15 -0300

On 2002-05-24 07:01:50 -0400 e.sammer <eric@linuxstep.org> wrote:

All:

I am getting NSRangeExceptions when making a call to [NSUnarchiver 
unarchiveObjectWithData:] as it tries to read the typestream. With some help 
from some folks on #gnustep, we tried to track it down to no avail.

Here's what's strange... What _does_ fix the problem is compiling with debug=yes. Any 
other build "styles" (i.e. debug=no, warn=blah, etc.) yeild a nonfunctional 
binary with the above problem. Of course, I can't say for sure if this is a GS thing (I 
don't think it is) but if anyone else sees this behavior in GS, please let me know as I 
do need to build non-debugging versions of my work at some point.

Maybe it's not related to your problem...

I am having this same problem, it started when I switched to gcc 3.1.
It came down to a bug in gcc, it doesn't compile GSSwapI... functions
well (in NSByteOrder.h). Compiling without -O2 solves the problem, as does
putting a call to a bogus function at the beginning of GSSwapI.. functions.

The example below shows the problem:

bash-2.05a$ cat y.c
#include <stdio.h>

typedef unsigned short gsu16;
typedef unsigned char gsu8;

static inline gsu16
GSSwapI16(gsu16 in)
{
 union swap {
   gsu16       num;
   gsu8        byt[2];
 } dst;
 union swap    *src = (union swap*)&in;
 dst.byt[0] = src->byt[1];
 dst.byt[1] = src->byt[0];
 return dst.num;
}

int main()
{
 gsu16 i, j;

 i = 0x456;
 j = GSSwapI16(i);
 printf("%x %x\n", i, j);
 return 0;
}
bash-2.05a$ gcc -O2 y.c
bash-2.05a$ ./a.out
456 5604
bash-2.05a$ mv y.c y.m
bash-2.05a$ gcc -O2 y.m
bash-2.05a$ ./a.out
456 408






reply via email to

[Prev in Thread] Current Thread [Next in Thread]