eru@tnvsu1.tele.nokia.fi (07/21/89)
Morten Kjeldgaard writes: >resulting program gave me problems. I shaved the program down to the >following, and compiled it with my gcc version 1.35 compiler on a microvax II, >vms 5.1: > >define.c: > > main() > { > printf("vms defined\n"); > } > >Here is what happens when define.exe runs: > >$ run define >vms defined >%SYSTEM-F-ACCVIO, access violation, reason mask=00, virtual address=0000000C, >PC=0000000C, PSL=00000004 I think this is the problem of random program exit codes. There is actually nothing wrong with your program, except that the return value of function "main" is random (or depends on whatever "printf" happens to leave in the registers). The VMS command interpreter is a bit too smart and prints an error message if the exit code the program returns is something that it thinks indicates an error. Various numbers indicate VMS errors and errors in VMS utilities, and they are associated with canned messages. I think even codes normally indicate a serious error and odd codes are just warnings (and are not printed). Codes below 7 are unassigned, that is why a C program that returns 0 in the unix-style gets the mysterious "%NONAME-W-NOMSG, Message number 00000000" upon exit. Try typing "exit 0", "exit 6", "exit 10" etc to VMS to see the messages. The normal "OK"-code is 1. To make programs portable between VMS and unix, one can write something like #ifdef vms #define OK_EXIT 1 #else #define OK_EXIT 0 #endif ... exit(OK_EXIT); Erkki Ruohtula eru@tele.nokia.fi
sommar@enea.se (Erland Sommarskog) (07/30/89)
(I happened to look into this newsgroup/mailing list, and I do not intend to stay, so please give me a copy if you follow up.) Erkki Ruohtula (eru@tnvsu1.tele.nokia.fi) writes: >Morten Kjeldgaard writes: >>$ run define >>vms defined >>%SYSTEM-F-ACCVIO, access violation, reason mask=00, virtual address=0000000C, >>PC=0000000C, PSL=00000004 > >I think this is the problem of random program exit codes. There is actually >nothing wrong with your program, except that the return value of function >"main" is random (or depends on whatever "printf" happens to leave in the >registers). First, I would hold the view that the compiler should load R0 with one, in case there no explicit exit statement. Now, I don't know C, and even less this specific compiler, but if the above is true, this is a flaw in GCC. However, I doubt that is the problem. As Erkki says, when an image terminates in VMS, DCL checks its exit status and displays the messages associated with it if the status is even. (And bit 28 is zero.) Many of the messages are parameterized to give room for file names and similar. Of course there is no chance for DCL to fill in these, so they are left with the original FAO (see below) directives. And ACCVIO is such a message. If it was the result of a random exit code, the message would have looked like: %SYSTEM-F-ACCVIO, access violation, reason mask=!XB, virtual address=!XL, PC=!XL, PSL=!XL These !XB and !XL are placeholders for FAO arguments, similar to those %s and whatever you have in C. (FAO = Formatted ASCII output, a standard system service in VMS.) >Codes below 7 are >unassigned, that is why a C program that returns 0 in the unix-style gets the >mysterious "%NONAME-W-NOMSG, Message number 00000000" upon exit. >Try typing "exit 0", "exit 6", "exit 10" etc to VMS to see the messages. Hm, not really. There is just a little special fix for it. Otherwise the message for 0 would be %SYSTEM-W-NORMAL, normal successful completion The W tells you that something is wrong, W indicates the message has the level warning. Since exitting with zero maybe a common case, for instance due to an uninitated status variable, DEC has chosen to make message 0 a special case, and display the even variants of it as %NONAME--NOMSG. Displaying the message above would be a good ground for confusion. It could also be added that it more sophisticated than odd for OK and even for failure. In fact there are five levels of the status codes: success, informational, warning, error and fatal error. Which level it is, is indicated by the three LSBs in the code. Then as a simplification, the two first ones are odd, and the three latter are even. -- Erland Sommarskog - ENEA Data, Stockholm - sommar@enea.se "Hey poor, you don't have to be Jesus!" - Front 242