This is an archive of the discontinued LLVM Phabricator instance.

[flang][test] Fix semantics tests with respect to warnings
ClosedPublic

Authored by ekieri on Aug 16 2022, 12:13 PM.

Details

Summary

Make tests expect the (correctly) emitted warnings using the WARNING
directive. This directive is non-functional now, but will be recognised
by test_errors.py when D125804 is landed. This patch is a preparation
for D125804.

For most tests, we add missing WARNING directives for emitted warnings,
but there are exceptions:

  • for int-literals.f90 and resolve31.f90 we pass -pedantic to the frontend driver, so that the expected warnings are actually emitted.
  • for block-data01.f90 and resolve42.f90 we change the tests so that warnings, which appear unintentional, are not emitted. While testing the warning in question (padding added for alignment in common block) would be desired, that is beyond the scope of this patch. This warning is target-dependent.

Diff Detail

Event Timeline

ekieri created this revision.Aug 16 2022, 12:13 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
ekieri requested review of this revision.Aug 16 2022, 12:13 PM
PeteSteinfeld accepted this revision.Aug 16 2022, 2:04 PM

I had a question about the change to flang/test/Semantics/block-data01.f90. Otherwise, all builds and tests correctly and looks good.

flang/test/Semantics/block-data01.f90
14

This change looks unnecessary. Did you mean to make it?

This revision is now accepted and ready to land.Aug 16 2022, 2:04 PM
ekieri added inline comments.Aug 17 2022, 8:46 AM
flang/test/Semantics/block-data01.f90
14

Yes, this is deliberate. It relates to the final part of the patch summary. On x86_64, pointers require 8-byte alignment, and default reals are 4 bytes. With the real before the pointer, 4 bytes of padding has to be added in the common block to respect the alignment requirements, and this triggers a warning. I here change the order of the variables so that the warning, which appear unintentional, is not emitted.

This revision was automatically updated to reflect the committed changes.