Re: moused(8): char signed-ness problem with gcc 3.1

2002-05-16 Thread Christopher Weimann
On Thu, May 16, 2002 at 06:47:39AM -0400, Thomas David Rivers wrote: > > Terry Lambert <[EMAIL PROTECTED]> wrote: > > RS/6000's didn't used to use PPC processors at all; so it's > > probably intentional software compatability. > > I'm confused then - the one we have here seems to. There > was

Re: moused(8): char signed-ness problem with gcc 3.1

2002-05-16 Thread David W. Chapman Jr.
> Sounds like you should forward this to [EMAIL PROTECTED] :-) > CC audit@ (and current@) so we can all see what the GNU people say. > Don't forget to show the output of `cc -v'. knu has already created a gnats pr with gcc and posted the url. -- David W. Chapman Jr. [EMAIL PROTECTED] Raintree

Re: moused(8): char signed-ness problem with gcc 3.1

2002-05-16 Thread David O'Brien
On Thu, May 16, 2002 at 12:06:49PM -0700, Bill Fenner wrote: > >Specifically what is the problem? Given the program below, take the > >ISO-C spec and explain the problem. Or even w/o the spec -- I haven't > >been reading this thread. > > > > int > > > main() > > > { > > >unsigned char i = 1

Re: moused(8): char signed-ness problem with gcc 3.1

2002-05-16 Thread Bill Fenner
>Specifically what is the problem? Given the program below, take the >ISO-C spec and explain the problem. Or even w/o the spec -- I haven't >been reading this thread. > > int > > main() > > { > >unsigned char i = 127; > >char j; > > > >printf("%d\n", ((char)(i << 1))); This print

Re: moused(8): char signed-ness problem with gcc 3.1

2002-05-16 Thread David O'Brien
On Thu, May 16, 2002 at 08:31:19PM +0900, Akinori MUSHA wrote: > > > So - yes - it seems gcc 3.1 does have a problem... > > Indeed - easily determined by breaking down the expression. > > So, who's gonna report it to gcc-bugs? knu?... Specifically what is the problem? Given the program below, t

Re: moused(8): char signed-ness problem with gcc 3.1

2002-05-16 Thread Akinori MUSHA
I've submitted a bug report to GCC GNATS: http://gcc.gnu.org/cgi-bin/gnatsweb.pl?database=gcc&pr=6677&cmd=view+audit-trail Let's see how they handle this. -- / /__ __Akinori.org / MUSHA.org / ) ) ) ) / FreeBSD.org

Re: moused(8): char signed-ness problem with gcc 3.1

2002-05-16 Thread Akinori MUSHA
At Thu, 16 May 2002 21:58:56 +1000 (EST), Bruce Evans wrote: > > Somehow, specifying -fsigned-char, which I thought was the default, > > fixed the problem. So, the cause may be in our configuration of gcc? > > -fsigned-char doesn't fix it for me. Neither does repacling "char" by > "signed char"

Re: moused(8): char signed-ness problem with gcc 3.1

2002-05-16 Thread Bruce Evans
On Thu, 16 May 2002, Akinori MUSHA wrote: > [CC: obrien, who has been working on bringing in gcc 3.1] > > At Wed, 15 May 2002 20:46:06 -0700, > Bill Fenner wrote: > > So, who's gonna report it to gcc-bugs? knu?... > > > > int > > main() > > { > >unsigned char i = 127; > >char j; > > > >

Re: moused(8): char signed-ness problem with gcc 3.1

2002-05-16 Thread Akinori MUSHA
[CC: obrien, who has been working on bringing in gcc 3.1] At Wed, 15 May 2002 20:46:06 -0700, Bill Fenner wrote: > > So - yes - it seems gcc 3.1 does have a problem... > > Indeed - easily determined by breaking down the expression. > > So, who's gonna report it to gcc-bugs? knu?... > > int >

Re: moused(8): char signed-ness problem with gcc 3.1

2002-05-16 Thread Thomas David Rivers
Terry Lambert <[EMAIL PROTECTED]> wrote: > Thomas David Rivers wrote: > > Well - it's not counter-intuitive on many machines... For example, > > on the IBM mainframe - there is an instruction to load a character > > into a register - but not one that loads *and* sign-extends. So, > > you can

Re: moused(8): char signed-ness problem with gcc 3.1

2002-05-15 Thread Terry Lambert
Thomas David Rivers wrote: > Well - it's not counter-intuitive on many machines... For example, > on the IBM mainframe - there is an instruction to load a character > into a register - but not one that loads *and* sign-extends. So, > you can get much better code if characters are unsigned by d

