================ @@ -5696,6 +5696,10 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D, const ASTContext::SectionInfo &SI = Context.SectionInfos[SA->getName()]; if ((SI.SectionFlags & ASTContext::PSF_Write) == 0) GV->setConstant(true); ---------------- tahonermann wrote:
This looks to be where the `constant` specifier is coming from in the test case; absence of `PSF_Write` implies constant. Here is a suggestion, but there might be a better way to reorganize how these flags are checked; I haven't given it much thought. ```suggestion if ((SI.SectionFlags & ASTContext::PSF_Write) == 0 && SI.SectionFlags & ASTContext::PSF_Shared) == 0) GV->setConstant(true); ``` https://github.com/llvm/llvm-project/pull/128197 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits