[gnu.gcc] Problem with gcc 1.35 under vms 5.1

mkemi@daimi.dk (Morten Kjeldsgaard) (07/19/89)

Hello again gcc fans!

Thanks to all those who answered my question about large .EXE files! Now
I have a standard .OPT file that I use for linking. It simply contains:

gnu_cc:[000000]gcclib/l, sys$share:vaxcrtl/shareable

and my "Hello, world" program now only takes 4 blocks. But here is another
problem:

I wanted to test what predefined names exists in the gcc system. I made a
program containing several possiblities, gcc,gnu,vms,unix etc. But the
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

Well, maybe the preprocessor takes "define" and does something strange, so
I tested this out:

	main()
	{
	     printf("vms define\n");
	}

and...

$
$ run define
vms define
$

Nope, that wasn't it. Is it "defined" then?

	main () 
	{ 
	   printf("hello, world I am defined\n");
	}
	
$ run hello
hello, world I am defined
%SYSTEM-E-EXQUOTA, exceeded quota
$

Yes, there seems to be a problem when you print out the word "defined".
A compiler bug, or what?

 -~-
Morten Kjeldgaard  
mok@kemi.aau.dk  ~ mok@aaukibi.dk  ~  ...!mcvax!dkuug!aaukibi!mok 
Biostructural Chemistry, Department of Chemistry, Aarhus University
Langelandsgade 140, DK-8000 Aarhus C, Denmark
Phone: +45 86 202711 + 6751 ~ Telex: 64767 aausci dk ~ Fax: +45 86 196199

TMcG@Physics.Monash.Edu.Au (Tony McGrath) (08/19/89)

In article <2761@daimi.dk>, mkemi@daimi.dk (Morten Kjeldsgaard) writes:

> I wanted to test what predefined names  exists in the gcc system. I made a
> program containing  several  possiblities, gcc,gnu,vms,unix  etc.  But the
> 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
> 

But...

> 	     printf("vms define\n");

 .. works !!! Furthermore ...

> 	   printf("hello, world I am defined\n");

      ...didn't work !!!

        I carried out the same test with GCC 1.22 (and 1.24) on a Vax 8700
VMS 4.7 and got the same results. 

> Yes, there seems to be a problem when you print out the word "defined".
  
          No, it's  not the word  "define". The error  message returned by
VMS after the program in  executed is related to  the length of the string
you are trying  to print. If  you run the  program and then  check out the
value of $STATUS you  will see that the  value returned coincides with the
length of the string in the PRINTF  statement. Also you only get the error
message if the value  of $STATUS is even,  i.e. the low bit  is NOT set so
VMS assumes  something  went wrong.  That  is why  your  second experiment
worked. 

You can overcome this problem if you include in SSDEF, the "System Service
Return  Status  Code   Definitions",  and  call   the  EXIT  routine  with
appropriate argument at the  end of your  MAIN program. So  now you end up
with : 

	#include <ssdef.h>
	main()
	{
	     printf("vms defined\n");
	     exit(SS$_NORMAL);
	}

> A compiler bug, or what?

            Seems that way.

                  Cheers,

                             Tony
-- 

Tony McGrath, Physics Dept., Monash Uni. VIC 3168, Australia
Internet: TMcG@vaxc.cc.monash.edu.au  Ph: +61 3 565 3666  FAX: +61 3 565 3637
ACSnet:   TMcG@vaxc.cc.monash.oz
PSI:      PSI%+505235621000::TMCG