ggiergiel@vmsa.cf.uci.edu (07/08/89)
Version 1.0.3 of TMLPascal running under MPW 2.0.2 generates incorrect code for the following source: Type complex = structure r:extended; i:extended; end; var a,b,d :complex; begin ... CMult(c,b,a); ... end; Procedure CMult(Var z:complex; Var y:complex; Var x:complex); Begin z.r:=x.r*x.r - y.i*y.i; z.i:=x.r*y.i + x.i*y.r; end; The correct code will be generated if calculation of z.r and z.i is split into two lines (multiply first and add later). Obviously I gave up on using TMLPascal. At a minimum one would want to see compilers to be able to add and multiply numbers correctly. JGiergiel GGIERGIEL@UCIVMSA.
earleh@eleazar.dartmouth.edu (Earle R. Horton) (07/08/89)
In article <2205@orion.cf.uci.edu> ggiergiel@vmsa.cf.uci.edu writes: > >Version 1.0.3 of TMLPascal running under MPW 2.0.2 >generates incorrect code for the following source: > >Type >complex = structure > r:extended; > i:extended; >end; ... >Procedure CMult(Var z:complex; Var y:complex; Var x:complex); >Begin >z.r:=x.r*x.r - y.i*y.i; >z.i:=x.r*y.i + x.i*y.r; >end; > >The correct code will be generated if calculation of z.r and >z.i is split into two lines (multiply first and add later). >Obviously I gave up on using TMLPascal. At a minimum one would want >to see compilers to be able to add and multiply numbers correctly. >JGiergiel GGIERGIEL@UCIVMSA. TML Pascal II v 3.0.2 generates proper code for the example, except I had to use "record" instead of "structure." It also comes with MPW 3.0, which is superior to MPW 2.0.2. I bought my copy new for the paltry sum of $115, and you should be able to upgrade your copy for less than that. My advice is to buy the upgrade and give TMLPascal another chance. It is not uncommon for compilers to generate incorrect code. In fact, it is a fairly common thing for them to do. I must admit, however, that I too was disillusioned the first time I saw it happen, and that was NOT on a Macintosh. Send, abort, edit, or list? send Article not accepted by server; not posted. inews: Article rejected: news included more text than new text Article appended to /people1/earleh/dead.article A copy may be temporarily found in /people1/earleh/.article Do you have to put up with this nonsense where you work? Earle R. Horton "People forget how fast you did a job, but they remember how well you did it." Salada Tag Lines
siegel@endor.harvard.edu (Rich Siegel) (07/09/89)
In article <14298@dartvax.Dartmouth.EDU> earleh@eleazar.dartmouth.edu (Earle R. Horton) writes: > It is not uncommon for compilers to generate incorrect code. >In fact, it is a fairly common thing for them to do. I must admit, Excuse me???? On what do you base that statement? Anything at all? I will agree that most compilers do have codegen bugs in them, but I don't think that they're particularly common - at least, not in a commercially released product. In Lightspeed Pascal I can count the number of codegen bugs on one hand, and they all occur in fairly obscure circumstances... > Do you have to put up with this nonsense where you work? I have to put up with ALL KINDS of nonsense where I work. ;-) --Rich ~~~~~~~~~~~~~~~ Rich Siegel Staff Software Developer Symantec Corporation, Language Products Group Internet: siegel@endor.harvard.edu UUCP: ..harvard!endor!siegel I classify myself as a real developer because my desk is hip-deep in assembly-language listings and I spend more than 50% of my time in TMON. ~~~~~~~~~~~~~~~