aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2012-04-10 15:39:22 +0000
committerMichael Matz <matz@gcc.gnu.org>2012-04-10 15:39:22 +0000
commitb43645b85249fcae9071fc4bcc1e9b54c15b313f (patch)
tree669ecf00bcc15e616e0b3f79d838b063f7331a93 /libgfortran
parentca18edc55f1c23fcaa06aabe07460f4bb56f937f (diff)
downloadgcc-b43645b85249fcae9071fc4bcc1e9b54c15b313f.zip
gcc-b43645b85249fcae9071fc4bcc1e9b54c15b313f.tar.gz
gcc-b43645b85249fcae9071fc4bcc1e9b54c15b313f.tar.bz2
cshift0.m4 (cshift0_'rtype_code`): Guard use of modulo.
* m4/cshift0.m4 (cshift0_'rtype_code`): Guard use of modulo. * generated/cshift0_c10.c: Regenerated. * generated/cshift0_c16.c: Regenerated. * generated/cshift0_c4.c: Regenerated. * generated/cshift0_c8.c: Regenerated. * generated/cshift0_i16.c: Regenerated. * generated/cshift0_i1.c: Regenerated. * generated/cshift0_i2.c: Regenerated. * generated/cshift0_i4.c: Regenerated. * generated/cshift0_i8.c: Regenerated. * generated/cshift0_r10.c: Regenerated. * generated/cshift0_r16.c: Regenerated. * generated/cshift0_r4.c: Regenerated. * generated/cshift0_r8.c: Regenerated. From-SVN: r186283
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog18
-rw-r--r--libgfortran/generated/cshift0_c10.c10
-rw-r--r--libgfortran/generated/cshift0_c16.c10
-rw-r--r--libgfortran/generated/cshift0_c4.c10
-rw-r--r--libgfortran/generated/cshift0_c8.c10
-rw-r--r--libgfortran/generated/cshift0_i1.c10
-rw-r--r--libgfortran/generated/cshift0_i16.c10
-rw-r--r--libgfortran/generated/cshift0_i2.c10
-rw-r--r--libgfortran/generated/cshift0_i4.c10
-rw-r--r--libgfortran/generated/cshift0_i8.c10
-rw-r--r--libgfortran/generated/cshift0_r10.c10
-rw-r--r--libgfortran/generated/cshift0_r16.c10
-rw-r--r--libgfortran/generated/cshift0_r4.c10
-rw-r--r--libgfortran/generated/cshift0_r8.c10
-rw-r--r--libgfortran/m4/cshift0.m410
15 files changed, 116 insertions, 42 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 93e9117..15b9f94 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,21 @@
+2012-04-10 Michael Matz <matz@suse.de>
+
+ * m4/cshift0.m4 (cshift0_'rtype_code`): Guard use of modulo.
+
+ * generated/cshift0_c10.c: Regenerated.
+ * generated/cshift0_c16.c: Regenerated.
+ * generated/cshift0_c4.c: Regenerated.
+ * generated/cshift0_c8.c: Regenerated.
+ * generated/cshift0_i16.c: Regenerated.
+ * generated/cshift0_i1.c: Regenerated.
+ * generated/cshift0_i2.c: Regenerated.
+ * generated/cshift0_i4.c: Regenerated.
+ * generated/cshift0_i8.c: Regenerated.
+ * generated/cshift0_r10.c: Regenerated.
+ * generated/cshift0_r16.c: Regenerated.
+ * generated/cshift0_r4.c: Regenerated.
+ * generated/cshift0_r8.c: Regenerated.
+
2012-04-04 Tristan Gingold <gingold@adacore.com>
* libgfortran.h: Include complex.h before math.h
diff --git a/libgfortran/generated/cshift0_c10.c b/libgfortran/generated/cshift0_c10.c
index 43e173b..ba27a9e 100644
--- a/libgfortran/generated/cshift0_c10.c
+++ b/libgfortran/generated/cshift0_c10.c
@@ -97,9 +97,13 @@ cshift0_c10 (gfc_array_c10 *ret, const gfc_array_c10 *array, ptrdiff_t shift,
rptr = ret->base_addr;
sptr = array->base_addr;
- shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
- if (shift < 0)
- shift += len;
+ /* Avoid the costly modulo for trivially in-bound shifts. */
+ if (shift < 0 || shift >= len)
+ {
+ shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
+ if (shift < 0)
+ shift += len;
+ }
while (rptr)
{
diff --git a/libgfortran/generated/cshift0_c16.c b/libgfortran/generated/cshift0_c16.c
index f1f2539..0cdc6dc 100644
--- a/libgfortran/generated/cshift0_c16.c
+++ b/libgfortran/generated/cshift0_c16.c
@@ -97,9 +97,13 @@ cshift0_c16 (gfc_array_c16 *ret, const gfc_array_c16 *array, ptrdiff_t shift,
rptr = ret->base_addr;
sptr = array->base_addr;
- shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
- if (shift < 0)
- shift += len;
+ /* Avoid the costly modulo for trivially in-bound shifts. */
+ if (shift < 0 || shift >= len)
+ {
+ shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
+ if (shift < 0)
+ shift += len;
+ }
while (rptr)
{
diff --git a/libgfortran/generated/cshift0_c4.c b/libgfortran/generated/cshift0_c4.c
index bf8554e..1761377 100644
--- a/libgfortran/generated/cshift0_c4.c
+++ b/libgfortran/generated/cshift0_c4.c
@@ -97,9 +97,13 @@ cshift0_c4 (gfc_array_c4 *ret, const gfc_array_c4 *array, ptrdiff_t shift,
rptr = ret->base_addr;
sptr = array->base_addr;
- shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
- if (shift < 0)
- shift += len;
+ /* Avoid the costly modulo for trivially in-bound shifts. */
+ if (shift < 0 || shift >= len)
+ {
+ shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
+ if (shift < 0)
+ shift += len;
+ }
while (rptr)
{
diff --git a/libgfortran/generated/cshift0_c8.c b/libgfortran/generated/cshift0_c8.c
index e3fd5b6..e453488 100644
--- a/libgfortran/generated/cshift0_c8.c
+++ b/libgfortran/generated/cshift0_c8.c
@@ -97,9 +97,13 @@ cshift0_c8 (gfc_array_c8 *ret, const gfc_array_c8 *array, ptrdiff_t shift,
rptr = ret->base_addr;
sptr = array->base_addr;
- shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
- if (shift < 0)
- shift += len;
+ /* Avoid the costly modulo for trivially in-bound shifts. */
+ if (shift < 0 || shift >= len)
+ {
+ shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
+ if (shift < 0)
+ shift += len;
+ }
while (rptr)
{
diff --git a/libgfortran/generated/cshift0_i1.c b/libgfortran/generated/cshift0_i1.c
index f2315de..76c30ef 100644
--- a/libgfortran/generated/cshift0_i1.c
+++ b/libgfortran/generated/cshift0_i1.c
@@ -97,9 +97,13 @@ cshift0_i1 (gfc_array_i1 *ret, const gfc_array_i1 *array, ptrdiff_t shift,
rptr = ret->base_addr;
sptr = array->base_addr;
- shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
- if (shift < 0)
- shift += len;
+ /* Avoid the costly modulo for trivially in-bound shifts. */
+ if (shift < 0 || shift >= len)
+ {
+ shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
+ if (shift < 0)
+ shift += len;
+ }
while (rptr)
{
diff --git a/libgfortran/generated/cshift0_i16.c b/libgfortran/generated/cshift0_i16.c
index 7566042..b114303 100644
--- a/libgfortran/generated/cshift0_i16.c
+++ b/libgfortran/generated/cshift0_i16.c
@@ -97,9 +97,13 @@ cshift0_i16 (gfc_array_i16 *ret, const gfc_array_i16 *array, ptrdiff_t shift,
rptr = ret->base_addr;
sptr = array->base_addr;
- shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
- if (shift < 0)
- shift += len;
+ /* Avoid the costly modulo for trivially in-bound shifts. */
+ if (shift < 0 || shift >= len)
+ {
+ shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
+ if (shift < 0)
+ shift += len;
+ }
while (rptr)
{
diff --git a/libgfortran/generated/cshift0_i2.c b/libgfortran/generated/cshift0_i2.c
index 4a8154c..0f510f8 100644
--- a/libgfortran/generated/cshift0_i2.c
+++ b/libgfortran/generated/cshift0_i2.c
@@ -97,9 +97,13 @@ cshift0_i2 (gfc_array_i2 *ret, const gfc_array_i2 *array, ptrdiff_t shift,
rptr = ret->base_addr;
sptr = array->base_addr;
- shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
- if (shift < 0)
- shift += len;
+ /* Avoid the costly modulo for trivially in-bound shifts. */
+ if (shift < 0 || shift >= len)
+ {
+ shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
+ if (shift < 0)
+ shift += len;
+ }
while (rptr)
{
diff --git a/libgfortran/generated/cshift0_i4.c b/libgfortran/generated/cshift0_i4.c
index 7d25b7b..d75b4d6 100644
--- a/libgfortran/generated/cshift0_i4.c
+++ b/libgfortran/generated/cshift0_i4.c
@@ -97,9 +97,13 @@ cshift0_i4 (gfc_array_i4 *ret, const gfc_array_i4 *array, ptrdiff_t shift,
rptr = ret->base_addr;
sptr = array->base_addr;
- shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
- if (shift < 0)
- shift += len;
+ /* Avoid the costly modulo for trivially in-bound shifts. */
+ if (shift < 0 || shift >= len)
+ {
+ shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
+ if (shift < 0)
+ shift += len;
+ }
while (rptr)
{
diff --git a/libgfortran/generated/cshift0_i8.c b/libgfortran/generated/cshift0_i8.c
index 2f565ca..4154eb2 100644
--- a/libgfortran/generated/cshift0_i8.c
+++ b/libgfortran/generated/cshift0_i8.c
@@ -97,9 +97,13 @@ cshift0_i8 (gfc_array_i8 *ret, const gfc_array_i8 *array, ptrdiff_t shift,
rptr = ret->base_addr;
sptr = array->base_addr;
- shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
- if (shift < 0)
- shift += len;
+ /* Avoid the costly modulo for trivially in-bound shifts. */
+ if (shift < 0 || shift >= len)
+ {
+ shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
+ if (shift < 0)
+ shift += len;
+ }
while (rptr)
{
diff --git a/libgfortran/generated/cshift0_r10.c b/libgfortran/generated/cshift0_r10.c
index b7f21ca..14be683 100644
--- a/libgfortran/generated/cshift0_r10.c
+++ b/libgfortran/generated/cshift0_r10.c
@@ -97,9 +97,13 @@ cshift0_r10 (gfc_array_r10 *ret, const gfc_array_r10 *array, ptrdiff_t shift,
rptr = ret->base_addr;
sptr = array->base_addr;
- shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
- if (shift < 0)
- shift += len;
+ /* Avoid the costly modulo for trivially in-bound shifts. */
+ if (shift < 0 || shift >= len)
+ {
+ shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
+ if (shift < 0)
+ shift += len;
+ }
while (rptr)
{
diff --git a/libgfortran/generated/cshift0_r16.c b/libgfortran/generated/cshift0_r16.c
index 320b705..6d351f7 100644
--- a/libgfortran/generated/cshift0_r16.c
+++ b/libgfortran/generated/cshift0_r16.c
@@ -97,9 +97,13 @@ cshift0_r16 (gfc_array_r16 *ret, const gfc_array_r16 *array, ptrdiff_t shift,
rptr = ret->base_addr;
sptr = array->base_addr;
- shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
- if (shift < 0)
- shift += len;
+ /* Avoid the costly modulo for trivially in-bound shifts. */
+ if (shift < 0 || shift >= len)
+ {
+ shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
+ if (shift < 0)
+ shift += len;
+ }
while (rptr)
{
diff --git a/libgfortran/generated/cshift0_r4.c b/libgfortran/generated/cshift0_r4.c
index 93ccf52..939ba6e 100644
--- a/libgfortran/generated/cshift0_r4.c
+++ b/libgfortran/generated/cshift0_r4.c
@@ -97,9 +97,13 @@ cshift0_r4 (gfc_array_r4 *ret, const gfc_array_r4 *array, ptrdiff_t shift,
rptr = ret->base_addr;
sptr = array->base_addr;
- shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
- if (shift < 0)
- shift += len;
+ /* Avoid the costly modulo for trivially in-bound shifts. */
+ if (shift < 0 || shift >= len)
+ {
+ shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
+ if (shift < 0)
+ shift += len;
+ }
while (rptr)
{
diff --git a/libgfortran/generated/cshift0_r8.c b/libgfortran/generated/cshift0_r8.c
index a3f7479..73afb8a 100644
--- a/libgfortran/generated/cshift0_r8.c
+++ b/libgfortran/generated/cshift0_r8.c
@@ -97,9 +97,13 @@ cshift0_r8 (gfc_array_r8 *ret, const gfc_array_r8 *array, ptrdiff_t shift,
rptr = ret->base_addr;
sptr = array->base_addr;
- shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
- if (shift < 0)
- shift += len;
+ /* Avoid the costly modulo for trivially in-bound shifts. */
+ if (shift < 0 || shift >= len)
+ {
+ shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
+ if (shift < 0)
+ shift += len;
+ }
while (rptr)
{
diff --git a/libgfortran/m4/cshift0.m4 b/libgfortran/m4/cshift0.m4
index 567222b..b1966aa 100644
--- a/libgfortran/m4/cshift0.m4
+++ b/libgfortran/m4/cshift0.m4
@@ -98,9 +98,13 @@ cshift0_'rtype_code` ('rtype` *ret, const 'rtype` *array, ptrdiff_t shift,
rptr = ret->base_addr;
sptr = array->base_addr;
- shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
- if (shift < 0)
- shift += len;
+ /* Avoid the costly modulo for trivially in-bound shifts. */
+ if (shift < 0 || shift >= len)
+ {
+ shift = len == 0 ? 0 : shift % (ptrdiff_t)len;
+ if (shift < 0)
+ shift += len;
+ }
while (rptr)
{