www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/05/31/08:32:13

From: pavenis AT lanet DOT lv
To: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>, djgpp-workers AT delorie DOT com
Date: Fri, 31 May 2002 14:43:31 +0300
MIME-Version: 1.0
Subject: Re: Patches for building with gcc 3.1 - tests chunk
Message-ID: <3CF78C13.2424.64D953@localhost>
In-reply-to: <7443-Fri31May2002130616+0300-eliz@is.elta.co.il>
References: <200205310919 DOT LAA13003 AT lws256 DOT lu DOT erisoft DOT se> (message from Martin Stromberg on Fri, 31 May 2002 11:19:07 +0200 (MET DST))
X-mailer: Pegasus Mail for Windows (v4.01)
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On 31 May 2002 at 13:06, Eli Zaretskii wrote:

> > From: Martin Stromberg <eplmst AT epl DOT ericsson DOT se>
> > Date: Fri, 31 May 2002 11:19:07 +0200 (MET DST)
> > 
> >     urand = ((double)rand()) / RAND_MAX;
> > 
> > gives this warning:
> > 
> > gcc @../../gcc.opt -I. -I- -I../../../include  -pg -c signals.c
> > cc1.exe: warnings being treated as errors
> > signals.c: In function `int_handler':
> > signals.c:23: warning: cast does not match function type
> 
> That's madness.  Or a bug.

Even more stupid. After following small patch

--- djgpp/tests/libc/go32/signals.c~1	Sun May  9 14:34:54 1999
+++ djgpp/tests/libc/go32/signals.c	Fri May 31 14:34:44 2002
@@ -20,7 +20,8 @@
   if (sig != SIGINT)
     abort();
   puts ("\tSIGINT");
-  urand = ((double)rand()) / RAND_MAX;
+  urand = rand();
+  urand /= RAND_MAX;
   if (urand > 0.5)
     result = urand / (rand() < 0);
   else

I'm not getting message any more. So gcc permits value to be assigned to
double variable, but does not permit to cast.
 
> But it's a bug nonetheless.  Someone (tm) should report it.

I agree.

Andris




- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019