Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 19322 invoked from network); 5 Aug 2006 01:49:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Aug 2006 01:49:52 -0000 Received: (qmail 38553 invoked by uid 500); 5 Aug 2006 01:49:52 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 38539 invoked by uid 500); 5 Aug 2006 01:49:52 -0000 Mailing-List: contact stdcxx-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-dev@incubator.apache.org Received: (qmail 38528 invoked by uid 99); 5 Aug 2006 01:49:52 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Aug 2006 18:49:52 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Aug 2006 18:49:51 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id C077A7142A7 for ; Sat, 5 Aug 2006 01:47:14 +0000 (GMT) Message-ID: <10397874.1154742434764.JavaMail.jira@brutus> Date: Fri, 4 Aug 2006 18:47:14 -0700 (PDT) From: "Martin Sebor (JIRA)" To: stdcxx-dev@incubator.apache.org Subject: [jira] Updated: (STDCXX-248) [Intel C++ 9.1/Windows] bad codegen initializing const POD struct In-Reply-To: <11518740.1151653471262.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/STDCXX-248?page=all ] Martin Sebor updated STDCXX-248: -------------------------------- Summary: [Intel C++ 9.1/Windows] bad codegen initializing const POD struct (was: [Intel C++ 9.1/Windows] codegeneration bug) > [Intel C++ 9.1/Windows] bad codegen initializing const POD struct > ----------------------------------------------------------------- > > Key: STDCXX-248 > URL: http://issues.apache.org/jira/browse/STDCXX-248 > Project: C++ Standard Library > Issue Type: Bug > Components: External > Affects Versions: 4.1.3 > Environment: Intel C++ 9.1, Windows > Reporter: Farid Zaripov > Priority: Minor > > The program below is expected to run without assert. When compiled with Intel C++ 9.1 on Windows, it's terminated with runtime error instead. Note that MSVC++ 7.1 behaves as expected. > ====================================================================== > #include > struct UserChar > { > long double f; > unsigned char c; > }; > struct UserInt > { > int i_; > UserChar to_char () const > { > const UserChar tmp = { 0, i_ }; > return tmp; > } > UserChar to_char2 () const > { > UserChar tmp = { 0, i_ }; > return tmp; > } > UserChar to_char3 () const > { > UserChar tmp = { 0 }; > tmp.c = i_; > return tmp; > } > }; > int main(int argc, char* argv[]) > { > const char TEST_CHAR = 'a'; > UserInt ui = { TEST_CHAR }; > UserChar uc = ui.to_char (); > UserChar uc2 = ui.to_char2 (); > UserChar uc3 = ui.to_char3 (); > assert (TEST_CHAR == uc.c && TEST_CHAR == uc2.c && TEST_CHAR == uc3.c); > return 0; > } > ====================================================================== > icl icl91_test.cpp > Intel(R) C++ Compiler for 32-bit applications, Version 9.1 Build 20060323Z > Copyright (C) 1985-2006 Intel Corporation. All rights reserved. > icl91_test.cpp > Microsoft (R) Incremental Linker Version 7.10.3077 > Copyright (C) Microsoft Corporation. All rights reserved. > -out:icl91_test.exe > icl91_test.obj > ====================================================================== > icl91_test.exe > Assertion failed: TEST_CHAR == uc.c && TEST_CHAR == uc2.c && TEST_CHAR == uc3.c, > file icl91_test.cpp, line 43 > This application has requested the Runtime to terminate it in an unusual way. > Please contact the application's support team for more information. > ====================================================================== > Generated assembler code: > UserChar to_char () const > 00439A44 push ebp > 00439A45 mov ebp,esp > 00439A47 push esi > 00439A48 mov dword ptr [ebp-4],ecx > const UserChar tmp = { 0, i_ }; > 00439A4B fldz > 00439A4D mov eax,dword ptr [ebp+8] > 00439A50 fstp qword ptr [eax] > return tmp; > 00439A52 mov eax,dword ptr [ebp+8] > 00439A55 leave > 00439A56 ret 4 > tmp.c is not initialized by value this->i_ and as a result it contains a random value. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira