This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/77375] New: constant object with mutable subobject allocated in read-only memory
- From: "Casey at Carter dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 24 Aug 2016 22:43:09 +0000
- Subject: [Bug c++/77375] New: constant object with mutable subobject allocated in read-only memory
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77375
Bug ID: 77375
Summary: constant object with mutable subobject allocated in
read-only memory
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: Casey at Carter dot net
Target Milestone: ---
When run, this program results in a segmentation fault:
struct Base {
mutable int i;
};
struct Derived : Base {};
const Derived foo{};
int main() { foo.i = 42; }
Despite its mutable subobject, the compiler allocates foo in read-only memory.