From: Ben Peddell User-Agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: Bug 00314 -- div() still broken References: <3e9c6920$0$21928$afc38c87@> <3EA5477F DOT 2020901 AT cyberoptics DOT com> <3ea85d95$0$12489$4c41069e AT reader1 DOT ash DOT ops DOT us DOT uu DOT net> <3ea97d4c$0$19415$4c41069e AT reader1 DOT ash DOT ops DOT us DOT uu DOT net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Lines: 36 Message-ID: Date: Sat, 26 Apr 2003 23:17:04 +1000 NNTP-Posting-Host: 144.134.89.66 X-Trace: newsfeeds.bigpond.com 1051362397 144.134.89.66 (Sat, 26 Apr 2003 23:06:37 EST) NNTP-Posting-Date: Sat, 26 Apr 2003 23:06:37 EST Organization: Telstra BigPond Internet Services (http://www.bigpond.com) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Eric Rudd wrote: > Ben Peddell wrote: > >> Obviously, some sort of optimization puts the div_t structure in >> %edx:%eax instead of 16(%ebp). It would be a good optimization if it >> didn't break the libraries. > > > Yes, indeed. So, it looks as if there is a gcc bug here. Where are the > calling conventions documented? I couldn't find them in the gcc.ixx > docs. I think I ought to isolate this and submit a bug report, if gcc > is indeed at fault. I suppose a workaround would be to recompile libc, > but then one wonders whether all the other libraries are also broken. > > -Eric Rudd > rudd AT cyberoptics DOT com > I'm pretty sure I saw somewhere that char, short, int and long are returned in eax. long long is returned in edx:eax. Anything longer than that is returned in memory. I guess that without the optimization, gcc returns the div_t structure in memory, but with the optimization, gcc returns it in edx:eax since it sees that it is the length of a long long. GCC 3.2.1 (the gcc I have under DJGPP) does not optimize the div_t into a long long when given -O3 or -fomit-frame-pointer. In fact, -fomit-frame-pointer does nothing. I went to www.delorie.com to get gcc 3.2.2, and had a look at your bug report whilst I was there. What command line did you use? Anyway, I'm getting gcc 3.2.2. I'll get back tomorrow when I install it.