Author Topic: TDM-GCC 4.5 series (Latest: 4.5.2 - 2011-03-27)  (Read 73879 times)

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: TDM-GCC 4.5.0 32- and 64-bit editions released
« Reply #30 on: June 14, 2010, 12:11:21 pm »
...
Odd. If you feel like sending me the link command line I might see if I can figure it out and/or reproduce it.
Well, that was just plain stupid. For some reason I've had the lib folder belonging to TDM-gcc4.4 in path.

The issue with broken <algorithm> went away "magically" too by deleting the installation folder and installing anew.

Project now builds just fine under gcc 4.5, sorry about complaining too early :)

"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: TDM-GCC 4.5.0 32- and 64-bit editions released
« Reply #31 on: June 14, 2010, 03:45:03 pm »
Hmm... but I found a real bug too :)

This code snippet is supposed to work fine and indeed does work fine with gcc 4.4 as well as gcc 4.5 non-optimized.
However, it crashes in optimized build. #pragma GCC optimize ("-O0") immediately preceding the function prevents crash. It appears that the compiler wrongly "optimizes out" the variable sizeReq and uses nullptr as its memory address.

Code: [Select]
DynamicLibrary iphlpapi("iphlpapi.dll");

if(iphlpapi)
{
typedef DWORD (WINAPI *GetIfTable_t)(PMIB_IFTABLE,PULONG,BOOL);
GetIfTable_t GetIfTable_fun = iphlpapi.GetSymbol("GetIfTable");

if(!GetIfTable_fun) // be sure funcptr is valid
return;

PMIB_IFTABLE pInfo = 0;
DWORD sizeReq = 0;

// supplying a zero-size buffer returns ERROR_INSUFFICIENT_BUFFER
// and writes the required buffer size to sizeReq
GetIfTable_fun(0, &sizeReq, 0); // crashes writing to address 0x00000000, i.e. &sizeReq == nullptr

// now reserve the correct size
pInfo = (PMIB_IFTABLE) alloca(sizeReq);

// and finally, go for the real thing
if(GetIfTable_fun(pInfo, &sizeReq, 0) == NO_ERROR )
{
for(...)
...
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline TDragon

  • Lives here!
  • ****
  • Posts: 936
    • Twilight Dragon Media
Re: TDM-GCC 4.5.0 32- and 64-bit editions released
« Reply #32 on: June 14, 2010, 07:07:05 pm »
Yep, definitely looks like a case of faulty optimization. If you feel like submitting the source as a test case, I'll make sure it hits GCC Bugzilla.
http://tdm-gcc.tdragon.net/ - TDM-GCC compiler suite for Windows (GCC 5.1.0 2015-06-28, 32/64-bit, no extra DLLs)

Offline billyonthemountain

  • Multiple posting newcomer
  • *
  • Posts: 40
Re: TDM-GCC 4.5.0 32- and 64-bit editions released
« Reply #33 on: June 14, 2010, 11:08:01 pm »
thanks for this much awaited release John !  :D

You can run the TDM64 edition on a 32-bit machine; although the compiler can generate 64-bit code, it's built as 32-bit binaries.

Any plans to make a native 64bit version ? (not that it matters that much...)

Also Loaden mentions on his google code page :
Quote
What's the disadvantages of MinGW TDM 4.4.1
1. It doesn't have the official MinGW patches included.

Which patches is he mentioning and is it still valid for 4.5.0 ?

Best regards,
Billy
(ASM, C/C++)||(VISION&AI)||(EMBEDDED SYSTEMS)

Offline TDragon

  • Lives here!
  • ****
  • Posts: 936
    • Twilight Dragon Media
Re: TDM-GCC 4.5.0 32- and 64-bit editions released
« Reply #34 on: June 14, 2010, 11:21:48 pm »
Any plans to make a native 64bit version ? (not that it matters that much...)
Not until Windows stops supporting 32-bit programs.

Quote
Also Loaden mentions on his google code page :
Quote
What's the disadvantages of MinGW TDM 4.4.1
1. It doesn't have the official MinGW patches included.

Which patches is he mentioning and is it still valid for 4.5.0 ?
I haven't the foggiest, and I believe the official MinGW 4.5.0 release is unpatched.

-John E. / TDM
http://tdm-gcc.tdragon.net/ - TDM-GCC compiler suite for Windows (GCC 5.1.0 2015-06-28, 32/64-bit, no extra DLLs)

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: TDM-GCC 4.5.0 32- and 64-bit editions released
« Reply #35 on: June 14, 2010, 11:27:11 pm »
Yep, definitely looks like a case of faulty optimization. If you feel like submitting the source as a test case, I'll make sure it hits GCC Bugzilla.
Once burnt, twice shy :) I once submitted a bug to Subversion and later found that they published my bug report including my mail address on a publicly accessible site where every spambot would find it. Which, in turn, makes me reluctant to ever do a similar thing again, hehehe :)
But, feel free to submit the snippet, if you like.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline TDragon

  • Lives here!
  • ****
  • Posts: 936
    • Twilight Dragon Media
