This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/48066] [4.3/4.4/4.5/4.6 Regression] Segfault with SUM of zero-sized array
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 12 Mar 2011 09:38:19 +0000
- Subject: [Bug fortran/48066] [4.3/4.4/4.5/4.6 Regression] Segfault with SUM of zero-sized array
- Auto-submitted: auto-generated
- References: <bug-48066-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48066
--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-03-12 09:38:18 UTC ---
Of course, the patch does not work as "dest" is not NULL ...
I wonder whether a patch like the following would be correct. One probably
needs to go through all the users of ifunction{,_logical}.m4 and check what is
the correct solution, which might or might not be the one below:
@@ -143,9 +143,7 @@ sum_r4 (gfc_array_r4 * const restrict retarray,
{
result = 0;
- if (len <= 0)
- *dest = 0;
- else
+ if (len > 0)
{
for (n = 0; n < len; n++, src += delta)
{