Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!clyde!cbosgd!ihnp4!cuae2!ltuxa!ttrdc!levy From: levy@ttrdc.UUCP (Daniel R. Levy) Newsgroups: comp.os.vms Subject: printf bombs in VMS C if format too long Message-ID: <1766@ttrdc.UUCP> Date: Thu, 18-Jun-87 01:15:43 EDT Article-I.D.: ttrdc.1766 Posted: Thu Jun 18 01:15:43 1987 Date-Received: Sat, 27-Jun-87 04:16:40 EDT Organization: AT&T, Skokie, IL Lines: 32 Keywords: VMS, C, printf, bomb When trying to port a C program which runs just fine on UNIX systems to VMS I came across a problem with VERY long formats (over 512 characters). The symptom is that the program dies with an Access Violation which prints out a Stack Dump and a message about improper handler, image exit forced. (No offending program line is indicated in the stack dump.) The following snippet of code will exhibit the problem (VMS C 2.1): main() { char hugefmt[520]; int i; for (i=0; i<516; i++) hugefmt[i] = 'X'; hugefmt[i++] = '%'; hugefmt[i++] = 'd'; hugefmt[i++] = '\n'; hugefmt[i] = '\0'; printf("HERE GOES...\n"); printf(hugefmt,1); /* *BOOM* stack dump */ } Has anyone already SPR'd this? Is it fixed in a version of VMS C later than 2.1? Is this a "documented" "feature"? UNIX systems don't choke on this kind of format, which can be used to provide a template for a long, many-line message which needs only one call to printf to instantiate. -- |------------dan levy------------| Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa, | an engihacker @ | vax135}!ttrdc!ttrda!levy | at&t data systems division | Disclaimer: try datclaimer. |--------skokie, illinois--------|