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: "tkoenig 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 17:22:51 +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 #9 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2011-03-12 17:22:50 UTC ---
This one looks better:
Index: m4/ifunction_logical.m4
===================================================================
--- m4/ifunction_logical.m4 (Revision 170897)
+++ m4/ifunction_logical.m4 (Arbeitskopie)
@@ -149,7 +149,7 @@
dest = retarray->data;
- continue_loop = 1;
+ continue_loop = len > 0;
while (continue_loop)
{
const GFC_LOGICAL_1 * restrict src;
@@ -158,17 +158,12 @@
{
')dnl
define(START_ARRAY_BLOCK,
-` if (len <= 0)
- *dest = '$1`;
- else
+` for (n = 0; n < len; n++, src += delta)
{
- for (n = 0; n < len; n++, src += delta)
- {
')dnl
define(FINISH_ARRAY_FUNCTION,
- ` }
- *dest = result;
- }
+` }
+ *dest = result;
}
/* Advance to the next element. */
count[0]++;
Index: m4/ifunction.m4
===================================================================
--- m4/ifunction.m4 (Revision 170897)
+++ m4/ifunction.m4 (Arbeitskopie)
@@ -122,7 +122,7 @@
base = array->data;
dest = retarray->data;
- continue_loop = 1;
+ continue_loop = len > 0;
while (continue_loop)
{
const atype_name * restrict src;
@@ -131,18 +131,13 @@
{
')dnl
define(START_ARRAY_BLOCK,
-` if (len <= 0)
- *dest = '$1`;
- else
+` for (n = 0; n < len; n++, src += delta)
{
- for (n = 0; n < len; n++, src += delta)
- {
')dnl
define(FINISH_ARRAY_FUNCTION,
-` }
- '$1`
- *dest = result;
- }
+` }
+ '$1`
+ *dest = result;
}
/* Advance to the next element. */
count[0]++;
Let's see if it survives regression-testing.