User forums > General (but related to Code::Blocks)

TDM-GCC 4.5 series (Latest: 4.5.2 - 2011-03-27)

<< < (7/23) > >>

thomas:

--- Quote from: TDragon on June 13, 2010, 03:21:43 am ---
--- Quote from: thomas on June 13, 2010, 02:15:58 am ---...
--- End quote ---
Odd. If you feel like sending me the link command line I might see if I can figure it out and/or reproduce it.
--- End quote ---
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 :)

thomas:
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: ---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(...)
...
--- End code ---

TDragon:
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.

billyonthemountain:
thanks for this much awaited release John !  :D


--- Quote from: TDragon on June 13, 2010, 03:21:43 am ---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.

--- End quote ---

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.
--- End quote ---

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

Best regards,
Billy

TDragon:

--- Quote from: billyonthemountain on June 14, 2010, 11:08:01 pm ---Any plans to make a native 64bit version ? (not that it matters that much...)

--- End quote ---
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.
--- End quote ---

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

--- End quote ---
I haven't the foggiest, and I believe the official MinGW 4.5.0 release is unpatched.

-John E. / TDM

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version