Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 14911 invoked from network); 27 Aug 2007 18:15:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Aug 2007 18:15:54 -0000 Received: (qmail 54618 invoked by uid 500); 27 Aug 2007 18:15:49 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 54597 invoked by uid 500); 27 Aug 2007 18:15:49 -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 54573 invoked by uid 99); 27 Aug 2007 18:15:49 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Aug 2007 11:15:49 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Aug 2007 18:16:44 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 8DACF71418F for ; Mon, 27 Aug 2007 11:15:30 -0700 (PDT) Message-ID: <26493688.1188238530577.JavaMail.jira@brutus> Date: Mon, 27 Aug 2007 11:15:30 -0700 (PDT) From: "Farid Zaripov (JIRA)" To: stdcxx-dev@incubator.apache.org Subject: [jira] Assigned: (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 [ https://issues.apache.org/jira/browse/STDCXX-248?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Farid Zaripov reassigned STDCXX-248: ------------------------------------ Assignee: Farid Zaripov > [Intel C++ 9.1/Windows] bad codegen initializing const POD struct > ----------------------------------------------------------------- > > Key: STDCXX-248 > URL: https://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 > Assignee: 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. - You can reply to this email to add a comment to the issue online.