public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* cpplib and endianness problems
@ 2000-12-17  6:40 Neil Booth
  2000-12-18  8:05 ` Dave Brolley
  0 siblings, 1 reply; 11+ messages in thread
From: Neil Booth @ 2000-12-17  6:40 UTC (permalink / raw)
  To: gcc; +Cc: Zack Weinberg

I noticed a few weeks ago that Sparc was failing on gcc.dg/cpp/if-2.c

Unfortunately, there was more than one test on the line it was failing
on, so I separated the tests to see which one it was.

From recent posts to gcc-testresults, like Kaveh's, we see the
following fails on Sparc:

#if L'\xfeed' != 0xfeed
#error 0xfeed	/* { dg-bogus "error" "wide charconst recognition 2" } */
#endif

I have no idea if this test is valid; i.e. how should we be
interpreting L'\xfeed'?  Should it be equal to 0xfeed?

Neil.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: cpplib and endianness problems
  2000-12-17  6:40 cpplib and endianness problems Neil Booth
@ 2000-12-18  8:05 ` Dave Brolley
  2001-01-09 16:05   ` Neil Booth
  0 siblings, 1 reply; 11+ messages in thread
From: Dave Brolley @ 2000-12-18  8:05 UTC (permalink / raw)
  To: Neil Booth; +Cc: gcc, Zack Weinberg

Neil Booth wrote:

> I noticed a few weeks ago that Sparc was failing on gcc.dg/cpp/if-2.c
> 
> Unfortunately, there was more than one test on the line it was failing
> on, so I separated the tests to see which one it was.
> 
> >From recent posts to gcc-testresults, like Kaveh's, we see the
> following fails on Sparc:
> 
> #if L'\xfeed' != 0xfeed
> #error 0xfeed	/* { dg-bogus "error" "wide charconst recognition 2" } */
> #endif
> 
> I have no idea if this test is valid; i.e. how should we be
> interpreting L'\xfeed'?  Should it be equal to 0xfeed?

The escape sequence, \xfeed represents one character of type wchar_t. 
This character is then converted to type 'int'. So the answer depends on 
the size of wchat_t and whether it is signed or not.

Dave

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: cpplib and endianness problems
  2000-12-18  8:05 ` Dave Brolley
@ 2001-01-09 16:05   ` Neil Booth
  2001-01-10  6:45     ` Jamie Lokier
  0 siblings, 1 reply; 11+ messages in thread
From: Neil Booth @ 2001-01-09 16:05 UTC (permalink / raw)
  To: Dave Brolley; +Cc: gcc, Zack Weinberg

Dave Brolley wrote:-

> > #if L'\xfeed' != 0xfeed
> > #error 0xfeed	/* { dg-bogus "error" "wide charconst recognition 2" } */
> > #endif
> 
> The escape sequence, \xfeed represents one character of type wchar_t. 
> This character is then converted to type 'int'. So the answer depends on 
> the size of wchat_t and whether it is signed or not.

Hi Dave,

Sorry to take so long to get back to you on this.

wchar_t should be >= 16 bits everywhere, right?  Similarly for int.
Certainly on Solaris.  I don't see why the test fails.

Is there a generally correct form for the above test?  I'm a little
confused.

Neil.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: cpplib and endianness problems
  2001-01-09 16:05   ` Neil Booth
@ 2001-01-10  6:45     ` Jamie Lokier
  2001-01-10 23:54       ` Neil Booth
  2001-01-14 23:49       ` Neil Booth
  0 siblings, 2 replies; 11+ messages in thread
From: Jamie Lokier @ 2001-01-10  6:45 UTC (permalink / raw)
  To: Neil Booth; +Cc: Dave Brolley, gcc, Zack Weinberg

