From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7236 invoked by alias); 18 Apr 2002 19:16:03 -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 7194 invoked by uid 71); 18 Apr 2002 19:16:02 -0000 Resent-Date: 18 Apr 2002 19:16:01 -0000 Resent-Message-ID: <20020418191601.7193.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org, jason@redhat.com Resent-Reply-To: gcc-gnats@gcc.gnu.org, jessica_han@hp.com Received:(qmail 5735 invoked by uid 61); 18 Apr 2002 19:10:08 -0000 Message-Id:<20020418191008.5734.qmail@sources.redhat.com> Date: Thu, 18 Apr 2002 12:16:00 -0000 From: jessica_han@hp.com Reply-To: jessica_han@hp.com To: gcc-gnats@gcc.gnu.org Cc: jason@redhat.com X-Send-Pr-Version:gnatsweb-2.9.3 (1.1.1.1.2.31) X-GNATS-Notify:jason@redhat.com Subject: c++/6365: Uninitialized static pointer-to-member is not NULL(-1) X-SW-Source: 2002-04/txt/msg00945.txt.bz2 List-Id: >Number: 6365 >Category: c++ >Synopsis: Uninitialized static pointer-to-member is not NULL(-1) >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Thu Apr 18 12:16:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: jessica_han@hp.com >Release: gcc version 3.1 20020415 (prerelease) >Organization: >Environment: IA64 Linux & HP-UX >Description: Uninitialized static pointer-to-member is set to NULL by default. IA64 C++ ABI specifies that a NULL pointer-to-member should be -1. >How-To-Repeat: #g++ test4.C #./a.out #echo $? 1 (should be 0) >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/plain; name="test4.C" Content-Disposition: inline; filename="test4.C" #include // The subject. struct A { int i; }; int A::* gp; int A::* ga[2]; // Test use in a simple struct. struct B { int A::* mp; }; B gb; // Test that in a class with a constructor, the pointer to member is // zero-initialized until the constructor is run. struct C { C (): mp (&A::i) {} int A::* mp; }; extern C gc; int fail; struct D { D () { if (gc.mp != 0) fail = 4; } }; // The D must come first for this to work. D gd; C gc; int main() { static int A::* slp; static int A::* sla[2]; static B slb; if (gp != 0 || slp != 0) return 1; if (ga[1] != 0 || sla[1] != 0) return 2; if (gb.mp != 0 || slb.mp != 0) return 3; return fail; }