public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Joseph S. Myers" <jsm@polyomino.org.uk>
To: Robert Dewar <dewar@gnat.com>
Cc: Richard Kenner <kenner@vlsi1.ultra.nyu.edu>, gcc@gcc.gnu.org
Subject: Re: SRA problem with uninitialzed fields
Date: Sat, 25 Sep 2004 02:59:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.61.0409242208500.11089@digraph.polyomino.org.uk> (raw)
In-Reply-To: <41549A41.2010906@gnat.com>

On Fri, 24 Sep 2004, Robert Dewar wrote:

> I am completely puzzled as to what reduced-width types have to do
> with this example at the C++ semantic level, or are you just making
> a comment about the internal implementation and why it happens to
> work for C++ and not for C (as far as I can see these programs have
> identical semantics in C and C++)

The internal representation in the front ends most cleanly follows the 
rules of the respective standards.  This then leads to different 
representations in GIMPLE, although the semantics in this case are the 
same for C and C++.  It would no doubt be desirable for the tree 
optimizers to be able to do the same optimizations in both cases, perhaps 
translating one representation into the other (both being valid GIMPLE).

The cases which have different semantics are such as

struct s { unsigned long a:40, b:40; } x;

unsigned long f() { return x.a + x.b; }

where in C, but not C++, the result of the addition is masked to 40 bits 
(presuming 32-bit int, 64-bit long for this example).

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
  http://www.srcf.ucam.org/~jsm28/gcc/#c90status - status of C90 for GCC 4.0
    jsm@polyomino.org.uk (personal mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)

  reply	other threads:[~2004-09-24 22:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-24 18:53 Richard Kenner
2004-09-24 19:02 ` Joseph S. Myers
2004-09-25  2:38   ` Robert Dewar
2004-09-25  2:59     ` Joseph S. Myers [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-09-24 18:43 Richard Kenner
2004-09-24 18:50 ` Joseph S. Myers
2004-09-24 16:55 Richard Kenner
2004-09-24 18:23 ` Joseph S. Myers
2004-09-24 16:01 Richard Kenner
2004-09-24 16:16 ` Andrew Pinski

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=Pine.LNX.4.61.0409242208500.11089@digraph.polyomino.org.uk \
    --to=jsm@polyomino.org.uk \
    --cc=dewar@gnat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=kenner@vlsi1.ultra.nyu.edu \
    /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).