This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/30416] SIGSEGV in valarray::cshift(n) on empty array



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]