Differences in compilation between win and linux version of arm-thumb-elf-gcc 3.2.2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, I have a big problem with the arm-thumb-elf-gcc compiler. The thing
is that I'm part of a development-team currently developing a GBA game.
Among us programmers there are alot of different software-setups, some
guys are running windows and me and a couple of other are running linux.
The problem started when I wrote a piece of code that looked something
like this:

===============================================================
namespace Hardware {
	...

	struct TimerAttribs
	{
		void (*m_callback)();
		unsigned int m_interval;
		unsigned int m_lastcallback;
		...
	};
	
	std::list<TimerAttribs*> g_timercallbacks;

	...

	void AddTimerCallback(void (*p_callback)(), unsigned int p_interval)
	{
		TimerAttribs *newcallback = new TimerAttribs;
		...

		// this is the line where it all goes wrong
		g_timercallbacks.push_back(newcallback);
		...
	}
}
===============================================================

I had no problems compiling, testing and verifying that my code worked
when I compiled and linked the ROM on my linux setup. However, when i
commited the code to our versioning system all of the windows users
started yelling "WTF!". They had no problems compiling it, but when they
ran the ROM their windows version of the compiler generated it just
locked the entire game. After a couple of hours of debugging at a
friends place I found that it crashed when calling push_back() on my
std::list. In the ROM generated by the linux compiler it obviously
doesn't. The windows users could also run the linux-built ROM without
problems. I solved the problem by making g_timercallbacks a pointer and
allocating it in an initialization-function, I have no idea why this
fixed the problem. Making g_timercallbacks static also worked. Since we
managed to get it fixed it's not really an issue anymore, but what I'd
like to know is what caused this to happend so I can grow wiser and
avoid similar problems in the future.

Sincerely,
Axel Lindholm

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux