public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: jessica_han@hp.com To: gcc-gnats@gcc.gnu.org Cc: jason@redhat.com Subject: c++/6365: Uninitialized static pointer-to-member is not NULL(-1) Date: Thu, 18 Apr 2002 12:16:00 -0000 [thread overview] Message-ID: <20020418191008.5734.qmail@sources.redhat.com> (raw) >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 <stdio.h> // 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; }
next reply other threads:[~2002-04-18 19:16 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-04-18 12:16 jessica_han [this message] 2002-07-11 8:03 lerdsuwa
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20020418191008.5734.qmail@sources.redhat.com \ --to=jessica_han@hp.com \ --cc=gcc-gnats@gcc.gnu.org \ --cc=jason@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).