Neil Booth wrote:
> > > #if L'\xfeed' != 0xfeed
> > > #error 0xfeed	/* { dg-bogus "error" "wide charconst recognition 2" } */
> > > #endif
> > 
> > The escape sequence, \xfeed represents one character of type wchar_t. 
> > This character is then converted to type 'int'. So the answer depends on 
> > the size of wchat_t and whether it is signed or not.
> 
> Hi Dave,
> 
> Sorry to take so long to get back to you on this.
> 
> wchar_t should be >= 16 bits everywhere, right?  Similarly for int.
> Certainly on Solaris.  I don't see why the test fails.
> 
> Is there a generally correct form for the above test?  I'm a little
> confused.

Does it pass with 0x1234?  If so, wchar_t is signed and getting
sign-extended.

-- Jamie

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: cpplib and endianness problems
  2001-01-10  6:45     ` Jamie Lokier
@ 2001-01-10 23:54       ` Neil Booth
  2001-01-11  0:04         ` Fergus Henderson
  2001-01-11  2:15         ` Jamie Lokier
  2001-01-14 23:49       ` Neil Booth
  1 sibling, 2 replies; 11+ messages in thread
From: Neil Booth @ 2001-01-10 23:54 UTC (permalink / raw)
  To: Jamie Lokier; +Cc: Dave Brolley, gcc, Zack Weinberg

Jamie Lokier wrote:-

> Does it pass with 0x1234?  If so, wchar_t is signed and getting
> sign-extended.

Ah, I see.  OK, this adds that test too; let's see.  If this passes,
I'll remove the other one.

Neil.

	* gcc.dg/cpp/if-2.c: Add wide char test without sign extension.

Index: gcc.dg/cpp/if-2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/if-2.c,v
retrieving revision 1.2
diff -u -p -r1.2 if-2.c
--- if-2.c	2000/12/11 07:46:25	1.2
+++ if-2.c	2001/01/11 07:51:54
@@ -13,6 +13,10 @@
 #error 0xfeed	/* { dg-bogus "error" "wide charconst recognition 2" } */
 #endif
 
+#if L'\x1234' != 0x1234
+#error 0xfeed	/* { dg-bogus "error" "wide charconst recognition 2" } */
+#endif
+
 #if 'abcd' /* { dg-warning "multi-character character constant" "multi-character charconst" } */
 #endif
 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: cpplib and endianness problems
  2001-01-10 23:54       ` Neil Booth
@ 2001-01-11  0:04         ` Fergus Henderson
  2001-01-11  0:12           ` Neil Booth
  2001-01-11  2:15         ` Jamie Lokier
  1 sibling, 1 reply; 11+ messages in thread
From: Fergus Henderson @ 2001-01-11  0:04 UTC (permalink / raw)
  To: Neil Booth; +Cc: gcc

On 11-Jan-2001, Neil Booth <neil@daikokuya.demon.co.uk> wrote:
> +#if L'\x1234' != 0x1234
> +#error 0xfeed	/* { dg-bogus "error" "wide charconst recognition 2" } */

Don't you want `#error 0x1234' there?

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: < http://www.cs.mu.oz.au/~fjh >  |     -- the last words of T. S. Garp.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: cpplib and endianness problems
  2001-01-11  0:04         ` Fergus Henderson
@ 2001-01-11  0:12           ` Neil Booth
  0 siblings, 0 replies; 11+ messages in thread
From: Neil Booth @ 2001-01-11  0:12 UTC (permalink / raw)
  To: Fergus Henderson; +Cc: gcc

Fergus Henderson wrote:-

> Don't you want `#error 0x1234' there?

Yes, just did that :-)

Neil.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: cpplib and endianness problems
  2001-01-10 23:54       ` Neil Booth
  2001-01-11  0:04         ` Fergus Henderson
@ 2001-01-11  2:15         ` Jamie Lokier
  1 sibling, 0 replies; 11+ messages in thread
From: Jamie Lokier @ 2001-01-11  2:15 UTC (permalink / raw)
  To: Neil Booth; +Cc: Dave Brolley, gcc, Zack Weinberg

Neil Booth wrote:
> > Does it pass with 0x1234?  If so, wchar_t is signed and getting
> > sign-extended.
> 
> Ah, I see.  OK, this adds that test too; let's see.  If this passes,
> I'll remove the other one.

I wonder if it makes Unicode sense to have a 16 bit signed wchar_t?

-- Jamie

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: cpplib and endianness problems
  2001-01-10  6:45     ` Jamie Lokier
  2001-01-10 23:54       ` Neil Booth
@ 2001-01-14 23:49       ` Neil Booth
  2001-01-17  4:53         ` Alexandre Oliva
  1 sibling, 1 reply; 11+ messages in thread
From: Neil Booth @ 2001-01-14 23:49 UTC (permalink / raw)
  To: Jamie Lokier; +Cc: Dave Brolley, gcc, Zack Weinberg, gcc-patches

Jamie Lokier wrote:-

> Does it pass with 0x1234?  If so, wchar_t is signed and getting
> sign-extended.

Yes, it appears OK.  So I'll comment out the old test, with this patch.

Neil.

	* gcc.dg/cpp/if-2.c: Comment out occasionally bogus test; we
	have an equivalent working one below it.

Index: gcc.dg/cpp/if-2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/cpp/if-2.c,v
retrieving revision 1.4
diff -u -p -r1.4 if-2.c
--- if-2.c	2001/01/11 08:11:29	1.4
+++ if-2.c	2001/01/15 07:47:12
@@ -9,8 +9,10 @@
 #error L'a'	/* { dg-bogus "error" "wide charconst recognition 1" } */
 #endif
 
+#if 0 /* This test doesn't work on targets with signed 16-bit wchar_t.  */
 #if L'\xfeed' != 0xfeed
 #error 0xfeed	/* { dg-bogus "error" "wide charconst recognition 2" } */
+#endif
 #endif
 
 #if L'\x1234' != 0x1234

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: cpplib and endianness problems
  2001-01-14 23:49       ` Neil Booth
@ 2001-01-17  4:53         ` Alexandre Oliva
  2001-01-17 10:59           ` Neil Booth
  0 siblings, 1 reply; 11+ messages in thread
From: Alexandre Oliva @ 2001-01-17  4:53 UTC (permalink / raw)
  To: Neil Booth; +Cc: Jamie Lokier, Dave Brolley, gcc, Zack Weinberg, gcc-patches

On Jan 15, 2001, Neil Booth <neil@daikokuya.demon.co.uk> wrote:

> Jamie Lokier wrote:-
>> Does it pass with 0x1234?  If so, wchar_t is signed and getting
>> sign-extended.

> Yes, it appears OK.  So I'll comment out the old test, with this patch.

I think it would be nice to check whether we do The Right Thing (TM)
when wchar_t is signed too.  How about this patch?  Ok to install?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: cpplib and endianness problems
  2001-01-17  4:53         ` Alexandre Oliva
@ 2001-01-17 10:59           ` Neil Booth
  0 siblings, 0 replies; 11+ messages in thread
From: Neil Booth @ 2001-01-17 10:59 UTC (permalink / raw)
  To: Alexandre Oliva; +Cc: gcc, gcc-patches

Alexandre Oliva wrote:-

> I think it would be nice to check whether we do The Right Thing (TM)
> when wchar_t is signed too.  How about this patch?  Ok to install?

Yes, great thanks.

Neil.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2001-01-17 10:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-17  6:40 cpplib and endianness problems Neil Booth
2000-12-18  8:05 ` Dave Brolley
2001-01-09 16:05   ` Neil Booth
2001-01-10  6:45     ` Jamie Lokier
2001-01-10 23:54       ` Neil Booth
2001-01-11  0:04         ` Fergus Henderson
2001-01-11  0:12           ` Neil Booth
2001-01-11  2:15         ` Jamie Lokier
2001-01-14 23:49       ` Neil Booth
2001-01-17  4:53         ` Alexandre Oliva
2001-01-17 10:59           ` Neil Booth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).