-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Internal bug, bad generation of MOVE UNSAFE instruction TO qualified name. #1191
Comments
This issue can be reproduced with the source code on TypeCobolTeam's privateshare, with the file |
Ok I succeed to have a sample to reproduce this issue, the following code will generate the issue: IDENTIFICATION DIVISION.
PROGRAM-ID. Functions.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 RECCTR-DPO-DAT-FIN-CTR-CAT PIC 9.
PROCEDURE DIVISION.
DECLARE PROCEDURE InitFrom PRIVATE
INPUT arg PIC 9.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 RECCTR-DPO-DAT-FIN-CTR-CAT PIC 9.
01 RECCTR-DAT-ECH-FIN PIC 9.
01 TypeOutputAccount TYPEDEF STRICT.
05 DueDate PIC 9.
01 OutputAccount TYPE TypeOutputAccount.
PROCEDURE DIVISION.
EVALUATE TRUE
WHEN NOT ( RECCTR-DPO-DAT-FIN-CTR-CAT = 0 )
MOVE UNSAFE RECCTR-DPO-DAT-FIN-CTR-CAT
TO OutputAccount::DueDate
WHEN NOT ( RECCTR-DAT-ECH-FIN = ZERO )
MOVE UNSAFE RECCTR-DAT-ECH-FIN TO OutputAccount::DueDate
WHEN OTHER
MOVE SPACE TO OutputAccount::DueDate
END-EVALUATE
.
END-DECLARE.
CALL InitFrom INPUT RECCTR-DPO-DAT-FIN-CTR-CAT.
END PROGRAM Functions. |
So the piece of generate code will looks like; *Functions.InitFrom - Params :
* input(arg: pic 9)
EVALUATE TRUE
WHEN NOT ( RECCTR-DPO-DAT-FIN-CTR-CAT = 0 )
* MOVE UNSAFE RECCTR-DPO-DAT-FIN-CTR-CAT
* TO OutputAccount::DueDate
MOVE RECCTR-DPO-DAT-FIN-CTR-CAT
TO OutputAccount::DueDate
MOVE RECCTR-DPO-DAT-FIN-CTR-CAT
TO DueDate OF OutputAccount
WHEN NOT ( RECCTR-DAT-ECH-FIN = ZERO )
* MOVE UNSAFE RECCTR-DAT-ECH-FIN TO OutputAccount::DueDate
MOVE RECCTR-DAT-ECH-FIN TO DueDate OF OutputAccount
WHEN OTHER
* MOVE SPACE TO OutputAccount::DueDate
MOVE SPACE TO DueDate OF OutputAccount
END-EVALUATE
.
END PROGRAM d1dd0726InitFrom. |
The reason is that the Qualifier action comes before erasing UNSAFE word on the MOVE, both actions Qualifer and Erase use replacement tokens, but it is necessary for replacement tokens to be inserted sorted by the location in the target node. Here the replacement token to erase the UNSAFE word is added at the end rather than as first, thus the Codegen creates two buffer for non contigues locations. This occurs in very special cases. Thanks to who reported this issue. |
…or the Codegen. This is important for Insert and Delete replacement tokens, like those of the Qualifier, Replace and Erase actions. Qualifier's tokens are already sorted as they appear first.
We have an internal private source code in which the following code is generated
The fact is that the MOVE... instruction is generated twice one with the qualified named unchanged and the second with the qualified name translated.
The text was updated successfully, but these errors were encountered: