jm36+@ANDREW.CMU.EDU (John Gardiner Myers) (10/16/88)
Gcc version: gcc version 1.30 /afs/andrew.cmu.edu/usr0/cl0x/lib/gcc/@sys/gcc-cc1 poly.i -quiet -g -version -o poly.s GNU C version 1.30 (68k, MIT syntax) compiled by GNU C version 1.30. Command arguments: gcc -v -g -S poly.i Run on a Sun3 running SunOS 3.5. md is m68k.md, tm.h is tm-sun3.h Behavior: The address of the buffer where the return value (a struct) is placed in register d2, but for some inputs (e.g. "%\n/") d2 is clobbered before it is used. Input file: ----- extern struct _iobuf { int _cnt; unsigned char *_ptr; unsigned char *_base; int _bufsiz; short _flag; char _file; } _iob[]; extern struct _iobuf *fopen(); extern struct _iobuf *fdopen(); extern struct _iobuf *freopen(); extern struct _iobuf *popen(); extern struct _iobuf *tmpfile(); extern long ftell(); extern char *fgets(); extern char *gets(); extern char *ctermid(); extern char *cuserid(); extern char *tempnam(); extern char *tmpnam(); extern int errno, signgam; extern double fmod(), gamma(); extern int matherr(); extern double asinh(), acosh(), atanh(); extern double erf(), erfc(); extern double exp(), expm1(), log(), log10(), log1p(), pow(); extern double fabs(), floor(), ceil(), rint(); extern double lgamma(); extern double hypot(), cabs(); extern double copysign(), drem(), logb(), scalb(); extern int finite(); extern double j0(), j1(), jn(), y0(), y1(), yn(); extern double sin(), cos(), tan(), asin(), acos(), atan(), atan2(); extern double sinh(), cosh(), tanh(); extern double cbrt(), sqrt(); extern double modf(), ldexp(), frexp(), atof(); struct exception { int type; char *name; double arg1; double arg2; double retval; }; typedef int jmp_buf[15]; char *strcat(); char *strncat(); int strcmp(); int strncmp(); char *strcpy(); char *strncpy(); int strlen(); char *index(); char *rindex(); typedef struct dict_struct *Type; typedef struct object { int flags; Type type; int Length; union { int Integer, Boolean, Font; float Real; Type Dictionary; unsigned char *String; struct name_struct *Name; struct op_struct *Operator; struct file_struct *File; struct object *Array; } u; } Object; enum file_type { StringFile, StreamFile }; struct file_struct { enum file_type file_type; int available; union { unsigned char *c_ptr; struct _iobuf *f_ptr; } f; }; struct dict_entry { Object entry_key, entry_value; }; struct dict_struct { int dict_flags, dict_size, dict_fill; struct dict_entry *dict_body; }; typedef struct stack { int stack_fill, stack_size; Object overflow, underflow, *stack_body; } *Stack, StackOb; Object NoAccess (); Object SameFlags (), MakeObject (), Cvx (), Cvlit (), ReadOnly (), WriteOnly (), ExecOnly (); int OpCheck (), min (), rCheck (), wCheck (), xCheck (); Object MakeArray (), ParseArray (), getArray (), getIArray (), *BodyArray (); Object MakeBoolean (); Object MakeDict (), DictLoad (), Lookup (), DictFrom (), Load (); Type MakeType (), TypeOf (), BodyDict (); extern int EqTrue (), Equal (); Object FileFrom (), FileString (); int Getch (); struct file_struct *BodyFile (); Object MakeInteger (), IntReal (); Object ParseNumber (); float Deg (), Rad (); Object ParseId (), NameFrom (), MakeName (), Cvn (), StringName (); unsigned char *BodyName (); Object MakeOp (), NameOperator (); Object Parse (); int PolyFirst (), PolySecond (), PolyThird (), PolyPair (); Object MakeReal (), RealInteger (); float BodyReal (), BodyFloat (); char *Malloc (); Object Pop (), Top (), Where (), DictLookup (); int Push (); extern Object MakeString (), StringFrom (), getIString (), ParseString (), ParseHexString (); unsigned char *BodyString (); int lengthString (); extern Object PDictFull; extern Object PDictOverflow, PInvFont, PSyntaxError; extern Object PDictUnderflow, PInvRestore, PTypeCheck; extern Object PExecOverflow, PIOError, PUndefined; extern Object PExecUnderflow, PLimitCheck, PUnFilename; extern Object PInterrupt, PNoCurrentPoint, PUnResult; extern Object PInvAccess, PRangeCheck, PUnMatched; extern Object PInvExit, POpOverflow, PUnregistered; extern Object PInvFileAccess, POpUnderflow, PVMError; extern Type Boolean, Mark, String, Real, Poly, Operator; extern Type Name, File, Dictionary, Condition, Null, Integer; extern Type Array, Mark, Condition, Null, Float, FontID; extern Object SysDict, Absent, Nil; extern Object True, False, Marker, Self; extern Object OpInterp, Lbracket, Rbracket; extern Object StatementEdit, Fstdin, Fstdout, Fstderr; extern Stack OpStack, ExecStack, DictStack; extern jmp_buf env; extern int interactive, verbose; extern char default_library[], *library; extern unsigned char *Bcopy (); extern struct _iobuf *vfp, *Fopen (); extern void Fclose (); extern int getchbuf; Object DictFind(); static int Copy (); int PolyFirst (), PolySecond (), PolyThird (), PolyPair (); Object Parse (f) Object f; { Object res; int c; for (;;) switch (c = (( ( ((f).u.File)->available != 0) && ((f).u.File)->file_type == StreamFile) ? ((getchbuf = (--( ((f).u.File)->f.f_ptr)->_cnt>=0? ((int)*( ((f).u.File)->f.f_ptr)->_ptr++):_filbuf( ((f).u.File)->f.f_ptr))), ((getchbuf != (-1)) ? getchbuf : (( ((f).u.File)->available = 0), Close (f), (-1)))) : GeneralGetch (f))) { default: Ungetch (f, c); res = ParseId (f); if ( ((res).type) == Integer || ((res).type) == Real) return res; else return Cvx (res); case '/': return ParseId (f); case '{': return Cvx (ParseArray (f)); case '}': return True; case '[': return Lbracket; case ']': return Rbracket; case '<': return ParseHexString (f); case '(': return ParseString (f); case ')': return Absent; case (-1): return False; case ' ': case '\t': case '\n': continue; case '%': while ((c = (( ( ((f).u.File)->available != 0) && ((f).u.File)->file_type == StreamFile) ? ((getchbuf = (--( ((f).u.File)->f.f_ptr)->_cnt>=0? ((int)*( ((f).u.File)->f.f_ptr)->_ptr++):_filbuf( ((f).u.File)->f.f_ptr))), ((getchbuf != (-1)) ? getchbuf : (( ((f).u.File)->available = 0), Close (f), (-1)))) : GeneralGetch (f))) != '\n' && c != (-1)) ; Ungetch (f, c); continue; } } ------ Annotated output: ------ #NO_APP .stabs "poly.i",100,0,0,Ltext Ltext: .stabs "int:t1=r1;-2147483648;2147483647;",128,0,0,0 .stabs "char:t2=r2;0;127;",128,0,0,0 .stabs "long int:t3=r1;-2147483648;2147483647;",128,0,0,0 .stabs "unsigned int:t4=r1;0;-1;",128,0,0,0 .stabs "long unsigned int:t5=r1;0;-1;",128,0,0,0 .stabs "short int:t6=r1;-32768;32767;",128,0,0,0 .stabs "long long int:t7=r1;0;-1;",128,0,0,0 .stabs "short unsigned int:t8=r1;0;65535;",128,0,0,0 .stabs "long long unsigned int:t9=r1;0;-1;",128,0,0,0 .stabs "signed char:t10=r1;-128;127;",128,0,0,0 .stabs "unsigned char:t11=r1;0;255;",128,0,0,0 .stabs "float:t12=r1;4;0;",128,0,0,0 .stabs "double:t13=r1;8;0;",128,0,0,0 .stabs "long double:t14=r1;8;0;",128,0,0,0 .stabs "void:t15=15",128,0,0,0 .stabs "exception:T16=s32type:1,0,32;name:17=*2,32,32;\\",128,0,0,0 .stabs "arg1:13,64,64;arg2:13,128,64;retval:13,192,64;;",128,0,0,0 .stabs "_iobuf:T18=s20_cnt:1,0,32;_ptr:19=*11,32,32;\\",128,0,0,0 .stabs "_base:19,64,32;_bufsiz:1,96,32;_flag:6,128,16;\\",128,0,0,0 .stabs "_file:2,144,8;;",128,0,0,0 .stabs "jmp_buf:t20=ar1;0;14;1",128,0,0,0 .stabs "Type:t21=*22=xsdict_struct:",128,0,0,0 .stabs "object:T23=s16flags:1,0,32;type:21,32,32;\\",128,0,0,0 .stabs "Length:1,64,32;u:24=u4Integer:1,0,32;\\",128,0,0,0 .stabs "Boolean:1,0,32;Font:1,0,32;Real:12,0,32;\\",128,0,0,0 .stabs "Dictionary:21,0,32;String:19,0,32;Name:25=*26=xsname_struct:,0,32;\\",128,0, 0,0 .stabs "Operator:27=*28=xsop_struct:,0,32;File:29=*30=xsfile_struct:,0,32;\\",128,0, 0,0 .stabs "Array:31=*23,0,32;;,96,32;;",128,0,0,0 .stabs "Object:t23",128,0,0,0 .stabs "stack:T32=s44stack_fill:1,0,32;stack_size:1,32,32;\\",128,0,0,0 .stabs "overflow:23,64,128;underflow:23,192,128;stack_body:31,320,32;;",128,0,0,0 .stabs "dict_entry:T33=s32entry_key:23,0,128;entry_value:23,128,128;;",128,0,0,0 .stabs "file_type:T34=eStringFile:0,StreamFile:1,;",128,0,0,0 .stabs "file_struct:T30=s12file_type:34,0,32;available:1,32,32;\\",128,0,0,0 .stabs "f:35=u4c_ptr:19,0,32;f_ptr:36=*18,0,32;;,64,32;;",128,0,0,0 .stabs "dict_struct:T22=s16dict_flags:1,0,32;dict_size:1,32,32;\\",128,0,0,0 .stabs "dict_fill:1,64,32;dict_body:37=*33,96,32;;",128,0,0,0 .stabs "Stack:t38=*32",128,0,0,0 .stabs "StackOb:t32",128,0,0,0 .text .even .globl _Parse _Parse: .stabd 68,0,165 link a6,#-20 moveml #0x3000,sp@- movel a1,d2 <<<<< d2 initialized w/addr of return struct. LBB2: .stabd 68,0,170 L2: .stabd 68,0,171 movel a6@(20),a0 tstl a0@(4) jeq L32 movel a6@(20),a0 moveq #1,d1 cmpl a0@,d1 jne L32 movel a6@(20),a0 movel a0@(8),a0 subql #1,a0@ tstl a0@ jlt L34 movel a6@(20),a0 movel a0@(8),d0 movel d0,d0 movel d0,a0 addqw #4,a0 movel a0@,a1 clrl d0 moveb a1@,d0 movel d0,_getchbuf addql #1,a0@ jra L35 L34: movel a6@(20),a0 movel a0@(8),sp@- jbsr __filbuf addqw #4,sp movel d0,_getchbuf L35: moveq #-1,d1 cmpl _getchbuf,d1 jeq L36 movel _getchbuf,d3 jra L37 L36: movel a6@(20),a0 clrl a0@(4) lea a6@(24),a0 subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- jbsr _Close addw #16,sp moveq #-1,d3 L37: jra L33 L32: lea a6@(24),a0 subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- jbsr _GeneralGetch addw #16,sp movel d0,d3 L33: movel d3,d0 movel d0,a6@(-20) addql #1,d0 moveq #126,d1 cmpl d1,d0 jhi L6 LI31: movew pc@(L31-LI31-2:b,d0:l:2),d0 jmp pc@(2,d0:w) L31: .word L18-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L20-L31 .word L21-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L19-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L22-L31 .word L6-L31 .word L6-L31 .word L16-L31 .word L17-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L10-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L15-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L13-L31 .word L6-L31 .word L14-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L6-L31 .word L11-L31 .word L6-L31 .word L12-L31 L6: .stabd 68,0,173 movel a6@(-20),sp@- lea a6@(24),a0 subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- jbsr _Ungetch .stabd 68,0,174 lea a6@(24),a0 subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- moveq #-16,d0 addl a6,d0 movel d0,a1 jbsr _ParseId .stabd 68,0,175 addw #36,sp movel a6@(-12),d1 cmpl _Integer,d1 jeq L8 cmpl _Real,d1 jeq L8 jra L7 L8: .stabd 68,0,176 lea a6@(-16),a0 movel d2,a1 <<<<< d2 used as addr of return struct. movel a0@,a1@ addqw #4,a1 addqw #4,a0 movel a0@,a1@ addqw #4,a1 addqw #4,a0 movel a0@,a1@ addqw #4,a1 addqw #4,a0 movel a0@,a1@ addqw #4,a1 addqw #4,a0 jra L1 jra L9 L7: .stabd 68,0,178 movel a6,a0 subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- movel d2,a1 <<<<< d2 used as addr of return struct. jbsr _Cvx jra L1 L9: L10: .stabd 68,0,180 lea a6@(24),a0 subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- movel d2,a1 <<<<< d2 used as addr of return struct. (etc) jbsr _ParseId jra L1 L11: .stabd 68,0,181 subw #16,sp movel sp,d0 lea a6@(24),a0 subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- movel d0,a1 jbsr _ParseArray addw #16,sp movel d2,a1 jbsr _Cvx jra L1 L12: .stabd 68,0,182 lea _True,a0 movel d2,a1 movel a0@,a1@ addqw #4,a1 addqw #4,a0 movel a0@,a1@ addqw #4,a1 addqw #4,a0 movel a0@,a1@ addqw #4,a1 addqw #4,a0 movel a0@,a1@ addqw #4,a1 addqw #4,a0 jra L1 L13: .stabd 68,0,183 lea _Lbracket,a0 movel d2,a1 movel a0@,a1@ addqw #4,a1 addqw #4,a0 movel a0@,a1@ addqw #4,a1 addqw #4,a0 movel a0@,a1@ addqw #4,a1 addqw #4,a0 movel a0@,a1@ addqw #4,a1 addqw #4,a0 jra L1 L14: .stabd 68,0,184 lea _Rbracket,a0 movel d2,a1 movel a0@,a1@ addqw #4,a1 addqw #4,a0 movel a0@,a1@ addqw #4,a1 addqw #4,a0 movel a0@,a1@ addqw #4,a1 addqw #4,a0 movel a0@,a1@ addqw #4,a1 addqw #4,a0 jra L1 L15: .stabd 68,0,185 lea a6@(24),a0 subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- movel d2,a1 jbsr _ParseHexString jra L1 L16: .stabd 68,0,186 lea a6@(24),a0 subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- movel d2,a1 jbsr _ParseString jra L1 L17: .stabd 68,0,187 lea _Absent,a0 movel d2,a1 movel a0@,a1@ addqw #4,a1 addqw #4,a0 movel a0@,a1@ addqw #4,a1 addqw #4,a0 movel a0@,a1@ addqw #4,a1 addqw #4,a0 movel a0@,a1@ addqw #4,a1 addqw #4,a0 jra L1 L18: .stabd 68,0,189 lea _False,a0 movel d2,a1 movel a0@,a1@ addqw #4,a1 addqw #4,a0 movel a0@,a1@ addqw #4,a1 addqw #4,a0 movel a0@,a1@ addqw #4,a1 addqw #4,a0 movel a0@,a1@ addqw #4,a1 addqw #4,a0 jra L1 L19: L20: L21: .stabd 68,0,195 jra L4 L22: .stabd 68,0,198 L23: movel a6@(20),a0 tstl a0@(4) jeq L25 movel a6@(20),a0 moveq #1,d1 cmpl a0@,d1 jne L25 movel a6@(20),a0 movel a0@(8),a0 subql #1,a0@ tstl a0@ jlt L27 movel a6@(20),a0 movel a0@(8),d0 movel d0,d0 movel d0,a0 addqw #4,a0 movel a0@,a1 clrl d0 moveb a1@,d0 movel d0,_getchbuf addql #1,a0@ jra L28 L27: movel a6@(20),a0 movel a0@(8),sp@- jbsr __filbuf addqw #4,sp movel d0,_getchbuf L28: moveq #-1,d1 cmpl _getchbuf,d1 jeq L29 movel _getchbuf,d2 <<<<< d2 Clobbered jra L30 L29: movel a6@(20),a0 clrl a0@(4) lea a6@(24),a0 subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- jbsr _Close addw #16,sp moveq #-1,d2 L30: jra L26 L25: lea a6@(24),a0 subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- jbsr _GeneralGetch addw #16,sp movel d0,d2 L26: movel d2,d0 movel d0,a6@(-20) moveq #10,d1 cmpl d0,d1 jeq L24 moveq #-1,d1 cmpl a6@(-20),d1 jeq L24 jra L23 L24: .stabd 68,0,200 movel a6@(-20),sp@- lea a6@(24),a0 subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- subql #4,a0 movel a0@,sp@- jbsr _Ungetch .stabd 68,0,201 addw #20,sp jra L4 L5: .stabd 68,0,170 L4: jra L2 L3: LBE2: .stabd 68,0,203 L1: moveml a6@(-28),#0xc unlk a6 rts .stabs "Parse:F23",36,0,0,_Parse .stabs "f:p23",160,0,0,8 .stabs "c:1",128,0,0,-20 .stabn 192,0,0,LBB2 .stabn 224,0,0,LBE2