public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/32245]  New: wrong POD type initialization
@ 2007-06-07 13:37 s__nakayama at infoseek dot jp
  2007-06-08 10:37 ` [Bug c++/32245] [4.1/4.2/4.3 Regression] wrong POD type initialization with pointer to member rguenth at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: s__nakayama at infoseek dot jp @ 2007-06-07 13:37 UTC (permalink / raw)
  To: gcc-bugs

testcase:
#include <cassert>

struct foo
{
  int mem1;
  int foo::* mem2;
};

int main()
{
  foo x = {0};
  assert(x.mem2 == foo().mem2);
  return 0;
}

result:
$ g++42 bug.cpp -o bug; ./bug
assertion "x.mem2 == foo().mem2" failed: file "bug.cpp", line 12
Aborted (core dumped)


-- 
           Summary: wrong POD type initialization
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: s__nakayama at infoseek dot jp


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32245


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

* [Bug c++/32245] [4.1/4.2/4.3 Regression] wrong POD type initialization with pointer to member
  2007-06-07 13:37 [Bug c++/32245] New: wrong POD type initialization s__nakayama at infoseek dot jp
@ 2007-06-08 10:37 ` rguenth at gcc dot gnu dot org
  2007-06-30  9:15 ` pinskia at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-06-08 10:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2007-06-08 10:36 -------
Confirmed.

{
  struct foo x = {.mem1=0, .mem2=-1};

  <<cleanup_point   struct foo x = {.mem1=0, .mem2=-1};>>;
  <<cleanup_point <<< Unknown tree: expr_stmt
  bar (x.mem2 == (TARGET_EXPR <D.2011, {}>).mem2) >>>
>>;
  return <retval> = 0;
}

2.95 used zero for .mem2 initialization.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-code
      Known to fail|                            |3.3.6 4.1.2 4.2.0
      Known to work|                            |2.95.4
   Last reconfirmed|0000-00-00 00:00:00         |2007-06-08 10:36:51
               date|                            |
            Summary|wrong POD type              |[4.1/4.2/4.3 Regression]
                   |initialization with pointer |wrong POD type
                   |to member                   |initialization with pointer
                   |                            |to member


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32245


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

* [Bug c++/32245] [4.1/4.2/4.3 Regression] wrong POD type initialization with pointer to member
  2007-06-07 13:37 [Bug c++/32245] New: wrong POD type initialization s__nakayama at infoseek dot jp
  2007-06-08 10:37 ` [Bug c++/32245] [4.1/4.2/4.3 Regression] wrong POD type initialization with pointer to member rguenth at gcc dot gnu dot org
@ 2007-06-30  9:15 ` pinskia at gcc dot gnu dot org
  2007-07-04  3:24 ` mmitchel at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-06-30  9:15 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
   Target Milestone|---                         |4.1.3


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32245


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

* [Bug c++/32245] [4.1/4.2/4.3 Regression] wrong POD type initialization with pointer to member
  2007-06-07 13:37 [Bug c++/32245] New: wrong POD type initialization s__nakayama at infoseek dot jp
  2007-06-08 10:37 ` [Bug c++/32245] [4.1/4.2/4.3 Regression] wrong POD type initialization with pointer to member rguenth at gcc dot gnu dot org
  2007-06-30  9:15 ` pinskia at gcc dot gnu dot org
@ 2007-07-04  3:24 ` mmitchel at gcc dot gnu dot org
  2007-07-04 19:02 ` mmitchel at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-07-04  3:24 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32245


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

* [Bug c++/32245] [4.1/4.2/4.3 Regression] wrong POD type initialization with pointer to member
  2007-06-07 13:37 [Bug c++/32245] New: wrong POD type initialization s__nakayama at infoseek dot jp
                   ` (2 preceding siblings ...)
  2007-07-04  3:24 ` mmitchel at gcc dot gnu dot org
@ 2007-07-04 19:02 ` mmitchel at gcc dot gnu dot org
  2007-07-06  1:24 ` mmitchel at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-07-04 19:02 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32245


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

* [Bug c++/32245] [4.1/4.2/4.3 Regression] wrong POD type initialization with pointer to member
  2007-06-07 13:37 [Bug c++/32245] New: wrong POD type initialization s__nakayama at infoseek dot jp
                   ` (3 preceding siblings ...)
  2007-07-04 19:02 ` mmitchel at gcc dot gnu dot org
