Bug 36012 - Wrong initialization in operator new.
Summary: Wrong initialization in operator new.
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2008-04-22 15:33 UTC by s.nakayama
Modified: 2008-04-24 19:39 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 2.95.3 3.3.6 4.3.0
Last reconfirmed: 2008-04-22 22:10:07


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description s.nakayama 2008-04-22 15:33:19 UTC
testcase
#include <assert.h>
struct foo
{ 
  virtual void bar(){ }
  int foo::*baz;
};

int main()
{
  foo* x = new foo();
  assert (x->baz == foo().baz);
}

result
$ g++43 bug.cpp -o bag; ./bug
assertion "x->baz == foo().baz" failed: file "bug.cpp", line 11
Comment 1 Richard Biener 2008-04-22 22:10:07 UTC
 if (x->baz != (TARGET_EXPR <D.1717, D.1717 = {._vptr.foo=0B, .baz=-1};, <<< Unknown tree: aggr_init_expr
  4
  __comp_ctor
  D.1717
  0B >>>
;>).baz)

I believe there's a dup for this ...
Comment 2 David Fang 2008-04-22 22:38:22 UTC
PR 32245?
Comment 3 s.nakayama 2008-04-24 19:39:44 UTC
Sorry, my code is undefined.
By 12.1/7, member of foo is not initialized. I