[comp.sys.m68k] GNU CC on Delta Boxes!

kdq@demott.COM (Kevin D. Quitt) (06/06/90)

    We finally did it!  SYSV 3.6's pcc was good enough (finally) that
if you leave off optimizing (an absolute requirement) and otherwise follow
the advice of Randy Clayton, it compiles.

    We were doing the compile on a spare machine, with 4MB on the 147
card, and it took over 20 minutes before we aborted the compilation of
cparse-tab.c.  A sar taken while this was running showed 0% user, 30%
system, 70% wio, and 0% idle.  We removed the CPU, plugged in another
unit with 8MB, and that module compiled in under three minutes, with sar
showing 95% user, 5% system and 0% wio after the first minute (to load
up all the files into memory)

    On the other hand, gnucc still uses the normal Motorola libraries,
which are still seriously broken.  Does anybody have any idea why the
following program core dumps after the "ints are" line? It'll crash
after that line no matter where you put it, except the last line. 

    Note:  I tried j, sizeof( int ), sizeof( i ), and the constant 4,
and it core dumps no matter what.

#include	<stdio.h>
#include	<sys/sysm68k.h>

char    str[200];

void main()
{
	int	i,j;

	j = sizeof( i );

	printf( "Ints are %d bytes\n", j);
	printf( "Terminal ID is: %s\n", ctermid() );
	printf( "User ID is: %s\n", cuserid() );
	printf( "Current directory is: %s\n", getcwd( str, 128) );
	printf( "Your PATH is: %s\n", getenv( "PATH" ) );
	printf( "Your CPU board type is %d\n", sysm68k( S68CPUBRD ) );
}


-- 
 _
Kevin D. Quitt         Manager, Software Development    34 12 N  118 27 W
DeMott Electronics Co. 14707 Keswick St.   Van Nuys, CA 91405-1266
VOICE (818) 988-4975   FAX (818) 997-1190  
MODEM (818) 997-4496 Telebit PEP last      demott!kdq   kdq@demott.com

      96.37% of the statistics used in arguments are made up.

paul@urbana.mcd.mot.com (Paul Jones) (06/07/90)

In article <286@demott.COM> kdq@demott.COM (Kevin D. Quitt) writes:

> ...
>which are still seriously broken.  Does anybody have any idea why the
>following program core dumps after the "ints are" line? It'll crash
>after that line no matter where you put it, except the last line. 

[stuff deleted]

>void main()
>{
>	int	i,j;

>	j = sizeof( i );

>	printf( "Ints are %d bytes\n", j);
>	printf( "Terminal ID is: %s\n", ctermid() );
>	printf( "User ID is: %s\n", cuserid() );
> ...

The problem is that ctermid and cuserid take either a pointer to a string
where they are to store their results or 0, 0 causing them to store the string
internally.

As the program is now, whatever garbage is on the stack gets passed as the
place to store the string, which is usually an illegal location.
-- 
------
Paul Jones,  Motorola MCD-UDC                       paul@urbana.mcd.mot.com
1101 E. University Ave.                             ...!uiucuxc!udc!paul
Urbana, IL 61801, USA                               (217) 384-8529