public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* gcc.c-torture/execute/stdarg-2.c: long vs int
@ 2005-08-23  2:51 DJ Delorie
  2005-08-23  7:58 ` Jakub Jelinek
  0 siblings, 1 reply; 4+ messages in thread
From: DJ Delorie @ 2005-08-23  2:51 UTC (permalink / raw)
  To: gcc


This test assumes that integer constants passed as varargs are
promoted to a type at least as big as "long", which is not valid on 16
bit hosts.  For example:

void
f1 (int i, ...)
{
  va_start (gap, i);
  x = va_arg (gap, long);


int
main (void)
{
  f1 (1, 79);
  if (x != 79)
    abort ();


Shouldn't those constants be 79L, not just 79?  That change fixes one
m32c failure, but given that it's a test case I'm not going to make
any assumptions about it.

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

* Re: gcc.c-torture/execute/stdarg-2.c: long vs int
  2005-08-23  2:51 gcc.c-torture/execute/stdarg-2.c: long vs int DJ Delorie
@ 2005-08-23  7:58 ` Jakub Jelinek
  2005-08-23 18:33   ` DJ Delorie
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2005-08-23  7:58 UTC (permalink / raw)
  To: DJ Delorie; +Cc: gcc

On Mon, Aug 22, 2005 at 08:38:01PM -0400, DJ Delorie wrote:
> 
> This test assumes that integer constants passed as varargs are
> promoted to a type at least as big as "long", which is not valid on 16
> bit hosts.  For example:
> 
> void
> f1 (int i, ...)
> {
>   va_start (gap, i);
>   x = va_arg (gap, long);
> 
> 
> int
> main (void)
> {
>   f1 (1, 79);
>   if (x != 79)
>     abort ();
> 
> 
> Shouldn't those constants be 79L, not just 79?  That change fixes one
> m32c failure, but given that it's a test case I'm not going to make
> any assumptions about it.

This certainly wasn't my intention, please change it to 79L.

	Jakub

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

* Re: gcc.c-torture/execute/stdarg-2.c: long vs int
  2005-08-23  7:58 ` Jakub Jelinek
@ 2005-08-23 18:33   ` DJ Delorie
  2005-08-23 20:51     ` Mark Mitchell
  0 siblings, 1 reply; 4+ messages in thread
From: DJ Delorie @ 2005-08-23 18:33 UTC (permalink / raw)
  To: jakub; +Cc: gcc


> This certainly wasn't my intention, please change it to 79L.

How's this?  It passes both m32c and x86-64.

2005-08-23  DJ Delorie  <dj@redhat.com>

	* gcc.c-torture/execute/stdarg-2.c (main): Make sure long
	constants have the L suffix.

Index: gcc.c-torture/execute/stdarg-2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.c-torture/execute/stdarg-2.c,v
retrieving revision 1.2
diff -p -U3 -r1.2 stdarg-2.c
--- gcc.c-torture/execute/stdarg-2.c	3 Nov 2004 21:53:39 -0000	1.2
+++ gcc.c-torture/execute/stdarg-2.c	23 Aug 2005 18:27:57 -0000
@@ -143,8 +143,8 @@ f12 (int i, ...)
 int
 main (void)
 {
-  f1 (1, 79);
-  if (x != 79)
+  f1 (1, 79L);
+  if (x != 79L)
     abort ();
   f2 (0x4002, 13, -14.0);
   if (bar_arg != 0x4002)

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

* Re: gcc.c-torture/execute/stdarg-2.c: long vs int
  2005-08-23 18:33   ` DJ Delorie
@ 2005-08-23 20:51     ` Mark Mitchell
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Mitchell @ 2005-08-23 20:51 UTC (permalink / raw)
  To: DJ Delorie; +Cc: jakub, gcc

DJ Delorie wrote:
>>This certainly wasn't my intention, please change it to 79L.
> 
> 
> How's this?  It passes both m32c and x86-64.
> 
> 2005-08-23  DJ Delorie  <dj@redhat.com>
> 
> 	* gcc.c-torture/execute/stdarg-2.c (main): Make sure long
> 	constants have the L suffix.

OK.

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304

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

end of thread, other threads:[~2005-08-23 20:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-23  2:51 gcc.c-torture/execute/stdarg-2.c: long vs int DJ Delorie
2005-08-23  7:58 ` Jakub Jelinek
2005-08-23 18:33   ` DJ Delorie
2005-08-23 20:51     ` Mark Mitchell

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).