scw%ucla-locus@cepu.UUCP (09/17/83)
From: Steve Woods <cepu!scw@ucla-locus> There is a bug in the Berkley C compiler (in c1) as follows: The problem was first noticed during a fortran compile. The symptom was an error from the asm pass (x 0034). The statment being compiled into the error is the goto part of an assigned goto. The cause of the error is a bad template for the Ritchie code generator. The cause of the bad template is the Sccs id comment in table.s. Table.s is processed by a program called cvopt before being given to as. The bug will affect all indirect jump commands generated by the c compiler. The FIX, remove the sccs comment from table.s. this is the line -> /* @(#)table.s 2.1 SCCS id keyword */ / / c code tables-- compile to register / A fortran program to use when checking for the problem: integer i assign 20 to i goto i,(20,30) 20 continue 30 continue stop end The output (with much crud removed) of f77 -S test.s. Note the difference on line 5. correct text incorrect text 1 .text .text 2 jbr L11 jbr L11 3 L12:mov $L14,2+v.1 L12:mov $L14,2+v.1 4 clr v.1 clr v.1 5 jmp *2+v.1 jmp *2+v.1L14:L15:clr -(sp) 6 L14:L15:clr -(sp) sxt -(sp) 7 sxt -(sp) mov $L16,-(sp) 8 mov $L16,-(sp) jsr pc,_s_stop 9 jsr pc,_s_stop add $6,sp 10 add $6,sp L13:jmp cret 11 L13:jmp cret