Skip to content

Add new compiler test to reproduce issue#2389

Merged
jwillemsen merged 10 commits into
DOCGroup:masterfrom
jwillemsen:jwi-vs2022bug
Jun 6, 2025
Merged

Add new compiler test to reproduce issue#2389
jwillemsen merged 10 commits into
DOCGroup:masterfrom
jwillemsen:jwi-vs2022bug

Conversation

@jwillemsen
Copy link
Copy Markdown
Member

@jwillemsen jwillemsen commented Jun 4, 2025

Summary by CodeRabbit

  • New Features
    • Added a new test to verify compiler behavior with specific class and union constructs.
  • Chores
    • Included the new test in the test suite and build configuration.
  • Style
    • Improved formatting in documentation comments for clarity.

    * ACE/tests/Compiler_Features_42_Test.cpp:
      Added.

    * ACE/tests/run_test.lst:
    * ACE/tests/tests.mpc:
    * ACE/tests/Compiler_Features_42_Test.cpp:
    * TAO/tao/AnyTypeCode/TypeCode_Case_T.h:
    * ACE/tests/Compiler_Features_42_Test.cpp:
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 4, 2025

Walkthrough

A new test, Compiler_Features_42_Test, has been added to the ACE test suite to reproduce a Visual Studio 2022 compiler issue involving unions. Corresponding entries were added to the test list and build configuration. Additionally, a minor comment formatting fix was applied to a header in the TAO module.

Changes

File(s) Summary
ACE/tests/Compiler_Features_42_Test.cpp Added new test source file defining a class with a union member to reproduce a VS2022 compiler issue.
ACE/tests/run_test.lst Registered the new test (Compiler_Features_42_Test) in the test execution list.
ACE/tests/tests.mpc Added build project entry for Compiler_Features_42_Test including its source file and set C++20 for VS2019/2022.
TAO/tao/AnyTypeCode/TypeCode_Case_T.h Fixed a comment formatting issue in the Case_T class documentation.

Poem

In the garden of code, a new test takes root,
To chase down a bug in a compiler suit.
With unions and arrays, the rabbits did hop,
Adding entries and comments, they just couldn’t stop!
May all your builds be green, and your carrots sweet—
Another hop forward, a CodeRabbit feat! 🥕


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3652ab2 and 07a7562.

📒 Files selected for processing (1)
  • ACE/tests/tests.mpc (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • ACE/tests/tests.mpc
⏰ Context from checks skipped due to timeout of 90000ms (10)
  • GitHub Check: VS2022Debug64
  • GitHub Check: VS2022WChar
  • GitHub Check: VS2022Release64
  • GitHub Check: VS2019Release64
  • GitHub Check: VS2019WChar
  • GitHub Check: MINGW64-gcc
  • GitHub Check: ubuntu-24.04 g++
  • GitHub Check: macos-14-C++
  • GitHub Check: macos-13-C++
  • GitHub Check: alpine-3.18

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
ACE/tests/Compiler_Features_42_Test.cpp (1)

24-24: Consider using INT32_MIN for better readability.

The current initialization (-2147483647 - 1) is verbose. Using INT32_MIN from <climits> would be clearer.

-    int32_t disc_{ (-2147483647 - 1) };
+    int32_t disc_{ INT32_MIN };

Add #include <climits> if not already included transitively.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 36cf075 and d4be76e.

📒 Files selected for processing (4)
  • ACE/tests/Compiler_Features_42_Test.cpp (1 hunks)
  • ACE/tests/run_test.lst (1 hunks)
  • ACE/tests/tests.mpc (1 hunks)
  • TAO/tao/AnyTypeCode/TypeCode_Case_T.h (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (21)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: alpine-3.18
  • GitHub Check: MINGW64-gcc
  • GitHub Check: windows-2019 vs2019
  • GitHub Check: ubuntu-22.04 g++-12
  • GitHub Check: ubuntu-24.04 g++
  • GitHub Check: ubuntu-24.04 g++-12
  • GitHub Check: ubuntu-24.04 g++-10 CORBA/e micro
  • GitHub Check: ubuntu-22.04 g++-9
  • GitHub Check: ubuntu-24.04 g++-10 CodeQL
  • GitHub Check: ubuntu-24.04 clang++-16
  • GitHub Check: ubuntu-24.04 g++-13
  • GitHub Check: macos-14-C++
  • GitHub Check: ubuntu-24.04 g++-14
  • GitHub Check: ubuntu-22.04 clang++-12
  • GitHub Check: ubuntu-24.04 g++-10 CORBA/e compact
  • GitHub Check: ubuntu-24.04 g++-11
  • GitHub Check: ubuntu-22.04 g++-10
  • GitHub Check: ubuntu-24.04 clang++-15
  • GitHub Check: ubuntu-22.04 clang++-13
  • GitHub Check: macos-13-C++
🔇 Additional comments (6)
TAO/tao/AnyTypeCode/TypeCode_Case_T.h (1)

39-39: LGTM! Comment formatting improvement.

The line merge improves readability of the comment without affecting functionality.

ACE/tests/run_test.lst (1)

115-115: LGTM! Test properly registered in execution list.

The new test is correctly positioned in the sequence and follows the established naming convention.

ACE/tests/tests.mpc (1)

866-871: LGTM! Build configuration follows established pattern.

The project definition is consistent with other compiler feature tests and includes all necessary components.

ACE/tests/Compiler_Features_42_Test.cpp (3)

25-31: Union with non-trivial types requires careful management.

The union contains both std::array<std::string, 5> and int32_t. Since std::string has non-trivial constructors/destructors, proper union management typically requires:

  1. A discriminator to track the active member
  2. Proper construction/destruction of the active member
  3. Manual lifetime management

The current implementation with empty destructors (lines 35-40) may not properly destruct the arrayofstring member, potentially causing resource leaks.

However, since this test is designed to reproduce a specific VS2022 compiler issue, this pattern might be intentional. Please verify that this union structure correctly reproduces the intended compiler behavior.


35-40: Empty destructors may cause resource leaks.

The union and class destructors are empty, which means:

  • If the union's as_ member (array of strings) is active when destroyed, the strings won't be properly destructed
  • This could lead to resource leaks in production code

Since this is a compiler issue reproduction test, this might be intentional to trigger the specific VS2022 issue being tested.

Please confirm this destructor behavior is required to reproduce the compiler issue. If not, consider proper union member destruction based on the discriminator value.


46-47: Test successfully demonstrates basic object lifecycle.

The test correctly allocates and deallocates an instance of the problematic class, which should be sufficient to reproduce the compiler issue if it exists.

    * ACE/tests/Compiler_Features_42_Test.cpp:
@jwillemsen jwillemsen changed the title Add new compiler test Add new compiler test to reproduce issue Jun 4, 2025
@jwillemsen
Copy link
Copy Markdown
Member Author

Enabling C++20 used as workaround, issue has been reported to Microsoft. Visual Studio 2019 also gives an internal compiler error on the example code

@jwillemsen jwillemsen merged commit 1eaca90 into DOCGroup:master Jun 6, 2025
36 of 37 checks passed
@jwillemsen jwillemsen deleted the jwi-vs2022bug branch June 6, 2025 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant