This is the mail archive of the gcc-patches@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: [gfortran testsuite, committed] Re: gfortran.dg/forall_1.f90


Tobias Schlüter wrote:
> FX Coudert wrote:
> > Isn't this true? I think that if optimization doesn't respect that, it
> > is a problem, isn't it?
> 
> That's what I thought when I wrote the testcase.  But then it occured to me
> that the optimizers could assume that since i is undefined, i /= 0 is
> undefined, and hence the compiler could probably validly assume that the
> assignment will never be executed.  I don't know if that's what happened.

The optimizers (if suitably anthropomorphized!) could also make the
observation that, according to the standard, they can do whatever they
want with an undefined expression, and thus can treat it as having the
value that results in fastest code.  :)  This is a valid _choice_, not
an assumption.

At the very least, the optimizer is certainly not required by the
standard -- and should not, IMHO, be expected by the user -- to do a
memory lookup for a variable that it can tell has not been initialized. 
This is rather similar to not evaluating expressions that have known
values at compile time (and may well in practice be treated by the same
code, unintentionally).

- Brooks


-- 
The "bmoses-nospam" address is valid; no unmunging needed.


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