public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: richdawe@bigfoot.com To: gcc-gnats@gcc.gnu.org Cc: djgpp-workers@delorie.com Subject: c/6980: -Wbad-function-cast gives bogus warning for (double) rand() Date: Mon, 10 Jun 2002 01:56:00 -0000 [thread overview] Message-ID: <20020610084824.22635.qmail@sources.redhat.com> (raw) >Number: 6980 >Category: c >Synopsis: -Wbad-function-cast gives bogus warning for (double) rand() >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Mon Jun 10 01:56:00 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Richard Dawe >Release: gcc 3.1 >Organization: >Environment: DJGPP ports of gcc 3.1 & binutils 2.11.2, DJGPP CVS, running on Windows 98 SE >Description: Here is a simple test case: ---Start program--- #include <limits.h> #include <stdlib.h> int main (void) { double d; d = (double) rand() / RAND_MAX; return(EXIT_SUCCESS); } ---End program--- I compile the program like this and get the following warnings: bash-2.04$ gcc -Wall -Wbad-function-cast -c a.c a.c: In function `main': a.c:9: warning: cast does not match function type rand is defined in <stdlib.h> like this: int rand(void); Since an integer can fit into a double, I don't understand why this code gives a warning. We've discussed the warning on djgpp-workers@delorie.com and most people think it's a bug. Thank you for your time. Regards, Richard Dawe >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted:
next reply other threads:[~2002-06-10 8:56 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-06-10 1:56 richdawe [this message] 2003-03-07 2:42 bangerth
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20020610084824.22635.qmail@sources.redhat.com \ --to=richdawe@bigfoot.com \ --cc=djgpp-workers@delorie.com \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).