public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Differences in compilation between win and linux version of arm-thumb-elf-gcc  3.2.2
@ 2006-07-18 18:40 Axel Lindholm
  2006-07-18 19:41 ` Andrew Haley
  0 siblings, 1 reply; 3+ messages in thread
From: Axel Lindholm @ 2006-07-18 18:40 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Differences in compilation between win and linux version of arm-thumb-elf-gcc  3.2.2
  2006-07-18 18:40 Differences in compilation between win and linux version of arm-thumb-elf-gcc 3.2.2 Axel Lindholm
@ 2006-07-18 19:41 ` Andrew Haley
  2006-07-18 20:06   ` Axel Lindholm
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Haley @ 2006-07-18 19:41 UTC (permalink / raw)
  To: Axel Lindholm; +Cc: gcc-help

Axel Lindholm writes:
 > 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.

You need to tell us a bit more.  (I'm always saying that!  :-)

Are the compiler running on Windows and the compiler running on Linux
the exact same version of arm-thumb-elf-gcc ?

Andrew.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Differences in compilation between win and linux version of arm-thumb-elf-gcc   3.2.2
  2006-07-18 19:41 ` Andrew Haley
@ 2006-07-18 20:06   ` Axel Lindholm
  0 siblings, 0 replies; 3+ messages in thread
From: Axel Lindholm @ 2006-07-18 20:06 UTC (permalink / raw)
  To: gcc-help

Yes, they're the exact same versions and are compiled and linked with
the exact same flags.

Andrew Haley wrote:
> You need to tell us a bit more.  (I'm always saying that!  :-)
> 
> Are the compiler running on Windows and the compiler running on Linux
> the exact same version of arm-thumb-elf-gcc ?
> 
> Andrew.
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-07-18 20:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-18 18:40 Differences in compilation between win and linux version of arm-thumb-elf-gcc 3.2.2 Axel Lindholm
2006-07-18 19:41 ` Andrew Haley
2006-07-18 20:06   ` Axel Lindholm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).