compiling in 64 bit a 32 bit program

I have a program that runs very well in 32-bit mode. I wanted some additonal performance and hopefully some additonal parameter when I run the PGroup Profiler for Linux Workstation c/c++. So I just tried to port the code to 64 bit workstation. I changed nothng in the source code and just changed the path so it now points to the 64 bit pgcc instead of the 32 bit pgcc.

I made some small modifications to my Makefile and then typed make.

The compile line was the same, but it choked on three line in my thread.c file. The output is:

gcc -c -Wall -O0 -Mino=ccff -Mprof=func thread.c -o thread.o
thread.c: In function ‘CreateThread’:
thread.c:67: warning: format ‘%u’ expects type ‘unsigned int’, but argument 2 has type ‘size_t’
thread.c:67: warning: format ‘%x’ expects type ‘unsigned int’, but argument 3 has type ‘size_t’
thread.c:67: warning: format ‘%o’ expects type ‘unsigned int’, but argument 4 has type ‘size_t’

The CreateThread function is now shown:

/Print out size of stack/
if(pthread_attr_getstacksize(&thread_attr, &stack_size) !=0){
printf("%s - line %d; CreateThread: pthread_attr_getstacksize - getstacksize error!!\n"
, FILE, LINE);
return(-1);
};
printf(“Pthread: Stack size = %u decimal, %x hexadecimal, %o octal\n”,
stack_size,stack_size,stack_size );

return(0);
}

The line in question is the printf statement that extends on to another line. What is the problem (if there is one) and how do i fix it?

Please note that the program does compile and run. This is only a warning, but I am just wondering if something deeper is wrong.

Thanks in advance.

THX 1138

Hi THX 1138,

These are just warnings that GCC is giving you complaining that there is a mismatch in the expected data types that you are passing to printf. You can fix it by explicitly casting “stack_size” to an unsigned int, but most likely you can simply ignore these.

Note, that GCC it wont recognise the PGI -Mprof and -Minfo flags so you should remove them. Or if you use PGCC, remove the gcc flag -Wall and fix the typo where “-Mino” should be “-Minfo”.

Hope this helps,
Mat