public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Harald van Dijk" <truedfx@gentoo.org>
To: gcc-help@gcc.gnu.org
Subject: Re: -fstrict-aliasing, -Wstrict-aliasing=2, and indirect conversions
Date: Wed, 27 Jul 2005 21:17:00 -0000	[thread overview]
Message-ID: <42E7FB56.6010205@gentoo.org> (raw)
In-Reply-To: <m3br4pc6un.fsf@gossamer.airs.com>

Ian Lance Taylor wrote:
> There should be a warning here.  The warning code is confused by the
> double cast.  If you cast directly to short *, you should get the
> warning.
> 
> I'm going to test this patch to fix this problem.  Anybody see
> anything wrong with it?

Hi,

Thank you for your quick reply. Your patch has been very helpful. It 
doesn't seem to catch these similar cases, though:

int main() {
     int a = 1;

     void *p1 = (void *) &a;
     * (short *) p1 = 2;

     char *p2 = (char *) &a;
     * (short *) p2 = 3;

     return a;
}

This still returns 1 without a warning. (I am now using 4.1.0-20050723, 
so that I could try your patch.)

  reply	other threads:[~2005-07-27 21:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-26 23:52 Harald van Dijk
2005-07-27  2:37 ` Ian Lance Taylor
2005-07-27 21:17   ` Harald van Dijk [this message]
2005-07-27 22:23     ` Ian Lance Taylor
2005-07-27 23:53       ` Harald van Dijk

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=42E7FB56.6010205@gentoo.org \
    --to=truedfx@gentoo.org \
    --cc=gcc-help@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: link
Be 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).