public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: agenkin@dimacs.rutgers.edu
To: gcc-gnats@gcc.gnu.org
Subject: libstdc++/8851: Slice_array assignment changes right side, leaves left side unchanged.
Date: Fri, 06 Dec 2002 14:26:00 -0000	[thread overview]
Message-ID: <20021206221741.21061.qmail@sources.redhat.com> (raw)


>Number:         8851
>Category:       libstdc++
>Synopsis:       Slice_array assignment changes right side, leaves left side unchanged.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 06 14:26:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Alexander Genkin
>Release:        gcc version 3.2 20020927
>Organization:
>Environment:
Cygwin
>Description:
Slice_array assignment changes right side, leaves left side unchanged.

#include <iostream>
#include <valarray>
using namespace std;

std::ostream& operator<<( std::ostream& s, const valarray<double>& vad ) {
    for( size_t i=0; i<vad.size(); i++ ) s<<vad[i]<<" ";
    return s;
}

int main() {
    valarray<double> a(1.0,9);
    valarray<double> b(2.0,9);

    b[slice(0,3,3)] = a[slice(2,3,3)];
    cout<<endl<<"a "<<a;
    cout<<endl<<"b "<<b;

    return 0;
}

Output is:
a 1 1 2 1 1 2 1 1 2
b 2 2 2 2 2 2 2 2 2
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2002-12-06 22:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-06 14:26 agenkin [this message]
2002-12-07  9:38 gdr
2002-12-09 23:42 gdr
2002-12-10  7:46 Alex Genkin
2002-12-11 12:26 Gabriel Dos Reis

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=20021206221741.21061.qmail@sources.redhat.com \
    --to=agenkin@dimacs.rutgers.edu \
    --cc=gcc-gnats@gcc.gnu.org \
    /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: link
Be 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).