This is an archive of the discontinued LLVM Phabricator instance.

[flang][test] Make tests warning-correct for integer division-by-zero
AbandonedPublic

Authored by ekieri on Jun 8 2022, 12:46 PM.

Details

Summary

Add WARNING-directives for integer division-by-zero in semantics tests.
Note that the warning is triggered by all subexpressions, i.e.,

1 + 1 / 0

triggers it twice.

This is a preparation for D125804, which makes test_errors.py test
warnings the same way it already tests errors, i.e., assert that the
emitted and expected diagnostics are identical.

Diff Detail

Event Timeline

ekieri created this revision.Jun 8 2022, 12:46 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 8 2022, 12:46 PM
ekieri requested review of this revision.Jun 8 2022, 12:46 PM

I post these in a separate patch for the extra visibility, as I would like some input. What do you make of this? resolve37.f90, with the four consecutive WARNING-directives, looks a bit silly, and the repetition is not particularly helpful. But the logic behind each of them is clear (the subexpression in question is marked for each warning). I expect that limiting to one warning per expression would complicate the logic. Would that be worth it, or even desired? Note that integer division-by-zero in a constant expression also triggers an error.

ekieri edited the summary of this revision. (Show Details)Aug 16 2022, 12:51 PM

Sorry for the late feedback.

But the logic behind each of them is clear (the subexpression in question is marked for each warning). I expect that limiting to one warning per expression would complicate the logic. Would that be worth it, or even desired?

As far as I am concerned, I think the warning duplication is noise, and I think it would be worth trying to limit them.

Sorry for the late feedback.

But the logic behind each of them is clear (the subexpression in question is marked for each warning). I expect that limiting to one warning per expression would complicate the logic. Would that be worth it, or even desired?

As far as I am concerned, I think the warning duplication is noise, and I think it would be worth trying to limit them.

Thanks for your input, I'll make an attempt!

ekieri abandoned this revision.Apr 24 2023, 10:40 AM

Fixed in D136479.