On Sep 16, 4:14 pm, steve <
kar...@comcast.net> wrote:
> On Sep 16, 6:15 am, amgarching <
alexei.matv...@gmail.com> wrote:
>
>
>
> > The code that inspired me is below.
> > Works with Intel fails with Gfortran 4.3.2.
When compiled with Intel 11.1 the program terminates
normally and produces the output:
$ ./a.out
x%c = 1.000000 2.000000 3.000000
x%c = 10.00000 20.00000 30.00000
x%c = 10.00000 20.00000 30.00000 40.00000
x%c = 100.0000 200.0000 300.0000 400.0000
>
> You forgot to define the meaning of "Works"
> and "fails". You also forgot to mention the
> version of the Intel compiler. And more
> importantly, why are you using a 3 year old
> compiler that just might have a bug that
> may have been fixed sometime in the past
> 3 years?
It must have been fixed (if it were a bug and not an unspecified
behavior). Indeed with Gfortran 4.4 the output is identical.
A workaround is obvious. But I hoped for an enlightening
discussion to understand the rules to tell legal and illegal code
apart.
I know that aliasing should be avoided and
call assign(x, x)
may even produce a warning with some compilers telling that the
same argument is associated both with intent(in) and intent(out)
parameters. On the other hand
x = x
must be legal in a sane setup. So what is actually happening
if assignment is redefined?
Alexei