From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from merlin.resmel.bhp.com.au ([134.18.1.6]) by hawkwind.utcs.toronto.edu with SMTP id <2645>; Wed, 13 Jan 1993 01:08:00 -0500 Received: from cerberus.bhpese.oz.au by merlin.resmel.bhp.com.au with SMTP id AA09189 (5.65c/IDA-1.4.4 for ); Wed, 13 Jan 1993 17:07:12 +1100 Received: from localhost by cerberus.bhpese.oz.au with SMTP id AA17370; Wed, 13 Jan 1993 17:06:41 +1100; sendmail 5.67a/Sm3.5RMSU (from Sm@cerberus.bhpese.oz.au for rc@hawkwind.utcs.toronto.edu) Message-Id: <199301130606.AA17370@cerberus.bhpese.oz.au> To: rc@hawkwind.utcs.toronto.edu Subject: Re: rc under hp-ux X-Face: '82~l%BnDBWVn])DV^cl_%bla$T]kNbRN&]>v{ED9[" >From: Scott Merrilees >We have aquired a hp 9000/817 running hp-ux A.09.00, and I started >my usual porting sequence, compile rc. Unfortunately, it doesn't >work. More specifically stdargs/varargs seems to be playing up. >Compiling -O causes the compiler to barf on print.c, compiling -g >completes, but then execution results in core dumps. It looks like there is a bug in how the hp compiler handles stdarg/varargs stuff. va_start() results in a call to __builtin_va_start(), which I assume is intercepted by the compiler as a special function, & it tries to do some magic. This doesn't seem to work if the first argument is a structure element reference using . or ->. The work around was to replace the structure element references with simple variables. I have raised this matter with hp support, so hopefully the compiler will get fixed. In the interim, if anyone has this problem with a hp, they might like to try the following patch to print.c. Sm -- *** print.c.orig Mon Apr 6 14:22:28 1992 --- print.c Wed Jan 13 16:44:05 1993 *************** *** 272,278 **** int n = -format->flushed; va_list saveargs = format->args; ! va_start(format->args, fmt); n += printfmt(format, fmt); va_end(format->args); format->args = saveargs; --- 272,278 ---- int n = -format->flushed; va_list saveargs = format->args; ! { va_list ap; va_start(ap, fmt); format->args = ap; } n += printfmt(format, fmt); va_end(format->args); format->args = saveargs; *************** *** 300,306 **** format.flushed = 0; format.u.n = fd; ! va_start(format.args, fmt); printfmt(&format, fmt); va_end(format.args); --- 300,306 ---- format.flushed = 0; format.u.n = fd; ! { va_list ap; va_start(ap, fmt); format.args = ap; } printfmt(&format, fmt); va_end(format.args); *************** *** 341,347 **** Format format; char *result; format.u.n = 1; ! va_start(format.args, fmt); result = memprint(&format, fmt, ealloc(PRINT_ALLOCSIZE), PRINT_ALLOCSIZE); va_end(format.args); return result; --- 341,347 ---- Format format; char *result; format.u.n = 1; ! { va_list ap; va_start(ap, fmt); format.args = ap; } result = memprint(&format, fmt, ealloc(PRINT_ALLOCSIZE), PRINT_ALLOCSIZE); va_end(format.args); return result; *************** *** 351,357 **** Format format; char *result; format.u.n = 0; ! va_start(format.args, fmt); result = memprint(&format, fmt, nalloc(PRINT_ALLOCSIZE), PRINT_ALLOCSIZE); va_end(format.args); return result; --- 351,357 ---- Format format; char *result; format.u.n = 0; ! { va_list ap; va_start(ap, fmt); format.args = ap; } result = memprint(&format, fmt, nalloc(PRINT_ALLOCSIZE), PRINT_ALLOCSIZE); va_end(format.args); return result;