Skip to content

Fix Java code generation bugs in VALUE ALL literal initialization#790

Merged
yutaro-sakamoto merged 2 commits intoopensourcecobol:developfrom
tsh-hashimoto:fix/dot-memcpy
Feb 25, 2026
Merged

Fix Java code generation bugs in VALUE ALL literal initialization#790
yutaro-sakamoto merged 2 commits intoopensourcecobol:developfrom
tsh-hashimoto:fix/dot-memcpy

Conversation

@tsh-hashimoto
Copy link
Contributor

@tsh-hashimoto tsh-hashimoto commented Feb 23, 2026

Related to #785

This pull request makes minor adjustments to the code generation logic in cobj/codegen.c related to how the memcpy function is invoked in the generated output. The changes focus on correcting the syntax and parameters used for the .memcpy calls.

Most important changes:

Code generation output corrections:

  • Changed the generated function call from memcpy ( to .memcpy ( to ensure correct method invocation syntax in the output.
  • Fixed the calculation of the offset parameter for .memcpy in a loop, replacing i0 * %u with %u where the value is now explicitly calculated as (i * l->size).

* Fix Java code generation for VALUE ALL literal initialization
* Fix missing dot in memcpy method call and resolve variable scope error where loop variable i0 was referenced outside the for loop.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes two bugs in the Java code generation for COBOL VALUE ALL literal initialization in the file cobj/codegen.c. The bugs were in the joutput_initialize_literal function, which generates Java code for initializing fields with literal values.

Changes:

  • Fixed missing dot prefix in generated .memcpy() method call (line 2216)
  • Fixed incorrect loop variable reference i0 being used outside of loop scope (line 2237)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tsh-hashimoto tsh-hashimoto marked this pull request as ready for review February 25, 2026 04:21
@yutaro-sakamoto yutaro-sakamoto merged commit a727fec into opensourcecobol:develop Feb 25, 2026
305 of 306 checks passed
@yutaro-sakamoto yutaro-sakamoto mentioned this pull request Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants