From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26049 invoked by alias); 3 Apr 2003 17:26:00 -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 26034 invoked by uid 71); 3 Apr 2003 17:26:00 -0000 Date: Thu, 03 Apr 2003 17:26:00 -0000 Message-ID: <20030403172600.26033.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Nigel Stewart Subject: Re: c++/1833: [2003-01-01] inlining sometimes causes incorrect behavior Reply-To: Nigel Stewart X-SW-Source: 2003-04/txt/msg00107.txt.bz2 List-Id: The following reply was made to PR c++/1833; it has been noted by GNATS. From: Nigel Stewart To: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org, peteb@sitera.com Cc: Subject: Re: c++/1833: [2003-01-01] inlining sometimes causes incorrect behavior Date: Fri, 04 Apr 2003 03:24:48 +1000 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=1833 Perhaps the bug/problem/issue I've found in gcc is related to this one already in the database: Problem Report 1833 ------- #include using namespace std; float foo() { assert(sizeof(unsigned int)==sizeof(float)); float tmp = 0.0; *((unsigned int *) &tmp) = (127<<23) | (1<<22); return tmp; } int main(int argc,char *argv[]) { cout << "Output should be 1.5: " << foo() << endl; } ------- $ gcc -v Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.2/specs Configured with: /netrel/src/gcc-3.2-3/configure --enable-languages=c,c++,f77,java --enable-libgcj --enable-threads=posix --with-system-zlib --enable-nls --without-included-gettext --enable-interpreter --disable-sjlj-exceptions --disable-version-specific-runtime-libs --enable-shared --build=i686-pc-linux --host=i686-pc-cygwin --target=i686-pc-cygwin --enable-haifa --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --includedir=/nonexistent/include --libexecdir=/usr/sbin Thread model: posix gcc version 3.2 20020927 (prerelease) $ g++ test.cpp -o test && ./test Output should be 1.5: 1.5 $ g++ -O2 test.cpp -o test && ./test Output should be 1.5: 0 -------- The following version of foo does not exhibit the same problem: float foo() { assert(sizeof(unsigned int)==sizeof(float)); unsigned int tmp = (127<<23) | (1<<22); return *((float *) &tmp); } Regards, Nigel Stewart nigels@nigels.com