public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/13121] Inserting struct with valarray in map fails
Date: Wed, 19 Nov 2003 14:47:00 -0000	[thread overview]
Message-ID: <20031119144722.19067.qmail@sources.redhat.com> (raw)
In-Reply-To: <20031119101223.13121.Uwe.Seimet@seimet.de>


------- Additional Comments From bangerth at dealii dot org  2003-11-19 14:47 -------
This is because this program
------------------
#include <valarray>
#include <iostream>

int main ()
{
  std::valarray <int> v1(5);
  std::valarray <int> v2;
  v2 = v1;

  std::cout << v1.size() << " " << v2.size() << std::endl;
}
-----------------------
when compiled with any gcc version returns
  g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ x.cc ; ./a.out
  5 0

icc, for reference, returns "5 5". Both results are standards conforming,
since 26.3.2.2/1 reads: "...The resulting behavior is undefined if the
length of the argument array is not equal to the length of the *this
array."

What you do with your map is the following: you first create an entry
by using m[(void*)0], and only then do you assign to it, so the result
is fully conforming.

W.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


  parent reply	other threads:[~2003-11-19 14:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-19 10:12 [Bug c++/13121] New: " Uwe dot Seimet at seimet dot de
2003-11-19 14:34 ` [Bug libstdc++/13121] " bangerth at dealii dot org
2003-11-19 14:47 ` bangerth at dealii dot org [this message]
2003-11-19 15:00 ` Uwe dot Seimet at seimet dot de
2003-11-19 15:04 ` bangerth at dealii dot org
2003-11-19 15:12 ` Uwe dot Seimet at seimet dot de
2003-11-19 15:24 ` bangerth at dealii dot org
2003-11-19 15:25 ` [Bug libstdc++/13121] Wanted: check in valarray::operator= for length of array bangerth at dealii dot org
2003-11-20  3:19 ` gdr at integrable-solutions dot net
2003-11-20  3:22 ` gdr at integrable-solutions dot net
2004-06-18  4:45 ` pinskia at gcc dot gnu dot org

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=20031119144722.19067.qmail@sources.redhat.com \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).