Return-Path: Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: (qmail 36122 invoked from network); 20 Mar 2008 18:02:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Mar 2008 18:02:16 -0000 Received: (qmail 39480 invoked by uid 500); 20 Mar 2008 18:02:14 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 39469 invoked by uid 500); 20 Mar 2008 18:02:14 -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 39460 invoked by uid 99); 20 Mar 2008 18:02:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Mar 2008 11:02:14 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of msebor@gmail.com designates 64.233.170.190 as permitted sender) Received: from [64.233.170.190] (HELO rn-out-0910.google.com) (64.233.170.190) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Mar 2008 18:01:35 +0000 Received: by rn-out-0910.google.com with SMTP id s28so937329rnb.13 for ; Thu, 20 Mar 2008 11:01:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:organization:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; bh=XP4VK1J5+Hw4C7eBE0JX0Ut9IXyUnx1u2hM0ojf9sow=; b=bs9r897s2Vfu1Q7fY8uYD39Aa+KTNTF9WfL9rbHQTbdaj//x3faJPI98+bcF4TNTn+lVHVTfdiv0IZrkuqCfS5ufsXl0a98KlmQG0Qve0nyvMaVinDqdzkzW/ubXe9stTK4YvLP7Jsxe/pUUOpJcSFM5xDL71AIIFvfpLPRJTZE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=message-id:date:from:organization:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=fgGv4oT+BkivGPFMWvq4Mo4Dj6wtNlfjyCfLzW1d64iNmtja5+GGHgjBJXMGH8Fv0IsOT9fWmQUKxxca063nNfwhaH+dZOmdMmfxfu+gw0d/7oP1no5laezvTD9PqgkStq3TTtyV7r7slkO6xvSoHLcSYhP+QxVSilhW/A31DNs= Received: by 10.143.16.9 with SMTP id t9mr1570495wfi.164.1206036103981; Thu, 20 Mar 2008 11:01:43 -0700 (PDT) Received: from localhost.localdomain ( [71.229.200.170]) by mx.google.com with ESMTPS id 22sm4086088wfd.4.2008.03.20.11.01.42 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 20 Mar 2008 11:01:42 -0700 (PDT) Message-ID: <47E2A684.3000708@roguewave.com> Date: Thu, 20 Mar 2008 12:01:40 -0600 From: Martin Sebor Organization: Rogue Wave Software, Inc. User-Agent: Thunderbird 2.0.0.12 (X11/20080226) MIME-Version: 1.0 To: dev@stdcxx.apache.org Subject: Re: [TESTCASE] STDCXX-750 [HP aCC 6.16] Potential null pointer dereference in aliases.cpp References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: Martin Sebor X-Virus-Checked: Checked by ClamAV on apache.org I was going to say this is the same bug as STDCXX-764: http://issues.apache.org/jira/browse/STDCXX-764 but after looking at it more closely I believe the compiler is correct in this case because malloc() returns 0 when it fails to allocate memory. The warning could be clearer about it. Martin Scott Zhong wrote: > cat /build/scottz/t2.cpp && aCC -V && aCC -c +w /build/scottz/t2.cpp > #include > > int main() > { > static char * test = 0; > if (!test) { > test = (char *)std::malloc (12345); > *test = '\0'; > } > > return 0; > } > aCC: HP C/aC++ B3910B A.06.16 [Nov 26 2007] > "/build/scottz/t2.cpp", line 8, procedure main: warning #20200-D: > Potential > null pointer dereference through test is detected (null > definition:/build/scottz/t2.cpp, line 7) > > this test case shows that the warning is bogus because the pointer > "test" is pointing to a valid location in memory after std::malloc is > performed. >