﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
9	pl1 generates incorrect code for string concatenation in some cases (MCR10029)	Charles	Eric Swenson	"In cat_op:

 switch(1):
ea:       if ^ p1 -> reference.long_ref
          then do;
               if size2 ^= bits_per_word then goto ee1;
               if p2 -> reference.ref_count < 1 then call compile_exp(q2);
               else p2 = compile_exp$save(q2);    /* needed later */
               goto aa_2a;
               end;


the code does the ""compile_exp$save(q2)"" which generates the csl to temporary storage,and goes to aa_2a.

aa_2:     if size2 = bits_per_word & mod(code,2) ^= 0
          then do;
               call expmac((lda),p2);
aa_2a:         call expmac((ldq),p3);
               end;
          else do;
aa_3:          call compile_exp(q3);


There we see the missing 'lda'. Moving the label up one, the compiler generates:

         tbits = fbits || (16)""0""b;

000011  aa  6 00032 3735 20   epp7      pr6|26,*
000012  aa  7 00002 3715 20   epp5      pr7|2,*
000013  aa  003 100 060 500   csl       (pr),(pr),fill(0),bool(move)
000014  aa  5 00000 00 0044   descb     pr5|0,36            fbits
000015  aa  6 00102 00 0044   descb     pr6|66,36           fbits
000016  aa  6 00102 2351 00   lda       pr6|66              fbits
000017  aa   000000 2360 07   ldq       0,dl
000020  aa  6 00100 7571 00   staq      pr6|64              tbits

which is looks correct.

Building the test code with the patched compiler:

r 11:07 0.790 27

[pwd]>pl1 -list testbitcat
PL/1 33e
r 11:08 0.870 26

[pwd]>testbitcat
     ubits = 000073FC4D9598677
    fsbits = CFF136566 (12/02/16  1108.1 pst Fri)
The inline results:
    assignbits = CFF1365660000
    substrbits = CFF1365660000
    concatbits = CFF1365660000
The subroutine results:
    assignbits = CFF1365660000
    substrbits = CFF1365660000
    concatbits = CFF1365660000
r 11:08 0.110 0


In so sense do I believe that this fix is correct; it is a blind stab, and requires review by someone who understands the compiler. It appears to fix testbitcat, but who knows what it breaks.

test source at: https://sourceforge.net/projects/dps8m/files/drop/Charles/testbitcat.pl1

"	defect	closed	major	MR12.6f	General	MR12.5	fixed		
