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 libfortran/33298] Wrong code for SPREAD on zero-sized arrays



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


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