public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/5635: no initialization for array new with initializer
@ 2002-10-31  9:20 bangerth
  0 siblings, 0 replies; 3+ messages in thread
From: bangerth @ 2002-10-31  9:20 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, hueffner, nobody

Synopsis: no initialization for array new with initializer

State-Changed-From-To: analyzed->closed
State-Changed-By: bangerth
State-Changed-When: Thu Oct 31 09:20:22 2002
State-Changed-Why:
    Duplicate of 2123

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


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

* Re: c++/5635: no initialization for array new with initializer
@ 2002-09-14 15:49 nathan
  0 siblings, 0 replies; 3+ messages in thread
From: nathan @ 2002-09-14 15:49 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, hueffner, nobody

Synopsis: no initialization for array new with initializer

State-Changed-From-To: open->analyzed
State-Changed-By: nathan
State-Changed-When: Sat Sep 14 15:49:55 2002
State-Changed-Why:
    -pedantic gives an error.
    this is a g++ extension which appears broken

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


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

* c++/5635: no initialization for array new with initializer
@ 2002-02-08  6:26 Falk Hueffner
  0 siblings, 0 replies; 3+ messages in thread
From: Falk Hueffner @ 2002-02-08  6:26 UTC (permalink / raw)
  To: gcc-gnats


>Number:         5635
>Category:       c++
>Synopsis:       no initialization for array new with initializer
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 08 06:26:03 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        3.0
>Organization:
>Environment:
System: SunOS ogeima 5.8 Generic_108528-12 sun4u sparc SUNW,Sun-Blade-100
Architecture: sun4

	
host: sparc-sun-solaris2.8
build: sparc-sun-solaris2.8
target: sparc-sun-solaris2.8
configured with: ../gcc-3.0/configure --prefix=/afs/informatik.uni-tuebingen.de/sun4x_58/gcc-3.0
>Description:
g++ accepts the following construct:

    int* p = new int[10](666);

which is ill-formed (according to my reading of the standard, and g++
seems to know that, since it warns when giving -ansi). However, it
does not follow the "obvoius" semantics of this statement (to
initialize all array members with the initializer, analogous to new
int[10]()), but instead doesn't initialize at all. It doesn't even
check for the type of the "initializer", new int[10](std::cout) is
also accepted

>How-To-Repeat:
hueffner@ogeima:~% cat foo.cc
#include <iostream>
int main() {
    int* p = new int[10000](666);
    for (int i = 0; i < 10000; ++i)
        std::cout << p[i] << ' ';
    std::cout << std::endl;
}
hueffner@ogeima:~% g++ foo.cc
hueffner@ogeima:~% ./a.out
0 0 0 0 0 0 0 0 0 0 0 [...] 0 0 170800 0 3 0 0 0 [...]
>Fix:
g++ should either reject this construct or give it a sensible
semantics.
>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2002-10-31 17:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-31  9:20 c++/5635: no initialization for array new with initializer bangerth
  -- strict thread matches above, loose matches on Subject: below --
2002-09-14 15:49 nathan
2002-02-08  6:26 Falk Hueffner

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