+2017-03-10 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR libfortran/79956
+ * libgfortran.h (GFC_ASSERT): New macro.
+ * m4/reshape.m4 (reshape_'rtype_ccode`): Use GFC_ASSERT
+ to specify that sdim > 0 and rdim > 0.
+ * intrinsic/reshape_generic.c (reshape_internal): Likweise.
+ * generated/reshape_c10.c: Regenerated.
+ * generated/reshape_c16.c: Regenerated.
+ * generated/reshape_c4.c: Regenerated.
+ * generated/reshape_c8.c: Regenerated.
+ * generated/reshape_i16.c: Regenerated.
+ * generated/reshape_i4.c: Regenerated.
+ * generated/reshape_i8.c: Regenerated.
+ * generated/reshape_r10.c: Regenerated.
+ * generated/reshape_r16.c: Regenerated.
+ * generated/reshape_r4.c: Regenerated.
+ * generated/reshape_r8.c: Regenerated.
+
2017-03-11 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/78854
index_type shape_data[GFC_MAX_DIMENSIONS];
rdim = GFC_DESCRIPTOR_EXTENT(shape,0);
+ /* rdim is always > 0; this lets the compiler optimize more and
+ avoids a potential warning. */
+ GFC_ASSERT(sdim>0);
+
if (rdim != GFC_DESCRIPTOR_RANK(ret))
runtime_error("rank of return array incorrect in RESHAPE intrinsic");
}
sdim = GFC_DESCRIPTOR_RANK (source);
+
+ /* sdim is always > 0; this lets the compiler optimize more and
+ avoids a warning. */
+ GFC_ASSERT(sdim>0);
+
ssize = 1;
sempty = 0;
for (n = 0; n < sdim; n++)
index_type shape_data[GFC_MAX_DIMENSIONS];
rdim = GFC_DESCRIPTOR_EXTENT(shape,0);
+ /* rdim is always > 0; this lets the compiler optimize more and
+ avoids a potential warning. */
+ GFC_ASSERT(sdim>0);
+
if (rdim != GFC_DESCRIPTOR_RANK(ret))
runtime_error("rank of return array incorrect in RESHAPE intrinsic");
}
sdim = GFC_DESCRIPTOR_RANK (source);
+
+ /* sdim is always > 0; this lets the compiler optimize more and
+ avoids a warning. */
+ GFC_ASSERT(sdim>0);
+
ssize = 1;
sempty = 0;
for (n = 0; n < sdim; n++)
index_type shape_data[GFC_MAX_DIMENSIONS];
rdim = GFC_DESCRIPTOR_EXTENT(shape,0);
+ /* rdim is always > 0; this lets the compiler optimize more and
+ avoids a potential warning. */
+ GFC_ASSERT(sdim>0);
+
if (rdim != GFC_DESCRIPTOR_RANK(ret))
runtime_error("rank of return array incorrect in RESHAPE intrinsic");
}
sdim = GFC_DESCRIPTOR_RANK (source);
+
+ /* sdim is always > 0; this lets the compiler optimize more and
+ avoids a warning. */
+ GFC_ASSERT(sdim>0);
+
ssize = 1;
sempty = 0;
for (n = 0; n < sdim; n++)
index_type shape_data[GFC_MAX_DIMENSIONS];
rdim = GFC_DESCRIPTOR_EXTENT(shape,0);
+ /* rdim is always > 0; this lets the compiler optimize more and
+ avoids a potential warning. */
+ GFC_ASSERT(sdim>0);
+
if (rdim != GFC_DESCRIPTOR_RANK(ret))
runtime_error("rank of return array incorrect in RESHAPE intrinsic");
}
sdim = GFC_DESCRIPTOR_RANK (source);
+
+ /* sdim is always > 0; this lets the compiler optimize more and
+ avoids a warning. */
+ GFC_ASSERT(sdim>0);
+
ssize = 1;
sempty = 0;
for (n = 0; n < sdim; n++)
index_type shape_data[GFC_MAX_DIMENSIONS];
rdim = GFC_DESCRIPTOR_EXTENT(shape,0);
+ /* rdim is always > 0; this lets the compiler optimize more and
+ avoids a potential warning. */
+ GFC_ASSERT(sdim>0);
+
if (rdim != GFC_DESCRIPTOR_RANK(ret))
runtime_error("rank of return array incorrect in RESHAPE intrinsic");
}
sdim = GFC_DESCRIPTOR_RANK (source);
+
+ /* sdim is always > 0; this lets the compiler optimize more and
+ avoids a warning. */
+ GFC_ASSERT(sdim>0);
+
ssize = 1;
sempty = 0;
for (n = 0; n < sdim; n++)
index_type shape_data[GFC_MAX_DIMENSIONS];
rdim = GFC_DESCRIPTOR_EXTENT(shape,0);
+ /* rdim is always > 0; this lets the compiler optimize more and
+ avoids a potential warning. */
+ GFC_ASSERT(sdim>0);
+
if (rdim != GFC_DESCRIPTOR_RANK(ret))
runtime_error("rank of return array incorrect in RESHAPE intrinsic");
}
sdim = GFC_DESCRIPTOR_RANK (source);
+
+ /* sdim is always > 0; this lets the compiler optimize more and
+ avoids a warning. */
+ GFC_ASSERT(sdim>0);
+
ssize = 1;
sempty = 0;
for (n = 0; n < sdim; n++)
index_type shape_data[GFC_MAX_DIMENSIONS];
rdim = GFC_DESCRIPTOR_EXTENT(shape,0);
+ /* rdim is always > 0; this lets the compiler optimize more and
+ avoids a potential warning. */
+ GFC_ASSERT(sdim>0);
+
if (rdim != GFC_DESCRIPTOR_RANK(ret))
runtime_error("rank of return array incorrect in RESHAPE intrinsic");
}
sdim = GFC_DESCRIPTOR_RANK (source);
+
+ /* sdim is always > 0; this lets the compiler optimize more and
+ avoids a warning. */
+ GFC_ASSERT(sdim>0);
+
ssize = 1;
sempty = 0;
for (n = 0; n < sdim; n++)
index_type shape_data[GFC_MAX_DIMENSIONS];
rdim = GFC_DESCRIPTOR_EXTENT(shape,0);
+ /* rdim is always > 0; this lets the compiler optimize more and
+ avoids a potential warning. */
+ GFC_ASSERT(sdim>0);
+
if (rdim != GFC_DESCRIPTOR_RANK(ret))
runtime_error("rank of return array incorrect in RESHAPE intrinsic");
}
sdim = GFC_DESCRIPTOR_RANK (source);
+
+ /* sdim is always > 0; this lets the compiler optimize more and
+ avoids a warning. */
+ GFC_ASSERT(sdim>0);
+
ssize = 1;
sempty = 0;
for (n = 0; n < sdim; n++)
index_type shape_data[GFC_MAX_DIMENSIONS];
rdim = GFC_DESCRIPTOR_EXTENT(shape,0);
+ /* rdim is always > 0; this lets the compiler optimize more and
+ avoids a potential warning. */
+ GFC_ASSERT(sdim>0);
+
if (rdim != GFC_DESCRIPTOR_RANK(ret))
runtime_error("rank of return array incorrect in RESHAPE intrinsic");
}
sdim = GFC_DESCRIPTOR_RANK (source);
+
+ /* sdim is always > 0; this lets the compiler optimize more and
+ avoids a warning. */
+ GFC_ASSERT(sdim>0);
+
ssize = 1;
sempty = 0;
for (n = 0; n < sdim; n++)
index_type shape_data[GFC_MAX_DIMENSIONS];
rdim = GFC_DESCRIPTOR_EXTENT(shape,0);
+ /* rdim is always > 0; this lets the compiler optimize more and
+ avoids a potential warning. */
+ GFC_ASSERT(sdim>0);
+
if (rdim != GFC_DESCRIPTOR_RANK(ret))
runtime_error("rank of return array incorrect in RESHAPE intrinsic");
}
sdim = GFC_DESCRIPTOR_RANK (source);
+
+ /* sdim is always > 0; this lets the compiler optimize more and
+ avoids a warning. */
+ GFC_ASSERT(sdim>0);
+
ssize = 1;
sempty = 0;
for (n = 0; n < sdim; n++)
index_type shape_data[GFC_MAX_DIMENSIONS];
rdim = GFC_DESCRIPTOR_EXTENT(shape,0);
+ /* rdim is always > 0; this lets the compiler optimize more and
+ avoids a potential warning. */
+ GFC_ASSERT(sdim>0);
+
if (rdim != GFC_DESCRIPTOR_RANK(ret))
runtime_error("rank of return array incorrect in RESHAPE intrinsic");
}
sdim = GFC_DESCRIPTOR_RANK (source);
+
+ /* sdim is always > 0; this lets the compiler optimize more and
+ avoids a warning. */
+ GFC_ASSERT(sdim>0);
+
ssize = 1;
sempty = 0;
for (n = 0; n < sdim; n++)
index_type shape_data[GFC_MAX_DIMENSIONS];
rdim = GFC_DESCRIPTOR_EXTENT(shape,0);
+ /* rdim is always > 0; this lets the compiler optimize more and
+ avoids a warning. */
+ GFC_ASSERT (rdim > 0);
+
if (rdim != GFC_DESCRIPTOR_RANK(ret))
runtime_error("rank of return array incorrect in RESHAPE intrinsic");
source_extent = 1;
sdim = GFC_DESCRIPTOR_RANK (source);
+ /* sdim is always > 0; this lets the compiler optimize more and
+ avoids a warning. */
+ GFC_ASSERT(sdim>0);
+
for (n = 0; n < sdim; n++)
{
index_type se;
}
sdim = GFC_DESCRIPTOR_RANK (source);
+ /* sdim is always > 0; this lets the compiler optimize more and
+ avoids a warning. */
+ GFC_ASSERT(sdim>0);
+
ssize = 1;
sempty = 0;
for (n = 0; n < sdim; n++)
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
+/* This macro can be used to annotate conditions which we know to
+ be true, so that the compiler can optimize based on the condition. */
+
+#define GFC_ASSERT(EXPR) \
+ ((void)(__builtin_expect (!(EXPR), 0) ? __builtin_unreachable (), 0 : 0))
/* Make sure we have ptrdiff_t. */
#ifndef HAVE_PTRDIFF_T
index_type shape_data[GFC_MAX_DIMENSIONS];
rdim = GFC_DESCRIPTOR_EXTENT(shape,0);
+ /* rdim is always > 0; this lets the compiler optimize more and
+ avoids a potential warning. */
+ GFC_ASSERT(sdim>0);
+
if (rdim != GFC_DESCRIPTOR_RANK(ret))
runtime_error("rank of return array incorrect in RESHAPE intrinsic");
}
sdim = GFC_DESCRIPTOR_RANK (source);
+
+ /* sdim is always > 0; this lets the compiler optimize more and
+ avoids a warning. */
+ GFC_ASSERT(sdim>0);
+
ssize = 1;
sempty = 0;
for (n = 0; n < sdim; n++)