Bug 20342 – GDC - assignment to anonymous union member corrupts data

Status
RESOLVED
Resolution
MOVED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-10-31T01:16:02Z
Last change time
2019-10-31T20:08:17Z
Assigned to
No Owner
Creator
Suleyman Sahmi (سليمان السهمي)

Comments

Comment #0 by sahmi.soulaimane — 2019-10-31T01:16:02Z
``` union U { struct { size_t a; size_t b; union { size_t c; size_t d; } } } void main() { U u; assert(u.a == 0); // ok u.d = 1; assert(u.a == 0); // error } ```
Comment #1 by greeenify — 2019-10-31T05:24:10Z
GDC issues should be reported at the GCC issue tracker: https://gcc.gnu.org/bugzilla/
Comment #2 by sahmi.soulaimane — 2019-10-31T13:35:27Z
(In reply to Seb from comment #1) > GDC issues should be reported at the GCC issue tracker: > https://gcc.gnu.org/bugzilla/ Thanks.
Comment #3 by sahmi.soulaimane — 2019-10-31T19:03:52Z