From: SF/projects/mingw n. l. <min...@li...> - 2011-08-20 01:30:26
|
Bugs item #3390077, was opened at 2011-08-11 10:40 Message generated for change (Comment added) made by ir0nh34d You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=3390077&group_id=2435 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: mingw runtime Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: (bvassche) Assigned to: Chris Sutcliffe (ir0nh34d) Summary: Mismatch between size_t and ssize_t Initial Comment: Apparently size_t is a synonym for unsigned int and ssize_t for long (<sys/types.h>), which causes strange failure reports: $ printf '#include <stdio.h>\nint main(int argc, char** argv){size_t s = 1; ssize_t ss = -2; printf("%%u %%d\\n", s, ss); return 0;}'|gcc -xc - -Wall -Werror; echo $? cc1.exe: warnings being treated as errors <stdin>: In function 'main': <stdin>:2:1: error: format '%d' expects type 'int', but argument 3 has type 'ssize_t' 1 $ printf '#include <stdio.h>\nint main(int argc, char** argv){size_t s = 1; ssize_t ss = -2; printf("%%u %%ld\\n", s, ss); return 0;}'|gcc -xc - -Wall -Werror ; echo $? 0 Details: Windows version: Windows XP $ gcc -v Using built-in specs. COLLECT_GCC=C:\MinGW\bin\gcc.exe COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.5.2/lto-wrapper.exe Target: mingw32 Configured with: ../gcc-4.5.2/configure --enable-languages=c,c++,ada,fortran,objc,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgomp --disable-win32-registry --enable-libstdcxx-debug --enable-version-specific-runtime-libs --disable-werror --build=mingw32 -prefix=/mingw Thread model: win32 gcc version 4.5.2 (GCC) $ uname -a MINGW32_NT-5.1 PS3002 1.0.11(0.46/3/2) 2009-07-11 17:46 i686 Msys ---------------------------------------------------------------------- >Comment By: Chris Sutcliffe (ir0nh34d) Date: 2011-08-19 21:30 Message: Having said that, I just looked on a debian box I have access to and ssize_t is defined as __SSIZE_T_TYPE which in turn is defined as __SWORD_TYPE. For a __WORDSIZE of 32 (as it the case with 32-bit MinGW), __SWORD_TYPE is defined as int. This being the case, I will change MinGW's definition in <sys/types.h> to be int. ---------------------------------------------------------------------- Comment By: Chris Sutcliffe (ir0nh34d) Date: 2011-08-19 21:19 Message: Looking at gcc's stddef,h, size_t is defined as long unsigned int. Looking at the Open Group definition of ssize_t, if I understand it correctly, ssize_t is a signed version of size_t. That being the case, I believe the current definition of ssize_t being a long is correct. ---------------------------------------------------------------------- Comment By: Earnie Boyd (earnie) Date: 2011-08-12 10:30 Message: Chris can you take a look at this and respond. ---------------------------------------------------------------------- Comment By: (bvassche) Date: 2011-08-11 12:06 Message: > Or are you indicating that ssize_t should be int instead of long? Indeed. ---------------------------------------------------------------------- Comment By: Earnie Boyd (earnie) Date: 2011-08-11 11:36 Message: Didn't mean to close this one. ---------------------------------------------------------------------- Comment By: Earnie Boyd (earnie) Date: 2011-08-11 11:34 Message: Note, since this is not a but I changed this to a Support Request. You gave two uses, one incorrect and one correct. How is this a bug? Or are you indicating that ssize_t should be int instead of long? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=3390077&group_id=2435 |