This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: Problem with div (1.9.0, arm7tdmi)
- To: Ingo Krabbe <i dot krabbe at dokom dot net>,"Lewin A.R.W. Edwards" <larwe at larwe dot com>
- Subject: Re: Problem with div (1.9.0, arm7tdmi)
- From: "Lewin A.R.W. Edwards" <larwe at larwe dot com>
- Date: Tue, 03 Jul 2001 11:16:30 -0400
- Cc: <newlib at sources dot redhat dot com>,<gcc-help at gcc dot gnu dot org>
- References: <4.3.2.7.2.20010702205606.00b142c8@pop.registeredsite.com>
Hi Ingo,
> > I have been experiencing a very odd bug in div() from newlib 1.9.0 on an
> > arm7tdmi target (using gcc 2.95.2/cygwin). The manifestation of the bug is
> > that subroutines will spontaneously return out of the middle of the
> > routine, or hang, especially on nested div calls. I eventually tracked down
>
>Of course it should work, but you should try
>y = (div(a,b)).rem;
>and
>div_t q = div(a,b);
>x = q.quot;
>y = q.rem;
Thanks for this suggestion, I didn't think of it. Returning structures has
"just worked" in other contexts for me, I didn't suspect it as the problem.
-- Lewin A.R.W. Edwards
Embedded Engineer, Digi-Frame Inc.
Work: http://www.digi-frame.com/
Tel (914) 937-4090 9am-6:30pm M-F ET
Personal: http://www.larwe.com/ http://www.zws.com/
"Far better it is to dare mighty things, to win glorious triumphs, even
though checkered by failure, than to rank with those poor spirits who
neither enjoy much nor suffer much, because they live in the gray twilight
that knows not victory nor defeat."
(Theodore Roosevelt)