Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Access Violation in C programming in Open VMS

Ragavendran_1
Occasional Advisor

Access Violation in C programming in Open VMS

Hi All.

I am working in FORTRAN in Open VMS, but my situtaion now is to debug the C program to find out the stack dump(SD) as follows:

%SYSTEM-F-ACCVIO, access violation, reason mask=00, virtual address=0000000000000BB8, PC=FFFFFFFF8050E990, PS=0000001B
%TRACE-F-TRACEBACK, symbolic stack dump follows

I have identified the place where the error is thrown. but wanna know in what case this ACCESS VIOLATION will be thrown.

Thanks
Ragav.
6 REPLIES
Kris Clippeleyr
Honored Contributor

Re: Access Violation in C programming in Open VMS

Ragav,

You seem to have a write operation failing on address %x0BB8 (pretty/too low in P0 space).
Without any further info it's hard to tell what went wrong.
Please have a look at:
http://labs.hoffmanlabs.com/node/800
for further info on debugging ACCVIOs.

Regards,
Kris (aka Qkcl)
I'm gonna hit the highway like a battering ram on a silver-black phantom bike...
Joseph Huber_1
Honored Contributor

Re: Access Violation in C programming in Open VMS

>> have identified the place where the error is thrown

This would be the interesting part: which statement is causing the access violation ?
It can be anything accessing an invalid memory location: a virtual address not mapped in the processes address space or writing to a location which is read-only.
Show us the C statement where it occurs.
Most common reasons are: calling a routine with the wrong kind of arguments: passing a value instead of a reference or vice versa.
Writing to a read-only variable (e.g. a literal string).
Accessing an argument missing from the call.
Array index over-/under-flow: accessing an array element outside its dimension.
...

Since You are mentioning Fortran and C: be aware of the different argument passing defaults: Fortran always pass by reference, C passes single variables by value.
On VMS in particular: Fortran passes strings by descriptor, C expects the address of the string.

http://www.mpp.mpg.de/~huber
Richard Brodie_1
Honored Contributor

Re: Access Violation in C programming in Open VMS

BB8 is 3000 decimal. It's likely that you have passed a variable containing the value 3000 by value, when you should have passed it by reference.

Stricter prototypes may help you catch this kind of error.
John Gillings
Honored Contributor

Re: Access Violation in C programming in Open VMS

Ragav,

small correction on Kris' answer. Your program has attempted a READ on memory location 0BB8, which has failed. This is indicated by the reason mask. That address is on the first page of virtual memory, which is always protected noread/nowrite in order to catch references to nil pointers.

Most likely an argument mismatch of some sort. use DEBUG to work it out.
A crucible of informative mistakes
Steven Schweda
Honored Contributor

Re: Access Violation in C programming in Open VMS

> I am working in FORTRAN in Open VMS, but my
> situtaion now is to debug the C program
> [...]

So, are you working on Fortran code, C code,
or both?

> [...] use DEBUG to work it out.

Or post some actual code, so that a
non-psychic might be able to see what's
happening.

Or: help /mess /faci = system accvio
H.Becker
Honored Contributor

Re: Access Violation in C programming in Open VMS

>>>
Your program has attempted a READ on memory location 0BB8, which has failed. ... That address is on the first page of virtual memory, which is always protected noread/nowrite in order to catch references to nil pointers.
<<<

Just some nits, which do not help with the base problem, but there is some misunderstanding.

This is Alpha or I64, right? On VAX this would not be the first page. Anyway, the first page is NOT "always protected noread/nowrite". It is just a "normal" page which usually is not mapped. The linker does this for you when it assigns virtual addresses for a main image.

As said before, the intention is to catch coding errors like uninitialized pointers. But there is nothing in VMS which stops you from mapping that page. There are various techniques to get to that page.

Also, consider a translated VAX image which has writable data on the second VAX page, at hex 200. Then the first Alpha page IS mapped, readable and writable in user mode.