[comp.sources.d] latest bug in ptc

schwartz@swatsun (Scott Schwartz) (08/06/87)

Here is another bug in ptc  (published in comp.sources.unix)

Consider the following program:

    program main;
    type
      trecptr = ^trec;
      trec = record
        field: integer;
      end;

    procedure test(var recp: trecptr);
    begin
        recp^.field := 0;
    end;

    begin
    end.


What gets generated by ptc is:

    extern void exit();

    typedef int integer;
    extern char *strncpy();

    typedef struct S59 *    trecptr;
    typedef struct S59 {
        integer field;
    }   trec;

     void
    test(recp)
        trecptr *recp;
    {
        recp->->field = 0;		/* GAAAK !!! */
    }

    main()
	{
		exit(0);
	}


The bug seems to be in the handling of pointers to records passed as
var parameters.  Time to go dig into the source :-(
-- 
# Scott Schwartz 
# ...{{seismo,ihnp4}!bpa,cbmvax!vu-vlsi,sun!liberty}!swatsun!!pyra:09