if i read this correctly it appears that IMPURE/PURE are not the normal pure attribute used by gcc but some entirely diff attribute specific to FORTANso people are taking about different things
-------- Original message -------- From: Steve Kargl <s...@troutmask.apl.washington.edu> Date: 16/06/2018 17:38 (GMT+00:00) To: Janus Weil <ja...@gcc.gnu.org> Cc: Janne Blomqvist <blomqvist.ja...@gmail.com>, Thomas Koenig <tkoe...@netcologne.de>, fort...@gcc.gnu.org, gcc-patches <gcc-patches@gcc.gnu.org> Subject: Re: [patch, fortran] Handling of .and. and .or. expressions On Sat, Jun 16, 2018 at 01:09:36PM +0200, Janus Weil wrote: > > > Am 15. Juni 2018 20:38:17 MESZ schrieb Steve Kargl > <s...@troutmask.apl.washington.edu>: > >> But at least for pure functions, this optimization looks Ok. > >> > > > >Why is everyone fixated on PURE vs IMPURE functions? > > Simply because it makes a difference in this context! It does not! A function marked as PURE by a programmer must meet certain requirement of the Fortran standard. An unmarked function or a function marked as IMPURE can still meet those same requirements. Marking something as IMPURE has only a single requirement in the standard. An impure elemental procedure processes array arguments in array element order. That's it. Marking a function as IMPURE does not mean the function has side effects. It does not mean that a function must be evaluated for each reference. Are you advocating that gfortran must evaluate ping() twice for impure real function ping() end function ping x = ping() + 0 * ping() end -- Steve