From: Amittai Aviram <amittai.aviram@yale.edu>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: GCC Internals: built-in functions?
Date: Mon, 31 Jan 2011 04:53:00 -0000 [thread overview]
Message-ID: <D9ECD18C-E07F-4F71-A9B8-CB50A129635A@yale.edu> (raw)
In-Reply-To: <AANLkTi=SW=1jH8sk_1zLVbNGPHo4CoNRS27D3+WkCNjj@mail.gmail.com>
On Jan 30, 2011, at 4:07 PM, Jonathan Wakely wrote:
> On 30 January 2011 21:02, Amittai Aviram wrote:
>>
>> I tried it with strncpy and with __builtin_strncpy, with exactly the same results, i.e., the assembly code still calls strncpy with three arguments.
>
> Did you enable optimization?
I hadn't and that did it--even with just "-O1." Thank you! Very interesting!—
movl $1280066888, (%rsp)
movw $79, 4(%rsp)
The first integer in hex is 4C 4C 45 48 ( == 'L','L','E','H')
and the second (79) is 4F ( == 'O')
So, of course, it works out when assigned in little-endian order. The second assignment also puts NULL in the right place as the higher-order bits of the integer 79.
Amittai Aviram
PhD Student in Computer Science
Yale University
646 483 2639
amittai.aviram@yale.edu
http://www.amittai.com
prev parent reply other threads:[~2011-01-30 21:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-30 20:50 Amittai Aviram
2011-01-30 21:01 ` Jonathan Wakely
2011-01-30 21:07 ` Amittai Aviram
2011-01-30 21:28 ` Jonathan Wakely
2011-01-31 4:53 ` Amittai Aviram [this message]
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=D9ECD18C-E07F-4F71-A9B8-CB50A129635A@yale.edu \
--to=amittai.aviram@yale.edu \
--cc=gcc-help@gcc.gnu.org \
--cc=jwakely.gcc@gmail.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).