This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/30416] SIGSEGV in valarray::cshift(n) on empty array
- From: "gdr at integrable-solutions dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Jan 2007 03:32:08 -0000
- Subject: [Bug libstdc++/30416] SIGSEGV in valarray::cshift(n) on empty array
- References: <bug-30416-1186@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from gdr at integrable-solutions dot net 2007-01-10 03:32 -------
Subject: Re: SIGSEGV in valarray::cshift(n) on empty array
"chris at bubblescope dot net" <gcc-bugzilla@gcc.gnu.org> writes:
| The standard refers to "(l+n)%size()", so if size()=0, that seems to be
| undefined. On the other hand, it seems fairly obvious what should happen in
| this case (ie nothing).
On the other other hand [semi ;-)], even without resorting to
undefinedness of "% size()", it takes a special rule to define the
cyclic rotation of nothing. I don't see that special rule, which is
why I asked why it was obvious that the result it well-defined.
| On an unrelated note, isn't there a another bug in the standard here, as it
| seems to be assuming that (-1)%n = (n-1) for positive n, which isn't required
| by the standard?
the "c" in "cshift" stands for "cyclic", and yes the standard should have
described the behviour in terms of cyclic permutation instead of
showing an implementation.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30416