From mint-bounce@lists.fishpool.fi Sat Feb 14 10:50:22 2009 Message-ID: <4996E70E.1030603@atari-source.org> Date: Sat, 14 Feb 2009 10:45:18 -0500 From: Mark Duckworth User-Agent: Thunderbird 2.0.0.19 (Macintosh/20081209) MIME-Version: 1.0 To: Miro Kropacek CC: mint Subject: Re: [MiNT] C++ Stuff References: <499665F5.809@atari-source.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SA-Score: -1.4 X-ecartis-version: Ecartis v1.0.0 Sender: mint-bounce@lists.fishpool.fi Errors-to: mint-bounce@lists.fishpool.fi X-original-sender: mduckworth@atari-source.org Precedence: bulk List-help: List-unsubscribe: List-Id: X-List-ID: List-subscribe: List-owner: List-post: Miro Kropacek wrote: > > Everything is fine except when I use vectors so far. It seems if > I use vector.push_back() there is a call to an FPU function. > In gdb this results in an EMTTRAP emulation trap and the > > Hmm and that is T? No matter, integer or float number, this always happen? > T is a buddy class. The vector is defined in the buddylist class. The failure happens when constructing a buddylist. class buddy { public: string screenname; unsigned short int selected; unsigned short int highlighted; unsigned short int online; unsigned short int away; struct aim_userinfo_s *userinfo; string prof; string info; int info_display_offset; void is_now_online(); void is_now_offline(); void is_now_away(); void is_now_back(); }; class buddylist { public: vector thelist; buddy* find_by_screenname(string in_sn); void add(string in_sn); buddylist(bool fromdisk); void remove(string in_sn); void print(); void save_to_disk(); string oscar_string(); class AnError { }; }; The buddylist constructor opens a local file and reads it line by line to add buddies to the list. This is a snippet: buddy mybuddy; mybuddy.online=0; mybuddy.selected=0; mybuddy.away=0; mybuddy.highlighted=0; mybuddy.screenname=string(line).substr(1, strlen(line)-2); mybuddy.userinfo=NULL; mybuddy.prof=""; thelist.push_back(mybuddy); It dies on the push_back call. > It works when I compile with -m68020-60. > > This would explain if your T is some float number -- i.e. it would > mean there's a bug in floating-point emulation for 68000. > > Does anyone else think it's strange that something as simple as > vector would need FPU functions? > > since push_back is nothing more than adding variable to some (mostly > prealloced) space, why not. Imagine you keep it in FP register and you > want to add it to this array -- something like fmove.s fp0,(a3)+ is > quite normal. Did you try to disassemble it? > I did not. But I will. > -- > MiKRO / Mystic Bytes > http://mikro.atari.org