public inbox for gentoo-amd64@lists.gentoo.org
 help / color / mirror / Atom feed
From: Nikos Chantziaras <realnc@arcor.de>
To: gentoo-amd64@lists.gentoo.org
Subject: [gentoo-amd64] Re: GCC-4.5.2 Has Serious Problems
Date: Fri, 01 Jul 2011 02:44:36 +0300	[thread overview]
Message-ID: <iuj1o7$o6s$2@dough.gmane.org> (raw)
In-Reply-To: <iuj17v$o6s$1@dough.gmane.org>

On 07/01/2011 02:35 AM, Nikos Chantziaras wrote:
> On 07/01/2011 12:45 AM, Frank Peters wrote:
>> Hello,
>>
>> After banging my head for a while over some strange results, I began
>> to suspect GCC-4.5.2, the latest version in portage, was creating
>> faulty code.
>>
>> It seems to a correct suspicion.
>> [...]
>> int n;
>> double x;
>> unsigned long int arg;
>> unsigned long int *px = (unsigned long int*)&x;
>
> Your code is buggy, because you're breaking C's aliasing rules. You are
> not allowed to use a different pointer type to dereference a variable of
> a different type. Doing so results in undefined behavior.

And here you can read more thorough information about strict aliasing:

   http://labs.qt.nokia.com/2011/06/10/type-punning-and-strict-aliasing




  reply	other threads:[~2011-06-30 23:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-30 21:45 [gentoo-amd64] GCC-4.5.2 Has Serious Problems Frank Peters
2011-06-30 22:30 ` Alex Schuster
2011-06-30 23:34   ` Frank Peters
2011-06-30 23:35 ` [gentoo-amd64] " Nikos Chantziaras
2011-06-30 23:44   ` Nikos Chantziaras [this message]
2011-07-01  0:04     ` Frank Peters
2011-07-01  0:11       ` Nikos Chantziaras
2011-07-01  0:58         ` Duncan
2011-07-01  1:23           ` Frank Peters
2011-07-01  1:52             ` Duncan
2011-07-01  2:15             ` Ian McCulloch
2011-07-01  4:36             ` Mark Knecht
2011-07-01  5:22               ` Frank Peters
2011-07-01  0:25     ` Frank Peters
2011-07-01  1:04     ` Frank Peters
2011-07-01  2:18       ` Duncan
2011-07-01  2:22       ` Barry Schwartz
2011-07-01  2:43         ` Frank Peters
2011-07-01 11:53       ` Nikos Chantziaras
2011-07-01 16:53         ` Frank Peters
  -- strict thread matches above, loose matches on Subject: below --
2011-07-01  2:30 Ian McCulloch

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='iuj1o7$o6s$2@dough.gmane.org' \
    --to=realnc@arcor.de \
    --cc=gentoo-amd64@lists.gentoo.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