This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/33298] Wrong code for SPREAD on zero-sized arrays
- From: "toon at moene dot indiv dot nluug dot nl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Sep 2007 13:04:35 -0000
- Subject: [Bug libfortran/33298] Wrong code for SPREAD on zero-sized arrays
- References: <bug-33298-109@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from toon at moene dot indiv dot nluug dot nl 2007-09-04 13:04 -------
Quoting spread_generic.c:
145 for (n = 0; n < ncopies; n++)
146 {
147 memcpy (dest, sptr, size);
148 dest += rdelta;
149 }
The C 99 Standard has the following to say about the mem* functions (7.21.2.1
ff):
Where an argument declared as size_t n specifies the length of the array for a
function, n can have the value zero on a call to that function. Unless
explicitly stated otherwise in the description of a particular function in this
subclause, pointer arguments on such a call shall still have valid values, as
described in 7.1.4.
So "size" can be zero, *but the the pointer arguments on such a call shall
still have valid values.*
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33298