public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/35649] New: Incorrect printf warning: expect double has float
@ 2008-03-20 12:12 6yxwfq202 at sneakemail dot com
2008-03-20 12:41 ` [Bug c/35649] " rguenth at gcc dot gnu dot org
` (8 more replies)
0 siblings, 9 replies; 14+ messages in thread
From: 6yxwfq202 at sneakemail dot com @ 2008-03-20 12:12 UTC (permalink / raw)
To: gcc-bugs
With the -Wformat option The code
void foo( float a )
{
printf("%f",a);
}
give the warning:
foo.c:3: warning: format '%f' expects type 'double', but argument 2 has type
'float'
I believe this is unnecessary because float is promoted to double in variadic
functions.
--
Summary: Incorrect printf warning: expect double has float
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: trivial
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: 6yxwfq202 at sneakemail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35649
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/35649] Incorrect printf warning: expect double has float
2008-03-20 12:12 [Bug c/35649] New: Incorrect printf warning: expect double has float 6yxwfq202 at sneakemail dot com
@ 2008-03-20 12:41 ` rguenth at gcc dot gnu dot org
2008-03-20 16:05 ` 6yxwfq202 at sneakemail dot com
` (7 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-20 12:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rguenth at gcc dot gnu dot org 2008-03-20 12:40 -------
Works for me. Which target? Obviously you may need a prototype of printf
available for -Wformat to work at all.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35649
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/35649] Incorrect printf warning: expect double has float
2008-03-20 12:12 [Bug c/35649] New: Incorrect printf warning: expect double has float 6yxwfq202 at sneakemail dot com
2008-03-20 12:41 ` [Bug c/35649] " rguenth at gcc dot gnu dot org
@ 2008-03-20 16:05 ` 6yxwfq202 at sneakemail dot com
2008-03-22 2:14 ` wilson at tuliptree dot org
` (6 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: 6yxwfq202 at sneakemail dot com @ 2008-03-20 16:05 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from 6yxwfq202 at sneakemail dot com 2008-03-20 16:04 -------
Target is h8300-elf running on pc-windows or pc-cygwin
printf prototype:
extern int printf( const char * fmt, ...);
--
6yxwfq202 at sneakemail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
GCC target triplet| |h8300-elf
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35649
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/35649] Incorrect printf warning: expect double has float
2008-03-20 12:12 [Bug c/35649] New: Incorrect printf warning: expect double has float 6yxwfq202 at sneakemail dot com
2008-03-20 12:41 ` [Bug c/35649] " rguenth at gcc dot gnu dot org
2008-03-20 16:05 ` 6yxwfq202 at sneakemail dot com
@ 2008-03-22 2:14 ` wilson at tuliptree dot org
2010-01-08 20:51 ` dj at redhat dot com
` (5 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: wilson at tuliptree dot org @ 2008-03-22 2:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from wilson at tuliptree dot org 2008-03-22 02:13 -------
Subject: Re: New: Incorrect printf warning: expect double has
float
6yxwfq202 at sneakemail dot com wrote:
> foo.c:3: warning: format '%f' expects type 'double', but argument 2 has type
> 'float'
> I believe this is unnecessary because float is promoted to double in variadic
> functions.
Small 8/16 bit microprocessors often don't support all FP types.
h8300.h has for instance
#define FLOAT_TYPE_SIZE 32
#define DOUBLE_TYPE_SIZE 32
So floats and doubles are the same thing, which is probably confusing
something in the C front end. Maybe a type conversion got optimized
away (folded?) because it was a no-op for instance. I haven't tried to
reproduce this.
Jim
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35649
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/35649] Incorrect printf warning: expect double has float
2008-03-20 12:12 [Bug c/35649] New: Incorrect printf warning: expect double has float 6yxwfq202 at sneakemail dot com
` (2 preceding siblings ...)
2008-03-22 2:14 ` wilson at tuliptree dot org
@ 2010-01-08 20:51 ` dj at redhat dot com
2010-09-22 20:13 ` dj at redhat dot com
` (4 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: dj at redhat dot com @ 2010-01-08 20:51 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from dj at redhat dot com 2010-01-08 20:51 -------
Still present in 4.5 trunk, also fails for rx-elf-gcc with -m32bit-doubles but
not with -m64bit-doubles.
--
dj at redhat dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dj at redhat dot com
Last reconfirmed|0000-00-00 00:00:00 |2010-01-08 20:51:02
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35649
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/35649] Incorrect printf warning: expect double has float
2008-03-20 12:12 [Bug c/35649] New: Incorrect printf warning: expect double has float 6yxwfq202 at sneakemail dot com
` (3 preceding siblings ...)
2010-01-08 20:51 ` dj at redhat dot com
@ 2010-09-22 20:13 ` dj at redhat dot com
2010-09-22 20:23 ` dj at redhat dot com
` (3 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: dj at redhat dot com @ 2010-09-22 20:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from dj at redhat dot com 2010-09-22 20:13 -------
Still fails for both h8300-elf and rx-elf, both on 4.5 branch and 4.6 trunk.
--
dj at redhat dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2010-01-08 20:51:02 |2010-09-22 20:13:19
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35649
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/35649] Incorrect printf warning: expect double has float
2008-03-20 12:12 [Bug c/35649] New: Incorrect printf warning: expect double has float 6yxwfq202 at sneakemail dot com
` (4 preceding siblings ...)
2010-09-22 20:13 ` dj at redhat dot com
@ 2010-09-22 20:23 ` dj at redhat dot com
2010-09-22 20:38 ` paolo dot carlini at oracle dot com
` (2 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: dj at redhat dot com @ 2010-09-22 20:23 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from dj at redhat dot com 2010-09-22 20:22 -------
Created an attachment (id=21866)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21866&action=view)
possible fix
FYI I've been using this to silence the warning in my local tree...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35649
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/35649] Incorrect printf warning: expect double has float
2008-03-20 12:12 [Bug c/35649] New: Incorrect printf warning: expect double has float 6yxwfq202 at sneakemail dot com
` (5 preceding siblings ...)
2010-09-22 20:23 ` dj at redhat dot com
@ 2010-09-22 20:38 ` paolo dot carlini at oracle dot com
2010-09-22 22:40 ` joseph at codesourcery dot com
2010-09-23 7:54 ` manu at gcc dot gnu dot org
8 siblings, 0 replies; 14+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-09-22 20:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from paolo dot carlini at oracle dot com 2010-09-22 20:38 -------
I have a deja vu
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35649
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/35649] Incorrect printf warning: expect double has float
2008-03-20 12:12 [Bug c/35649] New: Incorrect printf warning: expect double has float 6yxwfq202 at sneakemail dot com
` (6 preceding siblings ...)
2010-09-22 20:38 ` paolo dot carlini at oracle dot com
@ 2010-09-22 22:40 ` joseph at codesourcery dot com
2010-09-23 7:54 ` manu at gcc dot gnu dot org
8 siblings, 0 replies; 14+ messages in thread
From: joseph at codesourcery dot com @ 2010-09-22 22:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from joseph at codesourcery dot com 2010-09-22 22:40 -------
Subject: Re: Incorrect printf warning: expect double has float
On Wed, 22 Sep 2010, dj at redhat dot com wrote:
> ------- Comment #6 from dj at redhat dot com 2010-09-22 20:22 -------
> Created an attachment (id=21866)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21866&action=view)
> --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21866&action=view)
> possible fix
>
> FYI I've been using this to silence the warning in my local tree...
That's the wrong fix; instead, change convert_arguments to do the
conversion from float to double even if they have the same precision.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35649
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/35649] Incorrect printf warning: expect double has float
2008-03-20 12:12 [Bug c/35649] New: Incorrect printf warning: expect double has float 6yxwfq202 at sneakemail dot com
` (7 preceding siblings ...)
2010-09-22 22:40 ` joseph at codesourcery dot com
@ 2010-09-23 7:54 ` manu at gcc dot gnu dot org
8 siblings, 0 replies; 14+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-09-23 7:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from manu at gcc dot gnu dot org 2010-09-23 07:54 -------
Why is this waiting? It only requires a fix.
--
manu at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu dot org
Status|WAITING |NEW
Ever Confirmed|0 |1
Last reconfirmed|2010-09-22 20:13:19 |2010-09-23 07:54:25
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35649
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/35649] Incorrect printf warning: expect double has float
[not found] <bug-35649-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2013-04-17 15:22 ` trevmrgn+bug at gmail dot com
@ 2013-08-26 17:12 ` amylaar at gcc dot gnu.org
3 siblings, 0 replies; 14+ messages in thread
From: amylaar at gcc dot gnu.org @ 2013-08-26 17:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35649
Jorn Wolfgang Rennecke <amylaar at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |amylaar at gcc dot gnu.org
Resolution|--- |FIXED
--- Comment #13 from Jorn Wolfgang Rennecke <amylaar at gcc dot gnu.org> ---
Fixed with this patch:
http://gcc.gnu.org/ml/gcc-cvs/2013-08/msg00613.html
http://gcc.gnu.org/ml/gcc-cvs/2013-08/msg00615.html
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/35649] Incorrect printf warning: expect double has float
[not found] <bug-35649-4@http.gcc.gnu.org/bugzilla/>
2010-11-08 15:39 ` pinskia at gcc dot gnu.org
2011-10-15 21:48 ` sgh at sgh dot dk
@ 2013-04-17 15:22 ` trevmrgn+bug at gmail dot com
2013-08-26 17:12 ` amylaar at gcc dot gnu.org
3 siblings, 0 replies; 14+ messages in thread
From: trevmrgn+bug at gmail dot com @ 2013-04-17 15:22 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35649
Trevor Morgan <trevmrgn+bug at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target|h8300-elf |h8300-elf, rx-elf, avr
--- Comment #12 from Trevor Morgan <trevmrgn+bug at gmail dot com> 2013-04-17 15:22:48 UTC ---
printf( "%f", 2.0D );
will also produce the erroneous warning (tried on rx-elf)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/35649] Incorrect printf warning: expect double has float
[not found] <bug-35649-4@http.gcc.gnu.org/bugzilla/>
2010-11-08 15:39 ` pinskia at gcc dot gnu.org
@ 2011-10-15 21:48 ` sgh at sgh dot dk
2013-04-17 15:22 ` trevmrgn+bug at gmail dot com
2013-08-26 17:12 ` amylaar at gcc dot gnu.org
3 siblings, 0 replies; 14+ messages in thread
From: sgh at sgh dot dk @ 2011-10-15 21:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35649
Søren Holm <sgh at sgh dot dk> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sgh at sgh dot dk
--- Comment #11 from Søren Holm <sgh at sgh dot dk> 2011-10-15 21:48:25 UTC ---
Iøm having the same isssue whne compiling with -fshort-double
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c/35649] Incorrect printf warning: expect double has float
[not found] <bug-35649-4@http.gcc.gnu.org/bugzilla/>
@ 2010-11-08 15:39 ` pinskia at gcc dot gnu.org
2011-10-15 21:48 ` sgh at sgh dot dk
` (2 subsequent siblings)
3 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu.org @ 2010-11-08 15:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35649
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |corsepiu at gcc dot gnu.org
--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> 2010-11-08 15:39:05 UTC ---
*** Bug 46372 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2013-08-26 17:12 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-20 12:12 [Bug c/35649] New: Incorrect printf warning: expect double has float 6yxwfq202 at sneakemail dot com
2008-03-20 12:41 ` [Bug c/35649] " rguenth at gcc dot gnu dot org
2008-03-20 16:05 ` 6yxwfq202 at sneakemail dot com
2008-03-22 2:14 ` wilson at tuliptree dot org
2010-01-08 20:51 ` dj at redhat dot com
2010-09-22 20:13 ` dj at redhat dot com
2010-09-22 20:23 ` dj at redhat dot com
2010-09-22 20:38 ` paolo dot carlini at oracle dot com
2010-09-22 22:40 ` joseph at codesourcery dot com
2010-09-23 7:54 ` manu at gcc dot gnu dot org
[not found] <bug-35649-4@http.gcc.gnu.org/bugzilla/>
2010-11-08 15:39 ` pinskia at gcc dot gnu.org
2011-10-15 21:48 ` sgh at sgh dot dk
2013-04-17 15:22 ` trevmrgn+bug at gmail dot com
2013-08-26 17:12 ` amylaar at gcc dot gnu.org
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).