Ticket #5168 (closed Bug report: worksforme)
gcc compiler switches -O2 and -O3 generates bad code. use -O
| Reported by: | jmichae34 | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | FileZilla Client |
| Keywords: | Cc: | ||
| Operating system type: | Windows | Operating system version: | XP Pro Sp3 |
Description
I have written a SHA512 implementation for my own use, and I could not get get the right test results with integer calculations using gcc -O2 or -O3. So I am saying that gcc -O2 and gcc -O3 both generate corrupt, improper code. gcc -O generates good code.
SHA512 involves a lot of shifts, multiplies, adds. I understand packets (if you are doing that) require calculations as well, for calculating length, size, checksums, etc. so there may be some similarities in the calculations.
I suggest you stay away from using -O2 or -O3 and stick with -O for compiler optimization.
You may find some bugs disappear once you switch to -O.
Suggest you do the same with FileZilla Server.
I also use mingw. I used to use mingw, but now I use mingw-w64, since it has TR1 and it can compile 64-bit code.
There is also a known compiler bug I discovered (gcc folk won't fix it - talk to them?) that -fpack-struct does not work with iostream, locale, fstream C++ libraries. It will generate huge numbers of errors. They said something like it is not supposed to work together or something like that. (bolderdash)
These are not a problem with microsoft or borland commercial compilers.
I am basing this bug on the information I obtained in the Help|About dialog where it says "Compiler Flags":
FileZilla Client
Version: 3.3.1
Build information:
Compiled for: i586-pc-mingw32msvc
Compiled on: x86_64-unknown-linux-gnu
Build date: 2010-01-03
Compiled with: i586-mingw32msvc-gcc (GCC) 4.2.1-sjlj (mingw32-2)
Compiler flags: -g -O2 -Wall -g -fexceptions
Linked against:
wxWidgets: 2.8.10
GnuTLS: 2.8.3