Re: TDM-GCC 4.5.0 32- and 64-bit editions released
« Reply #36 on: June 15, 2010, 12:11:55 am »
I can't reproduce this with the snippet. What I mean is, if you can provide me with enough of the source file to reproduce the problem in assembly, I can either create a patch myself or submit a formal testcase to GCC Bugzilla myself.
http://tdm-gcc.tdragon.net/ - TDM-GCC compiler suite for Windows (GCC 5.1.0 2015-06-28, 32/64-bit, no extra DLLs)

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: TDM-GCC 4.5.0 32- and 64-bit editions released
« Reply #37 on: June 15, 2010, 04:02:49 pm »
I've tried putting the full function with the accompanying DynamicLibrary class in a new project that just calls the function from main() and nothing else. Unluckily, no optimizing crash in that case. Sending you the complete project that produces the bug is not possible, sadly.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline sankarbose

  • Single posting newcomer
  • *
  • Posts: 4
Re: TDM-GCC 4.5.0 32- and 64-bit editions released
« Reply #38 on: June 15, 2010, 08:59:05 pm »
Hi
i have just downloaded  TDM-GCC 4.5.0 and successfully compiled the apache xerces but i cant run any example programs it gives a error
  " The application failed to initialize properly (0xc0000005). click ok to terminate the application ".
 In the msys shell i received some massages like auto import enabled without --enable-auto-import specified.
please help me , i am a newbie and i have a little knowledge in gcc and mingw.

                                      with regards.............
  
 

              
« Last Edit: June 15, 2010, 09:03:14 pm by sankarbose »

Offline reckless

  • Regular
  • ***
  • Posts: 333
Re: TDM-GCC 4.5.0 32- and 64-bit editions released
« Reply #39 on: June 15, 2010, 10:44:51 pm »
hmm 0xc0000005 = access violation error. seems the code produced tries to write to an area in memory which is protected.

this is also one of the buggers im hunting a bit on mingw's java parts. the weird thing is its totally random but even when the affected executables dont show this the thing will still crash.

one of the main culprits i found where when using crossbuilt libraries (especially if built on linux for win32) one being libgnurx, i rebuilt it on windows and the problem went away.

the auto import thingy is just ld telling you that it uses auto import to satisfy all dependencies (dont worry about that) warning != will not run.

as for the access violation error i cant help much there im afraid would have to try the same code you used and see if it crashes here also.

Offline sankarbose

  • Single posting newcomer
  • *
  • Posts: 4
Re: TDM-GCC 4.5.0 32- and 64-bit editions released
« Reply #40 on: June 15, 2010, 11:37:51 pm »
Hi reckless
 
the programs, i am trying to run is from the sample dir of xerces and i am using windows xp sp2.
the message i received in msys is
Quote
auto-importing has been activated without --enable-auto-import specified on the
 command line.
This should work unless it involves constant data structures referencing symbols
 from auto-imported DLLs.
i have also tried the files from mingw.org but it still gives the same error.

Offline TDragon

  • Lives here!
  • ****
  • Posts: 936
    • Twilight Dragon Media
Re: TDM-GCC 4.5.0 32- and 64-bit editions released
« Reply #41 on: June 15, 2010, 11:55:18 pm »
sankarbose, I will upgrade the TDM-GCC installer to the latest binutils release soon, which should fix your problem. In the meantime, try adding '-Wl,--enable-runtime-pseudo-reloc-v2' to the link command line.
http://tdm-gcc.tdragon.net/ - TDM-GCC compiler suite for Windows (GCC 5.1.0 2015-06-28, 32/64-bit, no extra DLLs)

Offline reckless

  • Regular
  • ***
  • Posts: 333
Re: TDM-GCC 4.5.0 32- and 64-bit editions released
« Reply #42 on: June 16, 2010, 12:19:57 pm »
might explain why it works here my binutils where patched to allways use runtime-pseudo-reloc-v2 as default.

