On Sat, Dec 17, 2011 at 6:09 PM, David Cleaver <[email protected]> wrote: > > > On 12/17/2011 9:24 AM, Ozkan Sezer wrote: >> On Sat, Dec 17, 2011 at 4:49 PM, David Cleaver wrote: >>> Hello Everyone, >>> >>> I seem to have run into an issue with printf with my native toolchain that >>> someone else with the cross-compiler does not have. I was hoping someone >>> here >>> could help us track down what might be the difference between our two >>> builds. >>> >>> We ran tests based off of the following test program: >>> #include<stdio.h> >>> #include<inttypes.h> >>> >>> int main(void) { >>> uintmax_t x = 1125899906842749LL; >>> printf("%llu\n", x); >> >> %ll isn't supported by printf family from msvcrt.dll, so try >> defining __USE_MINGW_ANSI_STDIO=1 and recompile so >> that your code uses __mingw_printf()& co. > > I know that putting > #define __USE_MINGW_ANSI_STDIO 1 > at the top of the code will allow my build to be able to use %llu to print the > 64-bit variable. However, I'm wondering why his compiler warns about the > unknown llu modifier, but still prints the full 64-bit value.
I don't have an answer for that, > How can we track > down why it works for him, but not for me? First step would be making _sure_ that he isn't accidentally using the __mingw_* variant by looking at the preprocessed source (the -E switch of gcc). If he really isn't, then I don't know: Kai? > >> >>> return 0; >>> } >>> ------------------------------------------------------------------- >>> >>> When he compiles with -Wall and runs the program he gets: >>> C:\> x86_64-w64-mingw32-gcc -o try.exe try.c -Wall >>> try.c: In function 'main': >>> try.c:7:2: warning: unknown conversion type character 'l' in format >>> [-Wformat] >>> try.c:7:2: warning: too many arguments for format [-Wformat-extra-args] >>> >>> C:\> try >>> 1125899906842749 >>> >>> ------------------------------------------------------------------- >>> >>> When I compile with -Wall and run the program I get: >>> $ gcc -o try.exe try.c -Wall >>> try.c: In function 'main': >>> try.c:6: warning: unknown conversion type character 'l' in format >>> try.c:6: warning: too many arguments for format >>> >>> $ try >>> 125 >>> >>> ------------------------------------------------------------------- >>> >>> When he runs gcc -v he gets: >>> C:\>x86_64-w64-mingw32-gcc -v >>> Using built-in specs. >>> COLLECT_GCC=x86_64-w64-mingw32-gcc >>> COLLECT_LTO_WRAPPER=c:/_64/alt/bin/../libexec/gcc/x86_64-w64-mingw32/4.7.0/lto-wrapper.exe >>> Target: x86_64-w64-mingw32 >>> Configured with: ../../../build/gcc/src/configure >>> --target=x86_64-w64-mingw32 -- >>> prefix=/c/bb/vista64-mingw32/mingw-x86-x86_64/build/build/root >>> --with-sysroot=/c >>> /bb/vista64-mingw32/mingw-x86-x86_64/build/build/root >>> --enable-languages=all,obj >>> -c++ --enable-fully-dynamic-string --disable-multilib >>> Thread model: win32 >>> gcc version 4.7.0 20110410 (experimental) (GCC) >>> >>> ------------------------------------------------------------------- >>> >>> When I run 'gcc -v', I get: >>> $ gcc -v >>> Using built-in specs. >>> Target: x86_64-w64-mingw32 >>> Configured with: ../gcc44-svn/configure --host=x86_64-w64-mingw32 >>> --target=x86_64-w64-mingw32 --disable-multilib --enable-checking=release >>> --prefix=/mingw64 --with-sysroot=/mingw64 >>> --enable-languages=c,c++,fortran,objc,obj-c++ --enable-libgomp >>> --with-gmp=/mingw64 --with-mpfr=/mingw64 --disable-nls >>> --disable-win32-registry >>> Thread model: win32 >>> gcc version 4.4.5 20101001 (release) [svn/rev.164871 - mingw-w64/oz] (GCC) >>> >>> ------------------------------------------------------------------- >>> >>> He has informed me that he is not in a cygwin environment. However, I >>> forgot to >>> ask what OS he was using. He should be watching this thread so if anyone >>> has >>> questions for him he can answer them on-list. He said he was using: >>> "I'm using one of the "Automated Builds" provided by the mingw64.sf team. >>> It's >>> version 4.7.0. (MinGW, no Cygwin btw.)" >>> >>> I am using an old sezero personal build from 2010-10-03, and I am on >>> Windows XP >>> x64. I compiled/ran inside of an Msys shell. >>> >>> Can someone help us track down why his binary prints out the full 64-bit >>> number >>> and my binary prints out only the lower 32-bits of the 64-bit number? >>> Thank you >>> for your time. >>> >>> -David C. >> >> -- >> O.S. > -- O.S. ------------------------------------------------------------------------------ Learn Windows Azure Live! Tuesday, Dec 13, 2011 Microsoft is holding a special Learn Windows Azure training event for developers. It will provide a great way to learn Windows Azure and what it provides. You can attend the event by watching it streamed LIVE online. Learn more at http://p.sf.net/sfu/ms-windowsazure _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
