From: Bernd Edlinger <bernd.edlinger@hotmail.de>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
Nathan Sidwell <nathan@acm.org>, Jason Merrill <jason@redhat.com>,
Joseph Myers <joseph@codesourcery.com>,
Marek Polacek <polacek@redhat.com>
Subject: [PING] [PATCH] Add a -Wcast-align=strict warning
Date: Mon, 11 Sep 2017 13:53:00 -0000 [thread overview]
Message-ID: <AM5PR0701MB26571F17A4B40FA9337ABA40E4680@AM5PR0701MB2657.eurprd07.prod.outlook.com> (raw)
In-Reply-To: <AM5PR0701MB26571284440889EF6AFF47B8E4910@AM5PR0701MB2657.eurprd07.prod.outlook.com>
Ping...
On 09/04/17 10:07, Bernd Edlinger wrote:
> Hi,
>
> as you know we have a -Wcast-align warning which works only for
> STRICT_ALIGNMENT targets. But occasionally it would be nice to be
> able to switch this warning on even for other targets.
>
> Therefore I would like to add a strict version of this option
> which can be invoked with -Wcast-align=strict. With the only
> difference that it does not depend on STRICT_ALIGNMENT.
>
> I used the code from check_effective_target_non_strict_align
> in target-supports.exp for the first version of the test case,
> where we have this:
>
> return [check_no_compiler_messages non_strict_align assembly {
> char *y;
> typedef char __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) c;
> c *z;
> void foo(void) { z = (c *) y; }
> } "-Wcast-align"]
>
> ... and to my big surprise it did _not_ work for C++ as-is,
> because same_type_p considers differently aligned types identical,
> and therefore cp_build_c_cast tries the conversion first via a
> const_cast which succeeds, but did not emit the cast-align warning
> in this case.
>
> As a work-around I had to check the alignment in build_const_cast_1
> as well.
>
>
> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
> Is it OK for trunk?
>
>
> Thanks
> Bernd.
>
next prev parent reply other threads:[~2017-09-11 13:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-04 8:07 Bernd Edlinger
2017-09-11 13:53 ` Bernd Edlinger [this message]
2017-09-13 17:06 ` Joseph Myers
2017-09-13 19:52 ` Bernd Edlinger
2017-09-13 20:03 ` Joseph Myers
2017-09-13 20:55 ` Bernd Edlinger
2017-09-13 20:57 ` Joseph Myers
2017-09-14 16:33 ` [PATCHv2] " Bernd Edlinger
2017-09-15 15:51 ` Joseph Myers
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=AM5PR0701MB26571F17A4B40FA9337ABA40E4680@AM5PR0701MB2657.eurprd07.prod.outlook.com \
--to=bernd.edlinger@hotmail.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
--cc=joseph@codesourcery.com \
--cc=nathan@acm.org \
--cc=polacek@redhat.com \
/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).