rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* Re: rc under hp-ux
@ 1993-01-13  6:06 Scott Merrilees
  0 siblings, 0 replies; 4+ messages in thread
From: Scott Merrilees @ 1993-01-13  6:06 UTC (permalink / raw)
  To: rc


>From:  	Scott Merrilees <Sm@cerberus.bhpese.oz.au>
>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;


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: rc under hp-ux
  1993-01-12 21:57 ` David J. Fiander
@ 1993-01-13  0:27   ` Scott Merrilees
  0 siblings, 0 replies; 4+ messages in thread
From: Scott Merrilees @ 1993-01-13  0:27 UTC (permalink / raw)
  To: rc


>>From:  	Scott Merrilees <Sm@cerberus.bhpese.oz.au>
>>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.
>
>If I had to guess I would say that this is the fact that rc
>tries to save a va_list in a struct and pass it around.  I had
>the same problem on another system.  I don't know if what rc is
>doing is legit. according to ANSI, but I also don't quite know
>how to change it so that it doesn't do that.

This is what I have found, rc core dumps because format->args is zero.

Sm


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: rc under hp-ux
  1993-01-12  7:12 Scott Merrilees
@ 1993-01-12 21:57 ` David J. Fiander
  1993-01-13  0:27   ` Scott Merrilees
  0 siblings, 1 reply; 4+ messages in thread
From: David J. Fiander @ 1993-01-12 21:57 UTC (permalink / raw)
  To: Scott Merrilees; +Cc: rc

>From:  	Scott Merrilees <Sm@cerberus.bhpese.oz.au>
>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.

If I had to guess I would say that this is the fact that rc
tries to save a va_list in a struct and pass it around.  I had
the same problem on another system.  I don't know if what rc is
doing is legit. according to ANSI, but I also don't quite know
how to change it so that it doesn't do that.

- David


^ permalink raw reply	[flat|nested] 4+ messages in thread

* rc under hp-ux
@ 1993-01-12  7:12 Scott Merrilees
  1993-01-12 21:57 ` David J. Fiander
  0 siblings, 1 reply; 4+ messages in thread
From: Scott Merrilees @ 1993-01-12  7:12 UTC (permalink / raw)
  To: rc

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.

I thought I'd ask if anyone has already solved these problems before
spending the time to make it work, so I'd appreciate it if you could
drop me a line if you have already hacked rc to work under hp-ux.

Sm
--
Scott Merrilees, BHP Information Technology, Newcastle, Australia
Internet: Sm@bhpese.oz.au   Phone: +61 49 40 2132   Fax: ... 2165


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1993-01-13  6:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-01-13  6:06 rc under hp-ux Scott Merrilees
  -- strict thread matches above, loose matches on Subject: below --
1993-01-12  7:12 Scott Merrilees
1993-01-12 21:57 ` David J. Fiander
1993-01-13  0:27   ` Scott Merrilees

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).