From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9742 invoked by alias); 19 Nov 2002 10:56:06 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 9682 invoked by uid 71); 19 Nov 2002 10:56:04 -0000 Resent-Date: 19 Nov 2002 10:56:04 -0000 Resent-Message-ID: <20021119105604.9681.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, duchier@ps.uni-sb.de Received: (qmail 24407 invoked by uid 61); 19 Nov 2002 10:51:36 -0000 Message-Id: <20021119105136.24389.qmail@sources.redhat.com> Date: Mon, 25 Nov 2002 11:54:00 -0000 From: duchier@ps.uni-sb.de Reply-To: duchier@ps.uni-sb.de To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: optimization/8634: incorrect inlining of memcpy under -O2 X-SW-Source: 2002-11/txt/msg00943.txt.bz2 List-Id: >Number: 8634 >Category: optimization >Synopsis: incorrect inlining of memcpy under -O2 >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Tue Nov 19 02:56:03 PST 2002 >Closed-Date: >Last-Modified: >Originator: Denys Duchier >Release: GCC 3.2 >Organization: >Environment: Gentoo Linux 1.4 Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2/specs Configured with: /var/tmp/portage/gcc-3.2-r2/work/gcc-3.2/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --target=i686-pc-linux-gnu --with-system-zlib --enable-languages=c,c++,ada,f77,objc,java --enable-threads=posix --enable-long-long --disable-checking --enable-cstdio=stdio --enable-clocale=generic --enable-__cxa_atexit --enable-version-specific-runtime-libs --with-gxx-include-dir=/usr/include/g++-v32 --with-local-prefix=/usr/local --enable-shared --enable-nls --without-included-gettext Thread model: posix gcc version 3.2 >Description: memcpy of a small const array is incorrectly compiled inline under -O2 or -O3 optimization, but not -O >How-To-Repeat: compile and run the attachment and observe the output: the program performs the memcpy and then prints one line for each element of the arrays, first the source then the destination. under -O2 optimization, the 2nd 3rd and 4th bytes of the dest array are garbbled. >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/x-c++src; name="bug.cc" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="bug.cc" I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nLmg+CnVzaW5nIG5hbWVzcGFjZSBz dGQ7CmludCBtYWluKCkKewogIGNoYXIqIGJ1ZmZlciA9IG5ldyBjaGFyWzhdOwogIGNvbnN0IGNo YXIgaGVhZFtdID0gewogICAgJ0EnLCAnQicsICdDJywgJ0QnLAogICAgJ0UnLCAnRicsICdHJywg J0gnCiAgfTsKICBhc20oImZvbzoiKTsKICBtZW1jcHkoYnVmZmVyLGhlYWQsc2l6ZW9mKGhlYWQp KTsKICBhc20oImJhejoiKTsKICBmb3IoaW50IGk9MDtpPDg7aSsrKQogICAgY291dCA8PCAiWyIg PDwgaSA8PCAiXSA9ICIgPDwgaGVhZFtpXSA8PCAiICwgIiA8PCBidWZmZXJbaV0gPDwgZW5kbDsK ICByZXR1cm4gMDsKfQo=