Re: moused(8): char signed-ness problem with gcc 3.1

2002-05-15 Thread Bill Fenner
> So - yes - it seems gcc 3.1 does have a problem... Indeed - easily determined by breaking down the expression. So, who's gonna report it to gcc-bugs? knu?... int main() { unsigned char i = 127; char j; printf("%d\n", ((char)(i << 1))); j = ((char)(i << 1)) / 2; printf("%d\n"

Re: moused(8): char signed-ness problem with gcc 3.1

2002-05-15 Thread Thomas David Rivers
Terry Lambert <[EMAIL PROTECTED]> wrote: > > Bill Fenner wrote: > > gcc 3.1 simply defaults to unsigned chars. 127 << 1 = 254; 254 / 2 = 127. > > > > My machine is too slow to test this expeditiously, but I'm trying > > adding "#define DEFAULT_SIGNED_CHAR 1" into freebsd-native.h . > > I will

Re: moused(8): char signed-ness problem with gcc 3.1

2002-05-15 Thread Thomas David Rivers
> > I observed gcc 2.95.4 and gcc 3.1 interpret (or maybe optimize) the > following code differently (CFLAGS=-O): > > int main(void) > { > unsigned char i = 127; > printf("%d\n", ((char)(i << 1)) / 2); > return 0; > } > > gcc 2.95.4 says it's -1, whereas gcc 3.1 says it's 127. On FreeBSD

Re: moused(8): char signed-ness problem with gcc 3.1

2002-05-15 Thread Terry Lambert
Bill Fenner wrote: > Duh. Sometimes I wish I had the patience to wait for my tests to complete > before sharing my guesses. I jumped to a wildly incorrect conclusion; gcc > 3.1 still defaults to signed chars. Sorry for the bizarre misdirection. There goes my lunch money. 8-(. Man, your expla

Re: moused(8): char signed-ness problem with gcc 3.1

2002-05-15 Thread Bill Fenner
Duh. Sometimes I wish I had the patience to wait for my tests to complete before sharing my guesses. I jumped to a wildly incorrect conclusion; gcc 3.1 still defaults to signed chars. Sorry for the bizarre misdirection. Bill To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe

Re: moused(8): char signed-ness problem with gcc 3.1

2002-05-15 Thread Terry Lambert
Bill Fenner wrote: > gcc 3.1 simply defaults to unsigned chars. 127 << 1 = 254; 254 / 2 = 127. > > My machine is too slow to test this expeditiously, but I'm trying > adding "#define DEFAULT_SIGNED_CHAR 1" into freebsd-native.h . I will bet today's lunch money that you have found it for sure.

Re: moused(8): char signed-ness problem with gcc 3.1

2002-05-15 Thread Robert Drehmel
On Thu, May 16, 2002 at 02:42:34AM +0900, Akinori MUSHA wrote: > I observed gcc 2.95.4 and gcc 3.1 interpret (or maybe optimize) the > following code differently (CFLAGS=-O): > > int main(void) > { > unsigned char i = 127; > printf("%d\n", ((char)(i << 1)) / 2); > return 0; > } I think GCC

Re: moused(8): char signed-ness problem with gcc 3.1

2002-05-15 Thread Bill Fenner
gcc 3.1 simply defaults to unsigned chars. 127 << 1 = 254; 254 / 2 = 127. My machine is too slow to test this expeditiously, but I'm trying adding "#define DEFAULT_SIGNED_CHAR 1" into freebsd-native.h . Bill To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" i

Re: moused(8): char signed-ness problem with gcc 3.1

2002-05-15 Thread Terry Lambert
Akinori MUSHA wrote: > I observed gcc 2.95.4 and gcc 3.1 interpret (or maybe optimize) the > following code differently (CFLAGS=-O): > > int main(void) > { > unsigned char i = 127; > printf("%d\n", ((char)(i << 1)) / 2); > return 0; > } > Cool... > gcc 2.95.4 says it's -1, Promotion of

moused(8): char signed-ness problem with gcc 3.1

2002-05-15 Thread Akinori MUSHA
I observed gcc 2.95.4 and gcc 3.1 interpret (or maybe optimize) the following code differently (CFLAGS=-O): int main(void) { unsigned char i = 127; printf("%d\n", ((char)(i << 1)) / 2); return 0; } gcc 2.95.4 says it's -1, whereas gcc 3.1 says it's 127. On FreeBSD char should be signed, s