[flang-commits] [flang] [flang] Fix incorrect offset for zero-size COMMON block members. (PR #214174)
Kelvin Li via flang-commits
flang-commits at lists.llvm.org
Thu Aug 6 07:23:46 PDT 2026
================
@@ -0,0 +1,39 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+! Test that a zero-size CHARACTER in a COMMON block does not trigger a false
+! "cannot backward-extend COMMON block" error when it is referenced in an
+! EQUIVALENCE association.
+!
+! Block /blk/ layout:
+! offset 0 : i8 (integer(8), 8 bytes)
+! offset 8 : zc0 (character(0), 0 bytes)
+!
+! equivalence(c8(5:8), zc0) places c8(1) at offset 4 (= 8 - 4 bytes before zc0).
+! Before the fix (compute-offsets.cpp), zc0 had offset 0, so dep.offset (4)
----------------
kkwli wrote:
Nit: In my opinion, line 11-14 is not necessary to describe the behavior.
https://github.com/llvm/llvm-project/pull/214174
More information about the flang-commits
mailing list