Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: 198710 on October 12, 2009, 09:55:39 am

Title: Probably a bug!
Post by: 198710 on October 12, 2009, 09:55:39 am
My c++ code about stl_list is complied with warning :" '__p' might be used uninitialized in this function " under the circumstance where "codeblocks-8.02mingw-setup.exe" is installed.
However,the warnings no longer exist if I install "codeblocks-8.02-setup.exe" and MinGW separately,thus I guess it's C::B's integration problem because I even tried to replace the "MinGW" folder and "mingwm10.dll" under codeblocks program directory.
Here's my code(in the attachment)

[attachment deleted by admin]
Title: Re: Probably a bug!
Post by: zabzonk on October 12, 2009, 12:14:19 pm
Your code is syntactically correct (though you really should be using const references as function parameters in several places). Possibly this  is a problem with the old verdion of GCC  that comes with the CB release version. If using a later version of GCC fixes the problem, as seems to be the case, I don't think you have anything to worry about.
Title: Re: Probably a bug!
Post by: 198710 on October 12, 2009, 04:07:57 pm
Well,then did you notice I said "I even tried to replace the "MinGW" folder and "mingwm10.dll" under codeblocks program directory"?
I replaced the default MinGW folder and "mingwm10.dll" inside "codeblocks-8.02mingw-setup.exe" with the "correct-compile-result" MinGW folder and "mingwm10.dll",still warnings...
Title: Re: Probably a bug!
Post by: zabzonk on October 12, 2009, 05:21:09 pm
You said:

However,the warnings no longer exist if I install "codeblocks-8.02-setup.exe" and MinGW separately,

so I'm a bit confused as to what your problem is - are you still getting warnings or not? And which version of MinGW are you installing separately?

 
Title: Re: Probably a bug!
Post by: 198710 on October 12, 2009, 05:52:40 pm
On my local machine,I installed "codeblocks-8.02mingw-setup.exe";
On my Virtual PC 2007(virtual WinXP guest),I installed "codeblocks-8.02-setup.exe" and MinGW separately,and the MinGW version is "MinGW-5.1.6.exe" from http://sourceforge.net/projects/mingw/files/;
Then I deleted the folder "C:\Program Files\CodeBlocks\MinGW" on my local machine,copied "C:\MinGW"(virtual machine) to "C:\Program Files\CodeBlocks\MinGW"(local machine),and replaced "C:\Program Files\CodeBlocks\mingwm10.dll"(local machine) with "C:\MinGW\bin\mingwm10.dll"(virtual machine) as well.
Warnings never occur on the virtual machine and never disappear on the local one.
Title: Re: Probably a bug!
Post by: koso on October 12, 2009, 06:35:34 pm
Try to compare compiler settings (Settings -> Compiler and Debugger ...) in both enviroments. I think there will be differences in some optimalization flags.
Title: Re: Probably a bug!
Post by: zabzonk on October 12, 2009, 07:06:07 pm
Warnings never occur on the virtual machine and never disappear on the local one.


So your problems are regarding virtualisation. It might have been a good idea to mention that in your original question, and I think you probably need to ask this in a forum that concerns itself with that topic.
Title: Re: Probably a bug!
Post by: 198710 on October 13, 2009, 06:43:22 am
Try to compare compiler settings (Settings -> Compiler and Debugger ...) in both enviroments. I think there will be differences in some optimalization flags.
Great Answer!
I deselected the "-O" on my local machine,the code is then compiled fine,I guess it's a problem of gcc.
But I accidently discovered a small mistake of "codeblocks-8.02mingw-setup.exe" after comparison:
In the "Toolchain executables" tab,"Make program" is set to "make.exe" by default while there's no such file in MinGW's directory,but "mingw32-make.exe" instead,like the one auto-detected on my virtual machine.