public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/6365: Uninitialized static pointer-to-member is not NULL(-1)
@ 2002-07-11  8:03 lerdsuwa
  0 siblings, 0 replies; 2+ messages in thread
From: lerdsuwa @ 2002-07-11  8:03 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, jason, jessica_han, nobody

Synopsis: Uninitialized static pointer-to-member is not NULL(-1)

State-Changed-From-To: open->closed
State-Changed-By: lerdsuwa
State-Changed-When: Thu Jul 11 08:03:42 2002
State-Changed-Why:
    Fixed in 3.1 branch and main trunk.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6365


^ permalink raw reply	[flat|nested] 2+ messages in thread

* c++/6365: Uninitialized static pointer-to-member is not NULL(-1)
@ 2002-04-18 12:16 jessica_han
  0 siblings, 0 replies; 2+ messages in thread
From: jessica_han @ 2002-04-18 12:16 UTC (permalink / raw)
  To: gcc-gnats; +Cc: jason


>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;
}


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-07-11 15:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-11  8:03 c++/6365: Uninitialized static pointer-to-member is not NULL(-1) lerdsuwa
  -- strict thread matches above, loose matches on Subject: below --
2002-04-18 12:16 jessica_han

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).