02-03-2009
52,
0
Join Date: Dec 2008
Last Activity: 25 February 2010, 3:53 AM EST
Posts: 52
Thanks Given: 0
Thanked 0 Times in 0 Posts
No Error for 64-bit porting
I am just trying to get the warning while compiling for 64-bit on Linux
>>
uname -a
Linux mms4.es.cpth.ie 2.6.9-22.ELsmp #1 SMP Mon Sep 19 18:00:54 EDT 2005 x86_64 x86_64 x86_64 GNU/Linux
===================================
Written test.c file which conatin :
#include<stdio.h>
#include<stdlib.h>
int main()
{
int i;
long z;
char str[10]="aaaabbbbcc";
printf("Long int size is %d bytes long!\n", sizeof(z));
printf("Int size is %d bytes !\n", sizeof(i));
i =strlen(str);
printf("\nlength = %d",i);
return 1;
}
==========================
After cimpiling gives me warning like:
$ gcc -m64 -Wall -mcpu=x86-64 -o test.o test.c
test.c: In function `main':
test.c:9: warning: int format, different type arg (arg 2)
test.c:10: warning: int format, different type arg (arg 2)
test.c:11: warning: implicit declaration of function `strlen'
There is no any warning which shows the Porting error like strlen() returns size_t which is 8 bytes on 64-bit. And 'i' is 4 bytes.
On sparcv9 it is giving warnings like
>> CC +w2 -xarch=v9 test64.cpp
"test64.cpp", line 8: Warning: Conversion of 64 bit type value to "int" causes truncation.
1 Warning(s) detected.
Can you please tell me that how could we get the similar warnings on Linux? which all options need to use with gcc for 64-bit except -m64 -Wall -mcpu=x86-64 ?