Bug 38121 - Excessive warnings when using -Wconversion and char/bool/short function arguments
Summary: Excessive warnings when using -Wconversion and char/bool/short function argum...
Status: RESOLVED DUPLICATE of bug 6614
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.0.2
: P3 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-14 16:57 UTC by Paul Floyd
Modified: 2008-11-14 23:12 UTC (History)
6 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Floyd 2008-11-14 16:57:33 UTC
Condider this

/* bar.c */

void bar(char a)
{
   char b = a;
}

void frob(void)
{
   bar('a');
}

Due to the automatic promotion of char to int in function calls [same would apply to short or C99 _Bool], then this causes a warning with -Wconversion, thus:

gcc -Wconversion -c bar.c
bar.c: In function 'frob':
bar.c:10: warning: passing argument 1 of 'bar' with different width due to prototype

This greatly limits the usefulness of -Wconversion.

As a user I either have to
a) put up with many thousands of useless warnings
b) not use -Wconversion, or use it with heavy filtering
c) never pass char/short/bool arguments in functions

A similar thing happens with float/double:
bar.c:10: warning: passing argument 1 of 'bar' as 'float' rather than 'double' due to prototype

This only happens with gcc, not g++.
Comment 1 Andrew Pinski 2008-11-14 23:12:09 UTC
This is not really a bug, -Wconversion is documented this way in GCC before 4.3.0.  -Wconversion did change for 4.3.0.

*** This bug has been marked as a duplicate of 6614 ***