[Bug libstdc++/30416] SIGSEGV in valarray::cshift(n) on empty array
gdr at integrable-solutions dot net
gcc-bugzilla@gcc.gnu.org
Wed Jan 10 03:32:00 GMT 2007
------- 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
More information about the Gcc-bugs
mailing list