From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: X-Archive-Original-Message-ID: Date: Wed, 16 Jul 1997 00:47:05 -0400 (EDT) From: Greg Woodbury Subject: Re: RH4.2 fort77 bug In-Reply-To: <199707160259.WAA12007@churchy.gnu.ai.mit.edu> > I don't see enough evidence here to blame gcc. Are you saying > the `nelt->constblock.Const.cd[0] <= 0' subexpression is evaluated > even [if] `ISINT(nelt->headblock.vtype) && nelt->constblock.Const.ci <= 0' > evaluates to a non-zero result?? That's the only way I could see > blaming gcc, since `A && B || C' is equivalent to `(A && B) || C', > which in turn is equivalent to `if (A && B) 1; if (C) 1; else 0;', > using `1' and `0' as short-hand notation for the return value (a la > gcc's statement expressions). That is exactly the problem (I think?) Actually, you may be right. The 'ISINT()' is true and the '.ci' value is positive, which, as I read it, should skip out; then it still goes ahead and evaluates the '.cd[0]' value, which causes a FPE interrupt, since the union contains a NaN value and the 'cmpf' instruction traps. > > Looks like a simple f2c/src coding bug to me. One that is not > an unusual sort of bug, since it's not unlike how people misword > things using English. > > >I changed it to: > > > [...] > > else if ( ISINT(theVtype) && nelt->constblock.Const.ci <= 0 ) > > dclerr("nonpositive dimension", q); > > else if (!ISINT(theVtype) && nelt->constblock.Const.cd[0] <= 0.0 ) > > dclerr("nonpositive dimension", q); > > > >And this takes care of that problem. There are some other problems of > >this sort occurring as well, so I have a few more changes coming I guess. > > I think you made essentially the correct fix, though the wrong > diagnosis regarding gcc. Note that another fix, perhaps a bit closer > to the original (wrong) code, is: > > ... if (ISINT(nelt->headblock.vtype) > ? nelt->constblock.Const.ci <= 0 > : nelt->constblock.Const.cd[0] <= 0) ... > > That clarifies that the test of ISINT governs whether the .ci or > .cd field is compared to 0. You might find it easier using > the above style if you find other cases of incorrect tests involving > ISINT like the one you already found, since the above style doesn't > require any new statements or temp variables. Yes! I like this form for the query, much clearer and only one call to the dclerr() routine. > Please make sure you send these patches to the f2c maintainer, > last I checked! Yep, will do. Greg Woodbury -- To unsubscribe: send e-mail to axp-list-request@redhat.com with 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com