🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Scott Hammond Mon, 11 Jul 1988 04:37
C Compiler bug passing a large structure
#807
Author: Scott Hammond
Date: Mon, 11 Jul 1988 04:37
29 lines
2041 bytes
The AT&T C Compiler Issue 3.1 [presumed through] 4.1 and 4.2 (current)
generates incorrect code when passing a structure as an argument whose
size is 4k or greater.  On both AT&T 3b2/400 (Issue 4.1 of C) and AT&T
3b15 (Issue 3.1 of C) the code produced gives an incorrect value to the
argument pointer.  The 3b2 version runs but the called function cannot
see the proper arguments; the 3b15 version dumps core. 

Repeat by creating a two structures with a single character array in
each.  Make one 4k or greater in size (sizeof) and one whose sizeof is
less than 4k (watch out for rounding to word boundaries).  Place
something in each string.  Call a function, pass a struct and try to
print the string (do two).  Compile with cc -S to get assembly output. 
Observe in the two "calls" that the argument which affects the argument
pointer is negative for the function with the 4k or greater struct. 

According to AT&T hotline the bug persists in version 4.2 and will be
fixed next time around.

For those of you thinking "how inefficent, why not pass a pointer?", we
first discovered the bug when using Distributed Concurrent C (AT&T Bell
Labs) and cannot depend on shared memory between processes.

-- Ed Vopata, Scott Hammond

-------- 
Scott Hammond                         Dept of Computing & Information Sciences
scott@harris.cis.ksu.edu                       Kansas State University
scott@ksuvax1.BITNET                              Manhattan, Kansas     
{pyramid,ucsd}!ncr-sd!ncrwic!ksuvax1!scott          (913) 532-6350
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads