This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Set TREE_READONLY const POD arrays with size determinedfrom initialize (PR c++/21454) ?


> Jakub Jelinek <jakub@redhat.com> writes:
>
> This is a fallout of the PR c++/20073 fix.
> For arrays like:
> const int a[] = { 0, 1, 2, 3 };
> when cp_apply_type_quals_to_decl is called, its type is not complete yet,
> so C++ frontend does not set TREE_READONLY flag.  But such variables
> aren't put into incomplete_vars chain either, so nothing sets the flag
> afterwards.
> Ok for 4.0/HEAD if it passes regtesting?

What's the difference between TREE_READONLY and MEM_READONLY_P ?

(To the best of my knowledge "const int a[]" is allocated and initialized
 at run-time in RAM with the READONLY ROM literal value "{1,2,3,4}"; so a[]
 is not READONLY, although it's literal initializer is; as opposed to
 "static const a[] = {0,1,2,3}" where they are considered equivalent.)


 
 



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]