This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC beaten by ICC in stupid trig test!


Joe Buck wrote:

No. Why would we need such a thing? If the user does not care about
order of evaluation, the user can write a+b+c . As someone said, right
now we can't tell the difference between a+b+c; if we turn it into GIMPLE
and make t1 = a+b; 52 = t1+c; we can't tell if the user initially wrote
(a+b)+c or a+b+c.

This is true as far as Fortran is concerned (I cannot speak for other languages).


A+B+C means that the compiler could either evaluate (A+B)+C or A+(B+C) or (A+C)+B.

If you don't write the parentheses, you leave it up to the compiler to find the most convenient sequence of computations.

Dave Korn wrote:

>   IIUIC the fact that the + operator is specified in the standard as
> binding left-to-right imply that "a + b + c" with no brackets *has* to
> be interpreted as "(a + b) + c".

No, it establishes the way the multi-operator expressions may be combined *for interpretation*. I.e., what the expression means (on a high level, before applying such rules as 1.4 (6) [This standard does not specify] ... the method of rounding, approximating or computing numeric values on a particular processor").

--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
GNU Fortran 95: http://gcc.gnu.org/fortran/ (under construction)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]