[Bug c++/77375] [5/6/7 Regression] constant object with mutable subobject allocated in read-only memory

2016-09-16 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77375

--- Comment #7 from Jakub Jelinek  ---
Author: jakub
Date: Fri Sep 16 20:21:29 2016
New Revision: 240195

URL: https://gcc.gnu.org/viewcvs?rev=240195=gcc=rev
Log:
PR c++/77375
* class.c (check_bases): Set CLASSTYPE_HAS_MUTABLE if any
TYPE_HAS_MUTABLE_P
for any bases.

* g++.dg/cpp0x/mutable1.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/cpp0x/mutable1.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/class.c
trunk/gcc/testsuite/ChangeLog

[Bug c++/77375] [5/6/7 Regression] constant object with mutable subobject allocated in read-only memory

2016-08-29 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77375

--- Comment #6 from Jakub Jelinek  ---
Created attachment 39505
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39505=edit
gcc7-pr77375.patch

Untested fix.

[Bug c++/77375] [5/6/7 Regression] constant object with mutable subobject allocated in read-only memory

2016-08-29 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77375

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jason at gcc dot gnu.org
   Target Milestone|--- |5.5

--- Comment #5 from Jakub Jelinek  ---
I guess the question is if CLASSTYPE_HAS_MUTABLE should be set on types derived
from CLASSTYPE_HAS_MUTABLE types (then cp_apply_type_quals_to_decl's
  /* If the type has (or might have) a mutable component, that component
 might be modified.  */
  if (TYPE_HAS_MUTABLE_P (type) || !COMPLETE_TYPE_P (type))
type_quals &= ~TYPE_QUAL_CONST;
would do its job), or if instead in this spot (and maybe various others) should
walk the bases and check for TYPE_HAS_MUTABLE_P.

[Bug c++/77375] [5/6/7 Regression] constant object with mutable subobject allocated in read-only memory

2016-08-29 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77375

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek  ---
Started I think with either r175639 or r175640.

[Bug c++/77375] [5/6/7 Regression] constant object with mutable subobject allocated in read-only memory

2016-08-26 Thread ppalka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77375

Patrick Palka  changed:

   What|Removed |Added

 Status|ASSIGNED|NEW
   Assignee|ppalka at gcc dot gnu.org  |unassigned at gcc dot 
gnu.org

--- Comment #3 from Patrick Palka  ---
... never mind.

[Bug c++/77375] [5/6/7 Regression] constant object with mutable subobject allocated in read-only memory

2016-08-26 Thread ppalka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77375

Patrick Palka  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 CC||ppalka at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |ppalka at gcc dot 
gnu.org

--- Comment #2 from Patrick Palka  ---
I have a patch.

[Bug c++/77375] [5/6/7 Regression] constant object with mutable subobject allocated in read-only memory

2016-08-25 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77375

Jonathan Wakely  changed:

   What|Removed |Added

  Known to work||4.6.4
Summary|constant object with|[5/6/7 Regression] constant
   |mutable subobject allocated |object with mutable
   |in read-only memory |subobject allocated in
   ||read-only memory

--- Comment #1 from Jonathan Wakely  ---
This started with 4.7.0