xerces examples work with that.

Offline billyonthemountain

  • Multiple posting newcomer
  • *
  • Posts: 40
Re: TDM-GCC 4.5.0 32- and 64-bit editions released
« Reply #43 on: June 17, 2010, 10:50:29 am »
Ok here some results of me trying to build wxWidgets on Windows 7 x64 (cmd line) :
Code: [Select]
mingw32-make -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1
  • wx 2.9-svn, mingw64-TDM, 64bit mode : Ok
  • wx 2.8.10, mingw64-TDM, 32bit mode : Fails at link-time
  • wx 2.8.10, mingw32-TDM, 32bit mode : Ok

The flags used were (here part of the config.gcc for the failed 2nd try):
Code: [Select]
# Standard flags for CC
CFLAGS ?= -pipe -march=core2 -m32 -floop-interchange -floop-strip-mine -floop-block

# Standard flags for C++
CXXFLAGS ?= -pipe -march=core2 -m32 -floop-interchange -floop-strip-mine -floop-block

# Standard preprocessor flags (common for CC and CXX)
CPPFLAGS ?=

# Standard linker flags
LDFLAGS ?= -Wl,--as-needed -m32

the -m32 switch was replaced by -m64 in the 1st try and by nothing in the 3rd.

Here the error message for the 2nd try:
Code: [Select]
[...]
g++ -shared -fPIC -o ..\..\lib\gcc_dll\wxmsw28u_gcc_custom.dll gcc_mswudll\monod
ll_dummy.o gcc_mswudll\monodll_version_rc.o gcc_mswudll\monodll_appbase.o gcc_ms
wudll\monodll_arcall.o gcc_mswudll\monodll_arcfind.o gcc_mswudll\monodll_archive.o [many more *.o files...]
Creating library file: ..\..\lib\gcc_dll\libwxmsw28u.a
c:/mingw64-tdm/bin/../lib/gcc/x86_64-w64-mingw32/4.5.0/../../../../x86_64-w64-mi
ngw32/bin/ld.exe: i386:x86-64 architecture of input file `gcc_mswudll\monodll_ve
rsion_rc.o' is incompatible with i386 output
collect2: ld returned 1 exit status
mingw32-make: *** [..\..\lib\gcc_dll\wxmsw28u_gcc_custom.dll] Error 1

Any hints at what I might have missed there or why Mingw64 can't build correctly wxWidgets in 32 bit mode ?

edit: I tried again with only minimal flags (ie. no graphite, no march, no as-needed, no pipe) but it still fails in the same way...
« Last Edit: June 17, 2010, 01:12:55 pm by billyonthemountain »
(ASM, C/C++)||(VISION&AI)||(EMBEDDED SYSTEMS)

Offline billyonthemountain

  • Multiple posting newcomer
  • *
  • Posts: 40
Re: TDM-GCC 4.5.0 32- and 64-bit editions released
« Reply #44 on: June 17, 2010, 02:52:57 pm »
The same happens when building the src target of codeblocks :

Code: [Select]
x86_64-w64-mingw32-g++.exe -Lbase\tinyxml -LD:\lib\wxWidgets-2.8.10\lib\gcc_dll -Ldevel  -o devel\codeblocks.exe .objs\src\app.o .objs\src\appglobals.o .objs\src\associations.o .objs\src\compilersettingsdlg.o .objs\src\crashhandler.o .objs\src\dlgabout.o .objs\src\dlgaboutplugin.o .objs\src\environmentsettingsdlg.o .objs\src\infopane.o .objs\src\main.o .objs\src\notebookstyles.o .objs\src\printdlg.o .objs\src\scriptconsole.o .objs\src\scriptingsettingsdlg.o .objs\src\splashscreen.o .objs\src\startherepage.o .objs\src\switcherdlg.o  .objs\src\resources\resources.res  -Wl,--enable-auto-import -mthreads -Wl,--as-needed -m32  -lcodeblocks -lwxscintilla -lwxpropgrid -lshfolder -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lcomctl32 -lodbc32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 -lwxmsw28u  -mwindows
c:/mingw64-tdm/bin/../lib/gcc/x86_64-w64-mingw32/4.5.0/../../../../x86_64-w64-mingw32/bin/ld.exe: i386:x86-64 architecture of input file `.objs\src\resources\resources.res' is incompatible with i386 output
collect2: ld returned 1 exit status
(ASM, C/C++)||(VISION&AI)||(EMBEDDED SYSTEMS)