Re: matmul trouble



Wade Ward <invalid@xxxxxxxxxxxx> wrote:

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

program maine2
integer :: x(3,3), z(3,3)
write (*,'(a)',advance='no') 'Give me 9 ints: '
read(*,*) x

z=matmul(x,x)
write (*,*) x, z
end program maine2
I'm puzzled that this should turn into a runtime error with 123456789 as
an input. You'd think the usual culprit would be inappropriately-sized
arrays, but it's hard to go wrong on that count with square matrices.
Ideas?

It's difficult to show carriage return on a usenet message. I am hitting
carriage return after each int, with no spaces or any bonehead stuff like
that.

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.

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.

Something else.

I know those are vague, esoteric, and of little help. But frankly,
that's about as good as I can do with the information given.

--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
.



Relevant Pages

  • Re: narrowing conversions with arrays
    ... Causes the runtime error. ... So the compiler doesn't raise an error because bases can contain an instance ... An unhandled exception of type 'System.ArrayTypeMismatchException' occurred ... Inheritedinheriteds; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: segmentation fault on calloc
    ... > Failure to #include something is only going to confuse the compiler. ... returns `int', while in fact it returns `void *'. ... which may well cause a runtime error. ...
    (comp.lang.c)
  • Re: Why do i get runtime error ?
    ... I get runtime error for the above code. ... That depends on the compiler. ... mismatches between a printf format string and arguments (if the format ... Some compilers might be able to help you diagnose ...
    (comp.lang.c)
  • Re: code error
    ... > declaration but nothing if somrbody can try this on their compiler to make ... > sure is not a compiler compatibility problem. ... You say you're getting a runtime error. ...
    (comp.lang.c)