Re: matmul trouble



Wade Ward wrote:
"Richard Maine" <nospam@xxxxxxxxxxxxx> wrote in message news:1i0xxk4.1x7rrui1hmerwsN%nospam@xxxxxxxxxxxxxxxx
Wade Ward <invalid@xxxxxxxxxxxx> wrote:

"dpb" <none@xxxxxxx> wrote in message news:f6rmk8$hc7$1@xxxxxxxxxxx

Well, I'd start with trying to enter them the simple way. *DO* put
spaces between them. That is the "normal" form for list-directed input.
Hitting CR between them is slightly more complicated; out to work, but
that's actually not the simple case. I'm not sure why the most simple
and direct form would count as "bonehead".

The runtime error doesn't seem to say a lot.
Nonetheless, it is hugely important. In fact...

It says "Access Violation" The instruction at address 00401756 attempted to
read from location 0562fe70 in file maine2.f95 at line 7.
Well, this doesn't tell me much about what the error is, but it does
tell me what it isn't. This has zero to do with reading array input. In
fact, it is hard to imagine how you could possibly get an error like
that from that program, no matter what you put for input.

My best guesses are along esoteric lines such as...

Running the program that is compiled from different code than you think
it is. I am not kidding. That is actually not an uncommon error. I've
done it myself at one time or other, as I suspect have most long-term
users.
Checked that one. It's happened to me before, too.

Compiler installation problems, including such things as managing to
have something bogus substituted for what ought to be matmul. MIstakes
in invoking the compiler could also fall under here.
I thought matmul was the culprit, but it's the write statement. The data gets in there just fine by typing 1 2 3 4 CR. Sometimes the write statement works, sometimes not. Is there a buffer that needs to get flushed?
program maine3
integer :: x(2,2), z(2,2)
OPEN(11, File="output4.txt",STATUS='REPLACE')
write (*,'(a)',advance='no') 'Give me ints: '
read(*,*) x

z = matmul(x,x)
write (11,'(i4)') z
close(11)
end program maine3
Sometimes the write statement works, sometimes it has the same access violation runtime error. It's vexxing.

If you're sure it's the same source being compiled and executed, then I'm w/ Richard on a possible installation problem or perhaps compiler/linker switch combination error or library mismatch or something similar -- your program compiles and runs w/o error here and there's certainly nothing that shows up reading it that seems a likely culprit for an ACCVIO (which often is indicative of an array bounds error as noted in previous threads on bounds checking).

Which compiler and version/OS and what command line to compile/link?

--


.



Relevant Pages

  • Re: matmul trouble
    ... end program maine3 ... often is indicative of an array bounds error as noted in previous threads ... Which compiler and version/OS and what command line to compile/link? ...
    (comp.lang.fortran)
  • Re: matmul trouble
    ... Hitting CR between them is slightly more complicated; ... in invoking the compiler could also fall under here. ... I thought matmul was the culprit, ... end program maine3 ...
    (comp.lang.fortran)