From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19890 invoked by alias); 30 Jan 2011 21:28:27 -0000 Received: (qmail 19881 invoked by uid 22791); 30 Jan 2011 21:28:26 -0000 X-SWARE-Spam-Status: No, hits=-0.9 required=5.0 tests=AWL,BAYES_40,LOTS_OF_MONEY,TW_CP,TW_OV,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from vm-emlprdomr-06.its.yale.edu (HELO vm-emlprdomr-06.its.yale.edu) (130.132.50.147) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 30 Jan 2011 21:28:20 +0000 Received: from [192.168.1.100] (cpe-69-200-237-227.nyc.res.rr.com [69.200.237.227]) (authenticated bits=0) by vm-emlprdomr-06.its.yale.edu (8.14.4/8.14.4) with ESMTP id p0ULSHtU007874 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Sun, 30 Jan 2011 16:28:18 -0500 Subject: Re: GCC Internals: built-in functions? Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=windows-1252 From: Amittai Aviram In-Reply-To: Date: Mon, 31 Jan 2011 04:53:00 -0000 Cc: gcc-help@gcc.gnu.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <189DEF72-E802-4454-81A2-08D7C1D1BF24@yale.edu> To: Jonathan Wakely X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2011-01/txt/msg00475.txt.bz2 On Jan 30, 2011, at 4:07 PM, Jonathan Wakely wrote: > On 30 January 2011 21:02, Amittai Aviram wrote: >>=20 >> I tried it with strncpy and with __builtin_strncpy, with exactly the sam= e results, i.e., the assembly code still calls strncpy with three arguments. >=20 > Did you enable optimization? I hadn't and that did it--even with just "-O1." Thank you! Very interesti= ng!=97 movl $1280066888, (%rsp) movw $79, 4(%rsp) The first integer in hex is 4C 4C 45 48 ( =3D=3D 'L','L','E','H') and the second (79) is 4F ( =3D=3D 'O') So, of course, it works out when assigned in little-endian order. The sec= ond assignment also puts NULL in the right place as the higher-order bits o= f the integer 79. Amittai Aviram PhD Student in Computer Science Yale University 646 483 2639 amittai.aviram@yale.edu http://www.amittai.com