@ 2007-07-06  1:24 ` mmitchel at gcc dot gnu dot org
  2007-07-06  1:37 ` [Bug c++/32245] [4.1/4.2 " mmitchel at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-07-06  1:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from mmitchel at gcc dot gnu dot org  2007-07-06 01:24 -------
Subject: Bug 32245

Author: mmitchel
Date: Fri Jul  6 01:23:54 2007
New Revision: 126399

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126399
Log:
        PR c++/32245
        * init.c (build_zero_init): Always build an initializer for
        non-static storage.
        * typeck2.c (build_functional_cast): Use build_zero_init.

        PR c++/32251
        * init.c (build_new_1): Always pass the allocation function to
        build_op_delete_call.
        * call.c (build_op_delete_call): Handle operator delete with a
        variable-argument list.  Do not issue an error when no matching
        deallocation function is available for a new operator.

        PR c++/31992
        * cp-tree.h (any_value_dependent_elements_p): Declare it.
        * decl.c (value_dependent_init_p): New function.
        (cp_finish_decl): Use it.
        * pt.c (value_dependent_expression_p): Use
        any_value_dependent_elements_p.
        * parser.c (cp_parser_primary_expression): Add comment about
        treating dependent qualified names as integral
        constant-expressions.

        PR c++/32245
        * g++.dg/init/ptrmem4.C: New test.

        PR c++/32251
        * g++.dg/init/new21.C: Likewise.

        PR c++/31992
        * g++.dg/template/static30.C: Likewise.

Added:
    trunk/gcc/testsuite/g++.dg/init/new21.C
    trunk/gcc/testsuite/g++.dg/init/ptrmem4.C
    trunk/gcc/testsuite/g++.dg/template/static30.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/init.c
    trunk/gcc/cp/parser.c
    trunk/gcc/cp/pt.c
    trunk/gcc/cp/typeck2.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32245


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

* [Bug c++/32245] [4.1/4.2 Regression] wrong POD type initialization with pointer to member
  2007-06-07 13:37 [Bug c++/32245] New: wrong POD type initialization s__nakayama at infoseek dot jp
                   ` (4 preceding siblings ...)
  2007-07-06  1:24 ` mmitchel at gcc dot gnu dot org
@ 2007-07-06  1:37 ` mmitchel at gcc dot gnu dot org
  2007-07-07  2:03 ` mmitchel at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-07-06  1:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from mmitchel at gcc dot gnu dot org  2007-07-06 01:36 -------
Fixed in 4.3.0.


-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.1/4.2/4.3 Regression]    |[4.1/4.2 Regression] wrong
                   |wrong POD type              |POD type initialization with
                   |initialization with pointer |pointer to member
                   |to member                   |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32245


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

