[mod.computers.vax] VMS C help needed

conrad@UCSF-CGL.ARPA (Conrad Huang) (02/07/86)

I've been converting a program to run under VMS C C2.0-003.  If I use
the old library from VMS C V1.xxx (crtlib.olb), everything works fine.
When I use the new library (vaxcrtl.olb, creation date 27-APR-1985),
sscanf() seems to fail at random intervals; that is, sscanf() claims
there are no matches (returns -1) even though the input string is
"1 molecules\n" and the format string is "%d molecules".  Has anyone
else seen anything similar?

Things get *real* interesting when I compile and link my program with
the debug option.  If I "go" without setting any watch/break points,
it fails.  If I set a watch point, it sometimes does not fail.  If I
set a break point and look at values, it *never* fails.  I either need
a VMS C guru or a psychiatrist.

*Any* help would be greatly appreciated.  Thanks,

					Conrad Huang

daemon@ucbvax.BERKELEY.EDU (The devil himself) (02/09/86)

> I've been converting a program to run under VMS C C2.0-003.  If I use
> the old library from VMS C V1.xxx (crtlib.olb), everything works fine.
> When I use the new library (vaxcrtl.olb, creation date 27-APR-1985),
> sscanf() seems to fail at random intervals; that is, sscanf() claims
> there are no matches (returns -1) even though the input string is
> "1 molecules\n" and the format string is "%d molecules".  Has anyone
> else seen anything similar?
> 
> Things get *real* interesting when I compile and link my program with
> the debug option.  If I "go" without setting any watch/break points,
> it fails.  If I set a watch point, it sometimes does not fail.  If I
> set a break point and look at values, it *never* fails.  I either need
> a VMS C guru or a psychiatrist.
> 
> *Any* help would be greatly appreciated.  Thanks,
> 
> 					Conrad Huang

Watch out for shared images;  you probably have a shareable version of
the old library installed.

info-vax@ucbvax.UUCP (02/10/86)

In article <8602070150.AA10267@ucsf-cgl.ARPA> conrad@UCSF-CGL.ARPA (Conrad Huang) writes:
>I've been converting a program to run under VMS C C2.0-003.  If I use
>the old library from VMS C V1.xxx (crtlib.olb), everything works fine.
>When I use the new library (vaxcrtl.olb, creation date 27-APR-1985),
>sscanf() seems to fail at random intervals; that is, sscanf() claims
>there are no matches (returns -1) even though the input string is
>"1 molecules\n" and the format string is "%d molecules".  Has anyone
>else seen anything similar?
>

This sounds familiar. I had the same problem with C 2.0. The problem is
fixed in C 2.1 or VMS 4.2 (which comes with the vaxcrtl.exe) If either is
not a viable option, You can patch the vaxcrtl.exe. That is what I did to
fix it. It seems that sscanf sets up a data area on the stack and then calls
a common routine for sscanf, scanf and fscanf. The common routine promptly
checks a bit in the stack data area that is never initialized by sscanf.
All you need to do is determine the byte checked and have patch insert a
clrb x(sp) at the appropriate location. Sorry I can't send you the patch,
but I deleted it after vms 4.2 came out. You can find the location 
easily by following the code in the debugger. I believe the common
routine accessed the data with a bitb 41(R?) instruction.