From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christopher Li Subject: Re: [PATCH] Fix offsets in anonymous unions Date: Sun, 1 Jun 2014 00:55:44 -0700 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from mail-qg0-f41.google.com ([209.85.192.41]:44916 "EHLO mail-qg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750998AbaFAHzp (ORCPT ); Sun, 1 Jun 2014 03:55:45 -0400 Received: by mail-qg0-f41.google.com with SMTP id j5so8968536qga.28 for ; Sun, 01 Jun 2014 00:55:44 -0700 (PDT) In-Reply-To: Sender: linux-sparse-owner@vger.kernel.org List-Id: linux-sparse@vger.kernel.org To: John Keeping Cc: Linux-Sparse On Thu, May 22, 2014 at 6:22 AM, John Keeping wrote: > Commit 38d1124 (Fix error at anoymous unions, 2014-04-03) says: > @@ -2328,6 +2326,7 @@ static struct expression *check_designators(struct expression *e, > break; > } > e->field = e->ctype = ctype; > + e->init_offset = offset; > last = e; > if (!e->ident_expression) { OK, this is actually wrong. The member "init_offset" is only valid for EXPR_POS type. The current e->type is EXPR_IDENTIFIER, the e->init_offset member actually share the same memory location as e->expr_ident. In order words, writing to init_offset will corrupt the e->expr_ident. We did not use e->expr_ident afterwards though. Chris