public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hermantenbrugge at home dot nl" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/30916]  New: Wrong ‘float’ rather than ‘double’ due to prototype warning
Date: Wed, 21 Feb 2007 16:26:00 -0000	[thread overview]
Message-ID: <bug-30916-6794@http.gcc.gnu.org/bugzilla/> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1333 bytes --]

The following code:

void func (float a);
void
func (float a)
{
}

int
main (void)
{
  func (3.0f);
  return 0;
}

Compiled with: gcc -Wconversion bug.c
produces:
bug.c: In function ‘main’:
bug.c:10: warning: passing argument 1 of ‘func’ as ‘float’ rather than ‘double’
due to prototype

I was not expecting this.

When looking at the code in c-typeck.c at line 2473.
I see:
                      /* Warn if any argument is passed as `float',
                         since without a prototype it would be `double'.  */
                      if (formal_prec == TYPE_PRECISION (float_type_node)
                          && type != dfloat32_type_node)

Should the dfloat32_type_node be changed into float_type_node?
When I change this no warning is produced anymore.


-- 
           Summary: Wrong ‘float’ rather than ‘double’ due to prototype
                    warning
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hermantenbrugge at home dot nl
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30916


             reply	other threads:[~2007-02-21 16:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-21 16:26 hermantenbrugge at home dot nl [this message]
2007-02-23 14:08 ` [Bug c/30916] Wrong ‘float’ rather than ‘double’ " manu at gcc dot gnu dot org
2007-02-23 14:21 ` manu at gcc dot gnu dot org
2007-02-23 15:26 ` hermantenbrugge at home dot nl
2007-02-23 16:09 ` manu at gcc dot gnu dot org

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=bug-30916-6794@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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: link
Be 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).