* [Bug c++/32245] [4.1/4.2 Regression] wrong POD type initialization with pointer to member
  2007-06-07 13:37 [Bug c++/32245] New: wrong POD type initialization s__nakayama at infoseek dot jp
                   ` (5 preceding siblings ...)
  2007-07-06  1:37 ` [Bug c++/32245] [4.1/4.2 " mmitchel at gcc dot gnu dot org
@ 2007-07-07  2:03 ` mmitchel at gcc dot gnu dot org
  2007-07-07  2:05 ` [Bug c++/32245] [4.1 " mmitchel at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-07-07  2:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from mmitchel at gcc dot gnu dot org  2007-07-07 02:02 -------
Subject: Bug 32245

Author: mmitchel
Date: Sat Jul  7 02:02:37 2007
New Revision: 126433

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126433
Log:
        PR c++/32245
        * init.c (build_zero_init): Always build an initializer for
        non-static storage.
        * typeck2.c (build_functional_cast): Use build_zero_init.

        PR c++/32251
        * init.c (build_new_1): Always pass the allocation function to
        build_op_delete_call.
        * call.c (build_op_delete_call): Handle operator delete with a
        variable-argument list.  Do not issue an error when no matching
        deallocation function is available for a new operator.

        PR c++/31992
        * cp-tree.h (any_value_dependent_elements_p): Declare it.
        * decl.c (value_dependent_init_p): New function.
        (cp_finish_decl): Use it.
        * pt.c (value_dependent_expression_p): Use
        any_value_dependent_elements_p.
        * parser.c (cp_parser_primary_expression): Add comment about
        treating dependent qualified names as integral
        constant-expressions.

        PR c++/32245
        * g++.dg/init/ptrmem4.C: New test.

        PR c++/32251
        * g++.dg/init/new21.C: Likewise.

        PR c++/31992
        * g++.dg/template/static30.C: Likewise.

Added:
    branches/gcc-4_2-branch/gcc/testsuite/g++.dg/init/new21.C
    branches/gcc-4_2-branch/gcc/testsuite/g++.dg/init/ptrmem4.C
    branches/gcc-4_2-branch/gcc/testsuite/g++.dg/template/static30.C
Modified:
    branches/gcc-4_2-branch/gcc/cp/ChangeLog
    branches/gcc-4_2-branch/gcc/cp/call.c
    branches/gcc-4_2-branch/gcc/cp/cp-tree.h
    branches/gcc-4_2-branch/gcc/cp/decl.c
    branches/gcc-4_2-branch/gcc/cp/init.c
    branches/gcc-4_2-branch/gcc/cp/parser.c
    branches/gcc-4_2-branch/gcc/cp/pt.c
    branches/gcc-4_2-branch/gcc/cp/typeck2.c
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32245


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

* [Bug c++/32245] [4.1 Regression] wrong POD type initialization with pointer to member
  2007-06-07 13:37 [Bug c++/32245] New: wrong POD type initialization s__nakayama at infoseek dot jp
                   ` (6 preceding siblings ...)
  2007-07-07  2:03 ` mmitchel at gcc dot gnu dot org
@ 2007-07-07  2:05 ` mmitchel at gcc dot gnu dot org
  2007-11-30 10:43 ` aaw at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-07-07  2:05 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|mark at codesourcery dot com|unassigned at gcc dot gnu
                   |                            |dot org
             Status|ASSIGNED                    |NEW
            Summary|[4.1/4.2 Regression] wrong  |[4.1 Regression] wrong POD
                   |POD type initialization with|type initialization with
                   |pointer to member           |pointer to member


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32245


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

* [Bug c++/32245] [4.1 Regression] wrong POD type initialization with pointer to member
  2007-06-07 13:37 [Bug c++/32245] New: wrong POD type initialization s__nakayama at infoseek dot jp
                   ` (7 preceding siblings ...)
  2007-07-07  2:05 ` [Bug c++/32245] [4.1 " mmitchel at gcc dot gnu dot org
@ 2007-11-30 10:43 ` aaw at gcc dot gnu dot org
  2007-11-30 10:49 ` rguenth at gcc dot gnu dot org
  2008-07-04 16:08 ` jsm28 at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: aaw at gcc dot gnu dot org @ 2007-11-30 10:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from aaw at gcc dot gnu dot org  2007-11-30 10:43 -------
Should this bug be marked as resolved, then?


-- 

aaw at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aaw at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32245


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

* [Bug c++/32245] [4.1 Regression] wrong POD type initialization with pointer to member
  2007-06-07 13:37 [Bug c++/32245] New: wrong POD type initialization s__nakayama at infoseek dot jp
                   ` (8 preceding siblings ...)
  2007-11-30 10:43 ` aaw at gcc dot gnu dot org
@ 2007-11-30 10:49 ` rguenth at gcc dot gnu dot org
  2008-07-04 16:08 ` jsm28 at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-11-30 10:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2007-11-30 10:49 -------
It's still broken in 4.1, so we want to keep it open (generally we don't close
wrong-code bugs as fixed only in later releases - unless the branch is closed).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32245


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

* [Bug c++/32245] [4.1 Regression] wrong POD type initialization with pointer to member
  2007-06-07 13:37 [Bug c++/32245] New: wrong POD type initialization s__nakayama at infoseek dot jp
                   ` (9 preceding siblings ...)
  2007-11-30 10:49 ` rguenth at gcc dot gnu dot org
@ 2008-07-04 16:08 ` jsm28 at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-07-04 16:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jsm28 at gcc dot gnu dot org  2008-07-04 16:08 -------
Closing 4.1 branch.


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to fail|3.3.6 4.1.2                 |3.3.6 4.1.2 4.1.3
         Resolution|                            |FIXED
   Target Milestone|4.1.3                       |4.2.1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32245


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

end of thread, other threads:[~2008-07-04 16:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-07 13:37 [Bug c++/32245] New: wrong POD type initialization s__nakayama at infoseek dot jp
2007-06-08 10:37 ` [Bug c++/32245] [4.1/4.2/4.3 Regression] wrong POD type initialization with pointer to member rguenth at gcc dot gnu dot org
2007-06-30  9:15 ` pinskia at gcc dot gnu dot org
2007-07-04  3:24 ` mmitchel at gcc dot gnu dot org
2007-07-04 19:02 ` mmitchel at gcc dot gnu dot org
2007-07-06  1:24 ` mmitchel at gcc dot gnu dot org
2007-07-06  1:37 ` [Bug c++/32245] [4.1/4.2 " mmitchel at gcc dot gnu dot org
2007-07-07  2:03 ` mmitchel at gcc dot gnu dot org
2007-07-07  2:05 ` [Bug c++/32245] [4.1 " mmitchel at gcc dot gnu dot org
2007-11-30 10:43 ` aaw at gcc dot gnu dot org
2007-11-30 10:49 ` rguenth at gcc dot gnu dot org
2008-07-04 16:08 ` jsm28 at gcc dot gnu dot org

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