Strange warning about passing argument with different width due to prototype with gcc 4.4.0 on 64 bits machine

José Luis García Pallero jgpallero@gmail.com
Wed Aug 25 06:56:00 GMT 2010


> You don't need to be admin to build GCC. There are a lot of
> documentation available on building GCC (including tools that automate
> the process) but if you like use the same steps that I used, check
> this: http://www.coding.com.br/mac/building-gcc-4-6-on-macosx/
> Although the example uses OSX you can expand to any environment.

Thank you for the howto, Tiago.

I've compiled in the workstation (Intel Xeon Quad core x86_64, running
RHEL) three versions: 4.4.0 (the same that the machine has), 4.4.4
(the same than I have in my Debian) and 4.5.1 (I couldn't compile 4.6
version). Results are variable (in other piece of code appart the test
ported in this thread):

4.4.0: The warnings concerning char input arguments do not appears. A
new warnings that the RHEL version can't detect appears as "conversion
to long unsigned int from int may alter its value". Long unsigned int
is size_t in my code (other versions says size_t in the warnings).

4.4.4: The warnings concerning char input arguments do not appears. A
new warnings that the RHEL version can't detect appears as "conversion
to double from size_t may alter its value". Conversion to long
unsigned int from int is not detected in this version.

4.5.1: Same behavior as 4.4.4

As we can see, apparently (I don't know if I have had anything wrong)
some warning detections are broken or activate-deactivate in some gcc
versions or versions provided by different distributions. I think that
this can be bad for programmers trying to follow strictly a standard
(C99, for example). I my Debian, for example, none warnings appears.
My complete gcc call is:

gcc    -std=c99 -pedantic -Wall -Wextra -Wconversion
-Wmissing-prototypes -Wstrict-prototypes -Wshadow -Wcast-qual
-Wcast-align -Wwrite-strings -Wnested-externs -O3 -funroll-loops
-fno-common -fshort-enums

On the other hand, if I use clang+llvm compiler suite (clang+llvm 2.7
in the repositories for my Debian GNU/Linux on iBook PowerPC G4) the
warnings concerning conversion to double from size_t are detected (and
no more). The clang call is:

clang    -std=c99 -pedantic -Wextra-tokens -O3 -fno-common

-- 
*****************************************
José Luis García Pallero
jgpallero@gmail.com
(o<
/ / \
V_/_
Use Debian GNU/Linux and enjoy!
*****************************************



More information about the Gcc-help mailing list