[PATCH] D156726: Make globals with mutable members non-constant, even in custom sections
Reid Kleckner via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 31 12:52:49 PDT 2023
rnk added inline comments.
================
Comment at: clang/lib/Sema/SemaDecl.cpp:14254
int SectionFlags = ASTContext::PSF_Read;
- if (var->getType().isConstQualified()) {
- if (HasConstInit)
----------------
I think this is not compatible with MSVC. MSVC uses simple logic, it doesn't look for mutable: https://gcc.godbolt.org/z/sj6d4saxx
The const mutable struct appears in the myrdata section in that example.
I think the solution is to separate the flag logic from the pragma stack selection logic, which has to remain MSVC-compatible.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156726/new/
https://reviews.llvm.org/D156726
More information about the cfe-commits
mailing list