Skip to content

[flang] Add executable tests for conditional expressions (F2023) - #1

Open
cenewcombe wants to merge 2 commits into
mainfrom
test_cond_expr
Open

[flang] Add executable tests for conditional expressions (F2023)#1
cenewcombe wants to merge 2 commits into
mainfrom
test_cond_expr

Conversation

@cenewcombe

Copy link
Copy Markdown
Owner

I ported over the tests we had in tst90 for conditional expressions. The CMakeLists.txt file excludes tests with conditional arguments for now. This can be altered once the feature is implemented with support for .NIL.

Let me know if this follows the correct format for porting from tst90.

I'll keep this PR in my fork until the conditional expressions feature work is ready to go upstream.

@cenewcombe
cenewcombe requested review from tmjbios and vntkmr March 5, 2026 20:42
@tmjbios

tmjbios commented Mar 6, 2026

Copy link
Copy Markdown
Collaborator

Do you have a test that checks for an errant evaluation of a non-used consequent?

@cenewcombe

Copy link
Copy Markdown
Owner Author

Do you have a test that checks for an errant evaluation of a non-used consequent?

Yep, we have

condexpr_scalar_call_01.f90 - tests functions only called for the selected branch
condexpr_scalar_call_02.f90 - errant evaluation causes div by 0

condexpr_nil_05.f90 checks selective evaluation for conditional arguments, and is currently disabled pending implementation of that feature.

@cenewcombe

Copy link
Copy Markdown
Owner Author

I've updated two of the conditional arguments tests to remove parentheses for chained conditional-arg:

condexpr_nil_02.f90
condexpr_nil_03.f90

This matches my understanding of the discussion regarding conditional arguments, but please let me know if I've misunderstood. These tests are not currently enabled, but I want to port them as we'd expect to run them.

I've left the conditional expressions tests as-is since extra parentheses should be OK in that case.
cc: @vntkmr @tmjbios

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.

2 participants