Return-Path: X-Original-To: apmail-stdcxx-dev-archive@www.apache.org Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E6D06D803 for ; Wed, 5 Sep 2012 01:25:54 +0000 (UTC) Received: (qmail 47793 invoked by uid 500); 5 Sep 2012 01:25:54 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 47756 invoked by uid 500); 5 Sep 2012 01:25:54 -0000 Mailing-List: contact dev-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list dev@stdcxx.apache.org Received: (qmail 47748 invoked by uid 99); 5 Sep 2012 01:25:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Sep 2012 01:25:54 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of msebor@gmail.com designates 209.85.160.54 as permitted sender) Received: from [209.85.160.54] (HELO mail-pb0-f54.google.com) (209.85.160.54) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Sep 2012 01:25:46 +0000 Received: by pbbrp2 with SMTP id rp2so74546pbb.41 for ; Tue, 04 Sep 2012 18:25:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=VvnjE9LbofPg6p6xRZd682diXKuTLLoYVy7k51dbkws=; b=eRL5Xwb5yej5PVEpw0hOIW6EUtW/26stWm/jbwu/q+/uYrH4N5Tck7FNboGp+ui6pj a/ARzScUk9LkBRtEqF9zDjVcQiJRq0VJt0rfh2Fj+BdaL3JHHaH3bbbVpRbUhZTm0Y+B VvEboWq7idYBVq71OG1jKmkYNRRITpvntXw9taygFNb6D5CCxmzScdhDzLSlfTPrNQAL 0hmLxwA6c79IEf7xKHM9sE9sNjAFJHELCxM8Z4CLOlisFZvpIAujkAz0x3W1KwkRA+Tk vZ0rxvBXRwFlCq1WhrJgGpvCw4ZEkeNnmObqpGHapvtOfNFlgAus4/o+AgBqyD8ns4wg 0eXQ== Received: by 10.68.190.8 with SMTP id gm8mr50827486pbc.74.1346808326463; Tue, 04 Sep 2012 18:25:26 -0700 (PDT) Received: from localhost.localdomain (72-163-0-129.cisco.com. [72.163.0.129]) by mx.google.com with ESMTPS id vd4sm223021pbc.41.2012.09.04.18.25.25 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 04 Sep 2012 18:25:25 -0700 (PDT) Message-ID: <5046AA04.7070508@gmail.com> Date: Tue, 04 Sep 2012 19:25:24 -0600 From: Martin Sebor User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 To: dev@stdcxx.apache.org CC: Liviu Nicoara Subject: Re: Intel C++ bug reports? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On 09/04/2012 07:02 PM, Liviu Nicoara wrote: > Hi guys, > > Does any of you know how to go about submitting an Intel compiler bug without a premier support account? > > While configuring the library on my x86_64 machine, I ran into what appears to be a code generation compiler bug which affects LIMITS.cpp test -- the test cycles ad infinitum because of the incorrect test marked below: I don't know if there's a way to submit it outside Premier but I have an account and can submit bugs for us. Looking at the test below, though, it depends on undefined behavior (signed overflow) so there's no compiler bug. Making max volatile fools icc just enough to produce the expected output (while still relying on undefined behavior). It would be good to clean it up, though. I think computing UINT_MAX instead and shifting it right by the number of sign bits (i.e., 1) should work. Martin > > $ uname -a; icpc -v; cat t.cpp; icpc t.cpp&& ./a.out > Linux behemoth 2.6.37.6 #3 SMP Sat Apr 9 22:49:32 CDT 2011 x86_64 AMD Opteron(tm) Processor 6134 AuthenticAMD GNU/Linux > icpc version 12.1.5 (gcc version 4.5.2 compatibility) > #include > > volatile int zero = 0; > volatile int one = zero + 1; > volatile int two = one + 1; > > template< typename T> > T test () > { > T max = T (one); > > // Find largest in which multiplied by two results in a > // negative value > > for (; T (max * two)> max; max *= two) ; > > > // > // Perform a binary search variant for the maximum > // > > T tmp = max / (two + two); > > for (; tmp;) { > if (T (max + tmp)< max) { //<- fail > if (tmp> T (two)) > tmp /= two; > else if (max< T (max + one)) > tmp = one; > else > break; > } > else > max += tmp; > } > > return max; > } > > int main () > { > printf ("INT_MAX : %x\n", test< int> ()); > return 0; > } > ^C > $ > > which runs just fine with gcc: > > $ g++ t.cpp&& ./a.out > INT_MAX : 7fffffff > > Thanks! > > Liviu