summaryrefslogtreecommitdiff
path: root/libgfortran/intrinsics
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2012-04-22 15:33:01 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2012-04-22 15:33:01 +0000
commit1d9ee8a89ae88befe5572a65b997cd84241c196f (patch)
tree646e5ae6929d675514204ffba97ecc64f6157a31 /libgfortran/intrinsics
parent0972cc307e81708c54bd5b89c91fe99a84c65d73 (diff)
parent3c64f1347227c8aceae1822bc66659d861596fc4 (diff)
downloadgcc-1d9ee8a89ae88befe5572a65b997cd84241c196f.tar.gz
2012-04-22 Tobias Burnus <burnus@net-b.de>
* Merged Revs. 185177 through 186673 from the trunk. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/fortran-dev@186674 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/intrinsics')
-rw-r--r--libgfortran/intrinsics/c99_functions.c29
-rw-r--r--libgfortran/intrinsics/chmod.c1
-rw-r--r--libgfortran/intrinsics/cshift0.c4
-rw-r--r--libgfortran/intrinsics/ctime.c10
-rw-r--r--libgfortran/intrinsics/date_and_time.c2
-rw-r--r--libgfortran/intrinsics/eoshift0.c4
-rw-r--r--libgfortran/intrinsics/eoshift2.c4
-rw-r--r--libgfortran/intrinsics/getlog.c4
-rw-r--r--libgfortran/intrinsics/pack_generic.c6
-rw-r--r--libgfortran/intrinsics/reshape_generic.c2
-rw-r--r--libgfortran/intrinsics/spread_generic.c7
-rw-r--r--libgfortran/intrinsics/string_intrinsics_inc.c9
-rw-r--r--libgfortran/intrinsics/transpose_generic.c2
-rw-r--r--libgfortran/intrinsics/unpack_generic.c2
14 files changed, 28 insertions, 58 deletions
diff --git a/libgfortran/intrinsics/c99_functions.c b/libgfortran/intrinsics/c99_functions.c
index a95f09ac01d..516077694d3 100644
--- a/libgfortran/intrinsics/c99_functions.c
+++ b/libgfortran/intrinsics/c99_functions.c
@@ -1,5 +1,5 @@
/* Implementation of various C99 functions
- Copyright (C) 2004, 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2009, 2010, 2012 Free Software Foundation, Inc.
This file is part of the GNU Fortran 95 runtime library (libgfortran).
@@ -27,33 +27,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define C99_PROTOS_H WE_DONT_WANT_PROTOS_NOW
#include "libgfortran.h"
-/* IRIX's <math.h> declares a non-C99 compliant implementation of cabs,
- which takes two floating point arguments instead of a single complex.
- If <complex.h> is missing this prevents building of c99_functions.c.
- To work around this we redirect cabs{,f,l} calls to __gfc_cabs{,f,l}. */
-
-#if defined(__sgi__) && !defined(HAVE_COMPLEX_H)
-#undef HAVE_CABS
-#undef HAVE_CABSF
-#undef HAVE_CABSL
-#define cabs __gfc_cabs
-#define cabsf __gfc_cabsf
-#define cabsl __gfc_cabsl
-#endif
-
-/* Tru64's <math.h> declares a non-C99 compliant implementation of cabs,
- which takes two floating point arguments instead of a single complex.
- To work around this we redirect cabs{,f,l} calls to __gfc_cabs{,f,l}. */
-
-#ifdef __osf__
-#undef HAVE_CABS
-#undef HAVE_CABSF
-#undef HAVE_CABSL
-#define cabs __gfc_cabs
-#define cabsf __gfc_cabsf
-#define cabsl __gfc_cabsl
-#endif
-
/* On a C99 system "I" (with I*I = -1) should be defined in complex.h;
if not, we define a fallback version here. */
#ifndef I
diff --git a/libgfortran/intrinsics/chmod.c b/libgfortran/intrinsics/chmod.c
index 01db8beb9e0..91563033f13 100644
--- a/libgfortran/intrinsics/chmod.c
+++ b/libgfortran/intrinsics/chmod.c
@@ -141,7 +141,6 @@ chmod_func (char *name, char *mode, gfc_charlen_type name_len,
rwxXstugo[6] = false;
rwxXstugo[7] = false;
rwxXstugo[8] = false;
- rwxXstugo[9] = false;
part = 0;
set_mode = -1;
for (; i < mode_len; i++)
diff --git a/libgfortran/intrinsics/cshift0.c b/libgfortran/intrinsics/cshift0.c
index bedb41d782c..3383868c753 100644
--- a/libgfortran/intrinsics/cshift0.c
+++ b/libgfortran/intrinsics/cshift0.c
@@ -79,8 +79,8 @@ cshift0 (gfc_array_char * ret, const gfc_array_char * array,
GFC_DIMENSION_SET (ret->dim[i], 0, ext, sm);
}
- /* internal_malloc_size allocates a single byte for zero size. */
- ret->base_addr = internal_malloc_size (size * arraysize);
+ /* xmalloc allocates a single byte for zero size. */
+ ret->base_addr = xmalloc (size * arraysize);
}
else if (unlikely (compile_options.bounds_check))
{
diff --git a/libgfortran/intrinsics/ctime.c b/libgfortran/intrinsics/ctime.c
index 05bf31fc779..d22851c918e 100644
--- a/libgfortran/intrinsics/ctime.c
+++ b/libgfortran/intrinsics/ctime.c
@@ -1,5 +1,5 @@
/* Implementation of the CTIME and FDATE g77 intrinsics.
- Copyright (C) 2005, 2007, 2009, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007, 2009, 2011, 2012 Free Software Foundation, Inc.
Contributed by François-Xavier Coudert <coudert@clipper.ens.fr>
This file is part of the GNU Fortran runtime library (libgfortran).
@@ -64,7 +64,7 @@ void
fdate (char ** date, gfc_charlen_type * date_len)
{
time_t now = time(NULL);
- *date = get_mem (CSZ);
+ *date = xmalloc (CSZ);
*date_len = strctime (*date, CSZ, &now);
}
@@ -76,7 +76,7 @@ void
fdate_sub (char * date, gfc_charlen_type date_len)
{
time_t now = time(NULL);
- char *s = get_mem (date_len + 1);
+ char *s = xmalloc (date_len + 1);
size_t n = strctime (s, date_len + 1, &now);
fstrcpy (date, date_len, s, n);
free (s);
@@ -91,7 +91,7 @@ void
PREFIX(ctime) (char ** date, gfc_charlen_type * date_len, GFC_INTEGER_8 t)
{
time_t now = t;
- *date = get_mem (CSZ);
+ *date = xmalloc (CSZ);
*date_len = strctime (*date, CSZ, &now);
}
@@ -103,7 +103,7 @@ void
ctime_sub (GFC_INTEGER_8 * t, char * date, gfc_charlen_type date_len)
{
time_t now = *t;
- char *s = get_mem (date_len + 1);
+ char *s = xmalloc (date_len + 1);
size_t n = strctime (s, date_len + 1, &now);
fstrcpy (date, date_len, s, n);
free (s);
diff --git a/libgfortran/intrinsics/date_and_time.c b/libgfortran/intrinsics/date_and_time.c
index eda812a178b..a4d80dd7438 100644
--- a/libgfortran/intrinsics/date_and_time.c
+++ b/libgfortran/intrinsics/date_and_time.c
@@ -270,7 +270,7 @@ secnds (GFC_REAL_4 *x)
GFC_REAL_4 temp1, temp2;
/* Make the INTEGER*4 array for passing to date_and_time. */
- gfc_array_i4 *avalues = internal_malloc_size (sizeof (gfc_array_i4));
+ gfc_array_i4 *avalues = xmalloc (sizeof (gfc_array_i4));
avalues->base_addr = &values[0];
GFC_DESCRIPTOR_DTYPE (avalues) = ((BT_REAL << GFC_DTYPE_TYPE_SHIFT)
& GFC_DTYPE_TYPE_MASK) +
diff --git a/libgfortran/intrinsics/eoshift0.c b/libgfortran/intrinsics/eoshift0.c
index 583bde1c436..eac0cf5fbff 100644
--- a/libgfortran/intrinsics/eoshift0.c
+++ b/libgfortran/intrinsics/eoshift0.c
@@ -86,8 +86,8 @@ eoshift0 (gfc_array_char * ret, const gfc_array_char * array,
}
- /* internal_malloc_size allocates a single byte for zero size. */
- ret->base_addr = internal_malloc_size (size * arraysize);
+ /* xmalloc allocates a single byte for zero size. */
+ ret->base_addr = xmalloc (size * arraysize);
}
else if (unlikely (compile_options.bounds_check))
{
diff --git a/libgfortran/intrinsics/eoshift2.c b/libgfortran/intrinsics/eoshift2.c
index b3ec16e3e72..9371a131548 100644
--- a/libgfortran/intrinsics/eoshift2.c
+++ b/libgfortran/intrinsics/eoshift2.c
@@ -91,8 +91,8 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array,
GFC_DIMENSION_SET (ret->dim[i], 0, ext, sm);
- /* internal_malloc_size allocates a single byte for zero size. */
- ret->base_addr = internal_malloc_size (size * arraysize);
+ /* xmalloc allocates a single byte for zero size. */
+ ret->base_addr = xmalloc (size * arraysize);
}
}
diff --git a/libgfortran/intrinsics/getlog.c b/libgfortran/intrinsics/getlog.c
index f4fc0f6e5ef..92338c1fb8d 100644
--- a/libgfortran/intrinsics/getlog.c
+++ b/libgfortran/intrinsics/getlog.c
@@ -1,5 +1,5 @@
/* Implementation of the GETLOG g77 intrinsic.
- Copyright (C) 2005, 2007, 2009, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007, 2009, 2011, 2012 Free Software Foundation, Inc.
Contributed by François-Xavier Coudert <coudert@clipper.ens.fr>
This file is part of the GNU Fortran runtime library (libgfortran).
@@ -86,7 +86,7 @@ PREFIX(getlog) (char * login, gfc_charlen_type login_len)
targets; we do something simple in case the target doesn't
support sysconf. */
static const size_t buflen = 1024;
- buf = get_mem (buflen);
+ buf = xmalloc (buflen);
err = getpwuid_r (geteuid (), &pwd, buf, buflen, &result);
if (err != 0 || result == NULL)
goto cleanup;
diff --git a/libgfortran/intrinsics/pack_generic.c b/libgfortran/intrinsics/pack_generic.c
index b68d0595337..36b7a4d8dc9 100644
--- a/libgfortran/intrinsics/pack_generic.c
+++ b/libgfortran/intrinsics/pack_generic.c
@@ -153,8 +153,8 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array,
GFC_DIMENSION_SET (ret->dim[0], 0, total, size);
ret->offset = 0;
- /* internal_malloc_size allocates a single byte for zero size. */
- ret->base_addr = internal_malloc_size (size * total);
+ /* xmalloc allocates a single byte for zero size. */
+ ret->base_addr = xmalloc (size * total);
if (total == 0)
return; /* In this case, nothing remains to be done. */
@@ -520,7 +520,7 @@ pack_s_internal (gfc_array_char *ret, const gfc_array_char *array,
ret->offset = 0;
- ret->base_addr = internal_malloc_size (size * total);
+ ret->base_addr = xmalloc (size * total);
if (total == 0)
return;
diff --git a/libgfortran/intrinsics/reshape_generic.c b/libgfortran/intrinsics/reshape_generic.c
index 0bdb3e4cf3a..d277af7e21d 100644
--- a/libgfortran/intrinsics/reshape_generic.c
+++ b/libgfortran/intrinsics/reshape_generic.c
@@ -103,7 +103,7 @@ reshape_internal (parray *ret, parray *source, shape_type *shape,
else
alloc_size = rs;
- ret->base_addr = internal_malloc_size (alloc_size);
+ ret->base_addr = xmalloc (alloc_size);
ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
}
diff --git a/libgfortran/intrinsics/spread_generic.c b/libgfortran/intrinsics/spread_generic.c
index 47957875548..9e85e8e80c3 100644
--- a/libgfortran/intrinsics/spread_generic.c
+++ b/libgfortran/intrinsics/spread_generic.c
@@ -1,5 +1,6 @@
/* Generic implementation of the SPREAD intrinsic
- Copyright 2002, 2005, 2006, 2007, 2009, 2010, 2012 Free Software Foundation, Inc.
+ Copyright 2002, 2005, 2006, 2007, 2009, 2010, 2012
+ Free Software Foundation, Inc.
Contributed by Paul Brook <paul@nowt.org>
This file is part of the GNU Fortran runtime library (libgfortran).
@@ -100,7 +101,7 @@ spread_internal (gfc_array_char *ret, const gfc_array_char *source,
GFC_DIMENSION_SET (ret->dim[n], 0, ext, sm);
}
ret->offset = 0;
- ret->base_addr = internal_malloc_size (rs);
+ ret->base_addr = xmalloc (rs);
if (rs <= 0)
return;
@@ -245,7 +246,7 @@ spread_internal_scalar (gfc_array_char *ret, const char *source,
if (ret->base_addr == NULL)
{
- ret->base_addr = internal_malloc_size (ncopies * size);
+ ret->base_addr = xmalloc (ncopies * size);
ret->offset = 0;
GFC_DIMENSION_SET (ret->dim[0], 0, ncopies, size);
}
diff --git a/libgfortran/intrinsics/string_intrinsics_inc.c b/libgfortran/intrinsics/string_intrinsics_inc.c
index 8335a38d949..a1f86b558c8 100644
--- a/libgfortran/intrinsics/string_intrinsics_inc.c
+++ b/libgfortran/intrinsics/string_intrinsics_inc.c
@@ -1,5 +1,5 @@
/* String intrinsics helper functions.
- Copyright 2002, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
+ Copyright 2002, 2005, 2007, 2008, 2009, 2012 Free Software Foundation, Inc.
This file is part of the GNU Fortran runtime library (libgfortran).
@@ -44,9 +44,6 @@ extern void concat_string (gfc_charlen_type, CHARTYPE *,
gfc_charlen_type, const CHARTYPE *);
export_proto(concat_string);
-extern gfc_charlen_type string_len_trim (gfc_charlen_type, const CHARTYPE *);
-export_proto(string_len_trim);
-
extern void adjustl (CHARTYPE *, gfc_charlen_type, const CHARTYPE *);
export_proto(adjustl);
@@ -167,7 +164,7 @@ string_trim (gfc_charlen_type *len, CHARTYPE **dest, gfc_charlen_type slen,
else
{
/* Allocate space for result string. */
- *dest = internal_malloc_size (*len * sizeof (CHARTYPE));
+ *dest = xmalloc (*len * sizeof (CHARTYPE));
/* Copy string if necessary. */
memcpy (*dest, src, *len * sizeof (CHARTYPE));
@@ -445,7 +442,7 @@ string_minmax (gfc_charlen_type *rlen, CHARTYPE **dest, int op, int nargs, ...)
*dest = &zero_length_string;
else
{
- CHARTYPE *tmp = internal_malloc_size (*rlen * sizeof (CHARTYPE));
+ CHARTYPE *tmp = xmalloc (*rlen * sizeof (CHARTYPE));
memcpy (tmp, res, reslen * sizeof (CHARTYPE));
MEMSET (&tmp[reslen], ' ', *rlen - reslen);
*dest = tmp;
diff --git a/libgfortran/intrinsics/transpose_generic.c b/libgfortran/intrinsics/transpose_generic.c
index 4da2d20ea5d..426e7809e61 100644
--- a/libgfortran/intrinsics/transpose_generic.c
+++ b/libgfortran/intrinsics/transpose_generic.c
@@ -60,7 +60,7 @@ transpose_internal (gfc_array_char *ret, gfc_array_char *source)
GFC_DIMENSION_SET (ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0),
GFC_DESCRIPTOR_EXTENT(source, 1) * size);
- ret->base_addr = internal_malloc_size (size * size0 ((array_t*)ret));
+ ret->base_addr = xmalloc (size * size0 ((array_t*)ret));
ret->offset = 0;
}
else if (unlikely (compile_options.bounds_check))
diff --git a/libgfortran/intrinsics/unpack_generic.c b/libgfortran/intrinsics/unpack_generic.c
index 3c5507f8f6b..eabdb9b57c1 100644
--- a/libgfortran/intrinsics/unpack_generic.c
+++ b/libgfortran/intrinsics/unpack_generic.c
@@ -126,7 +126,7 @@ unpack_internal (gfc_array_char *ret, const gfc_array_char *vector,
rs *= extent[n];
}
ret->offset = 0;
- ret->base_addr = internal_malloc_size (rs);
+ ret->base_addr = xmalloc (rs);
}
else
{