This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Differences in compilation between win and linux version of arm-thumb-elf-gcc 3.2.2
- From: Andrew Haley <aph at redhat dot com>
- To: Axel Lindholm <axel_lindholm at bredband dot net>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 18 Jul 2006 20:41:01 +0100
- Subject: Re: Differences in compilation between win and linux version of arm-thumb-elf-gcc 3.2.2
- References: <44BD46D1.4030705@bredband.net>
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.