Optimizations (-O2) cause different code to be generated on ARM/linux
Original Reporter info from Mantis: Almindor
-
Reporter name: Ales Katona
Original Reporter info from Mantis: Almindor
- Reporter name: Ales Katona
Description:
The included test has a makefile and 2 programs. One is a simple TCP server (echo) and one is a simple TCP client using my lNet library.
When compiled with just "make" no optimizations are used and everything works. When compiled with "make optimal" -O2 is used, and the server crashes.
The biggest problem is, that with -O2 the order of execution of some methods differ.
I have made the library to write information about socket creation, destruction and call to FreeHandles (where it crashes with -O2).
Without optimizations, FreeHandles is called on a socket, before it's Destroy. With optimizations, first Destroy get's called, then FreeHandles (and then it crashes since it's working on invalid socket by now).
The numbers written are pointers to given sockets.
Steps to test:
- extract and go to the directory
- "make"
- in one shell, run ./lserver &LtPos;port>. In another one run ./lclient localhost &LtPos;port> and press escape after connecting. The server should note the connection and disconnect without error. Press escape on server to quit.
- "make clean"
- "make optimal"
- repeat step 3. You will get a crash as the client disconnects on the server.
Mantis conversion info:
- Mantis ID: 9209
- OS: Linux
- OS Build: 2.6 I guess
- Platform: arm
- Fixed in version: 2.2.0
- Fixed in revision: 7971 (#65ef20e0)
- Monitored by: » Alex_Lutovinin (Alex_Lutovinin)