public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug d/96153] d: struct literals have non-deterministic hash values Date: Tue, 04 Aug 2020 15:05:10 +0000 [thread overview] Message-ID: <bug-96153-4-WjAMASbpFt@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-96153-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96153 --- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Iain Buclaw <ibuclaw@gcc.gnu.org>: https://gcc.gnu.org/g:2ac51bdf63b0e17d1b9974f30303fb24e3cbc83d commit r11-2548-g2ac51bdf63b0e17d1b9974f30303fb24e3cbc83d Author: Iain Buclaw <ibuclaw@gdcproject.org> Date: Wed Jul 22 09:50:38 2020 +0200 d: Fix struct literals that have non-deterministic hash values (PR96153) Adds code generation for generating a temporary for, and pre-filling struct and array literals with zeroes before assigning, so that alignment holes don't cause objects to produce a non-deterministic hash value. A new field has been added to the expression visitor to track whether the result is being generated for another literal, so that memset() is only called once on the top-level literal expression, and not for nesting struct or arrays. gcc/d/ChangeLog: PR d/96153 * d-tree.h (build_expr): Add literalp argument. * expr.cc (ExprVisitor): Add literalp_ field. (ExprVisitor::ExprVisitor): Initialize literalp_. (ExprVisitor::visit (AssignExp *)): Call memset() on blits where RHS is a struct literal. Elide assignment if initializer is all zeroes. (ExprVisitor::visit (CastExp *)): Forward literalp_ to generation of subexpression. (ExprVisitor::visit (AddrExp *)): Likewise. (ExprVisitor::visit (ArrayLiteralExp *)): Use memset() to pre-fill object with zeroes. Set literalp in subexpressions. (ExprVisitor::visit (StructLiteralExp *)): Likewise. (ExprVisitor::visit (TupleExp *)): Set literalp in subexpressions. (ExprVisitor::visit (VectorExp *)): Likewise. (ExprVisitor::visit (VectorArrayExp *)): Likewise. (build_expr): Forward literal_p to ExprVisitor. gcc/testsuite/ChangeLog: PR d/96153 * gdc.dg/pr96153.d: New test.
next prev parent reply other threads:[~2020-08-04 15:05 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-07-10 14:40 [Bug d/96153] New: " ibuclaw at gdcproject dot org 2020-08-04 15:05 ` cvs-commit at gcc dot gnu.org [this message] 2020-08-05 8:46 ` [Bug d/96153] " ro at gcc dot gnu.org 2020-08-05 11:42 ` ibuclaw at gdcproject dot org 2020-08-05 16:30 ` ibuclaw at gdcproject dot org 2020-08-06 12:49 ` ibuclaw at gdcproject dot org 2020-08-23 7:05 ` ibuclaw at gdcproject dot org 2020-08-24 19:49 ` ibuclaw at gdcproject dot org 2020-08-26 8:04 ` cvs-commit at gcc dot gnu.org 2020-08-26 8:05 ` ibuclaw at gdcproject dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-96153-4-WjAMASbpFt@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).