public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kevin at koconnor dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/66110] uint8_t memory access not optimized
Date: Mon, 18 May 2015 15:41:00 -0000	[thread overview]
Message-ID: <bug-66110-4-7gFVseBGBu@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-66110-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66110

--- Comment #10 from Kevin OConnor <kevin at koconnor dot net> ---
I've looked through the C specs (both C99 and C11) and I don't see anything
that requires uint8_t (nor int8_t) to be considered "character types".  I do
see three relevant sections in the spec which I'm including below.

For aliasing there is section 6.5:

  7 An object shall have its stored value accessed only by an lvalue expression
that has one of the following types:
  [...]
      -- a character type.

For "character types" there is section 6.2.5:

  15 The three types char, signed char, and unsigned char are collectively
called the character types. [...]

For uint8_t there is section 7.20.1.1:

     7.20.1.1 Exact-width integer types

  1 The typedef name intN_t designates a signed integer type with width N , no
padding bits, and a two's complement representation. Thus, int8_t denotes such
a signed integer type with a width of exactly 8 bits.

  2 The typedef name uintN_t designates an unsigned integer type with width N
and no padding bits. Thus, uint24_t denotes such an unsigned integer type with
a width of exactly 24 bits.

So, my read is that uint8_t must be considered an integer type, but is not
required to be considered a "character type".

That said, I understand that changing uint8_t may cause problems for some
existing user-code.  I'd think those enabling -fstrict-aliasing would want the
optimization benefit though.

I certainly understand if the cost of introducing another integer type and the
potential cost of causing issues for existing code is considered too high.  It
is unfortunate, though, that there doesn't appear to currently be any way to
declare a pointer to a non-aliasing 8-bit integer (that doesn't involve
'struct' hacks).


  parent reply	other threads:[~2015-05-18 15:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-11 17:02 [Bug tree-optimization/66110] New: " kevin at koconnor dot net
2015-05-11 17:59 ` [Bug tree-optimization/66110] " pinskia at gcc dot gnu.org
2015-05-11 18:10 ` kevin at koconnor dot net
2015-05-12  9:17 ` [Bug middle-end/66110] " rguenth at gcc dot gnu.org
2015-05-12 13:19 ` rguenth at gcc dot gnu.org
2015-05-13 10:54 ` rguenth at gcc dot gnu.org
2015-05-13 10:54 ` rguenth at gcc dot gnu.org
2015-05-13 15:43 ` kevin at koconnor dot net
2015-05-18 15:41 ` kevin at koconnor dot net [this message]
2015-05-18 15:52 ` schwab@linux-m68k.org
2015-05-18 16:05 ` kevin at koconnor dot net
2015-05-18 20:43 ` joseph at codesourcery dot com
2015-05-18 22:28 ` kevin at koconnor dot net
2015-05-19  8:50 ` rguenther at suse dot de

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-66110-4-7gFVseBGBu@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: 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).