[flang-commits] [flang] [llvm] [Flang][Fir] Set default alignment of array globals to 64 bytes (PR #194969)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Thu Apr 30 08:02:42 PDT 2026
================
@@ -223,6 +223,9 @@ static fir::GlobalOp declareGlobal(Fortran::lower::AbstractConverter &converter,
fir::GlobalOp global = builder.createGlobal(
loc, converter.genType(var), globalName, linkage, mlir::Attribute{},
isConstant(ultimate), var.isTarget(), dataAttr);
+ // BIND(C) globals follow C ABI alignment; remove default alignment.
+ if (sym.attrs().test(Fortran::semantics::Attr::BIND_C))
+ global.removeAlignmentAttr();
----------------
tblah wrote:
Maybe instead fix createGlobal() to not add the alignment attribute in this case? That way you don't need to update in so many places and it is easier for new users not to have to know to add this check.
https://github.com/llvm/llvm-project/pull/194969
More information about the flang-commits
mailing list