@@ -887,13 +887,13 @@ $(i_any_c): m4/any.m4 $(I_M4_DEPS2)
$(i_count_c): m4/count.m4 $(I_M4_DEPS2)
$(M4) -Dfile=$@ -I$(srcdir)/m4 count.m4 > $@
-$(i_iall_c): m4/iall.m4 $(I_M4_DEPS)
+$(i_iall_c): m4/iall.m4 $(I_M4_DEPS1)
$(M4) -Dfile=$@ -I$(srcdir)/m4 iall.m4 > $@
-$(i_iany_c): m4/iany.m4 $(I_M4_DEPS)
+$(i_iany_c): m4/iany.m4 $(I_M4_DEPS1)
$(M4) -Dfile=$@ -I$(srcdir)/m4 iany.m4 > $@
-$(i_iparity_c): m4/iparity.m4 $(I_M4_DEPS)
+$(i_iparity_c): m4/iparity.m4 $(I_M4_DEPS1)
$(M4) -Dfile=$@ -I$(srcdir)/m4 iparity.m4 > $@
$(i_maxloc0_c): m4/maxloc0.m4 $(I_M4_DEPS0)
@@ -926,10 +926,10 @@ $(i_matmul_c): m4/matmul.m4 $(I_M4_DEPS)
$(i_matmull_c): m4/matmull.m4 $(I_M4_DEPS)
$(M4) -Dfile=$@ -I$(srcdir)/m4 matmull.m4 > $@
-$(i_norm2_c): m4/norm2.m4 $(I_M4_DEPS)
+$(i_norm2_c): m4/norm2.m4 $(I_M4_DEPS1)
$(M4) -Dfile=$@ -I$(srcdir)/m4 norm2.m4 > $@
-$(i_parity_c): m4/parity.m4 $(I_M4_DEPS)
+$(i_parity_c): m4/parity.m4 $(I_M4_DEPS1)
$(M4) -Dfile=$@ -I$(srcdir)/m4 parity.m4 > $@
$(i_transpose_c): m4/transpose.m4 $(I_M4_DEPS)
@@ -79,8 +79,8 @@ cshift0 (gfc_array_char * ret, const gfc_array_char * array,
GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
}
- /* 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))
{
@@ -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);
@@ -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) +
@@ -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))
{
@@ -91,8 +91,8 @@ eoshift2 (gfc_array_char *ret, const gfc_array_char *array,
GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
- /* 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);
}
}
@@ -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;
@@ -153,8 +153,8 @@ pack_internal (gfc_array_char *ret, const gfc_array_char *array,
GFC_DIMENSION_SET(ret->dim[0], 0, total-1, 1);
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;
@@ -103,7 +103,7 @@ reshape_internal (parray *ret, parray *source, shape_type *shape,
else
alloc_size = rs * size;
- ret->base_addr = internal_malloc_size (alloc_size);
+ ret->base_addr = xmalloc (alloc_size);
ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
}
@@ -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, ub, stride);
}
ret->offset = 0;
- ret->base_addr = internal_malloc_size (rs * size);
+ ret->base_addr = xmalloc (rs * size);
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 - 1, 1);
}
@@ -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).
@@ -167,7 +167,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 +445,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;
@@ -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) - 1,
GFC_DESCRIPTOR_EXTENT(source, 1));
- 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))
@@ -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 * size);
+ ret->base_addr = xmalloc (rs * size);
}
else
{
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+/* Copyright (C) 2008, 2009, 2010, 2012 Free Software Foundation, Inc.
Contributed by Janne Blomqvist
This file is part of the GNU Fortran runtime library (libgfortran).
@@ -39,8 +39,8 @@ fbuf_init (gfc_unit * u, int len)
if (len == 0)
len = 512; /* Default size. */
- u->fbuf = get_mem (sizeof (struct fbuf));
- u->fbuf->buf = get_mem (len);
+ u->fbuf = xmalloc (sizeof (struct fbuf));
+ u->fbuf->buf = xmalloc (len);
u->fbuf->len = len;
u->fbuf->act = u->fbuf->pos = 0;
}
@@ -1,4 +1,5 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
+ 2012
Free Software Foundation, Inc.
Contributed by Andy Vaught
F2003 I/O support contributed by Jerry DeLisle
@@ -150,7 +151,7 @@ save_parsed_format (st_parameter_dt *dtp)
u->format_hash_table[hash].hashed_fmt = NULL;
free (u->format_hash_table[hash].key);
- u->format_hash_table[hash].key = get_mem (dtp->format_len);
+ u->format_hash_table[hash].key = xmalloc (dtp->format_len);
memcpy (u->format_hash_table[hash].key, dtp->format, dtp->format_len);
u->format_hash_table[hash].key_len = dtp->format_len;
@@ -223,7 +224,7 @@ get_fnode (format_data *fmt, fnode **head, fnode **tail, format_token t)
if (fmt->avail == &fmt->last->array[FARRAY_SIZE])
{
- fmt->last->next = get_mem (sizeof (fnode_array));
+ fmt->last->next = xmalloc (sizeof (fnode_array));
fmt->last = fmt->last->next;
fmt->last->next = NULL;
fmt->avail = &fmt->last->array[0];
@@ -1225,7 +1226,7 @@ parse_format (st_parameter_dt *dtp)
/* Not found so proceed as follows. */
- dtp->u.p.fmt = fmt = get_mem (sizeof (format_data));
+ dtp->u.p.fmt = fmt = xmalloc (sizeof (format_data));
fmt->format_string = dtp->format;
fmt->format_string_len = dtp->format_len;
@@ -1,6 +1,6 @@
/* Implementation of the FGET, FGETC, FPUT, FPUTC, FLUSH
FTELL, TTYNAM and ISATTY intrinsics.
- Copyright (C) 2005, 2007, 2009, 2010, 2011 Free Software
+ Copyright (C) 2005, 2007, 2009, 2010, 2011, 2012 Free Software
Foundation, Inc.
This file is part of the GNU Fortran runtime library (libgfortran).
@@ -380,7 +380,7 @@ ttynam (char ** name, gfc_charlen_type * name_len, int unit)
u = find_unit (unit);
if (u != NULL)
{
- *name = get_mem (TTY_NAME_MAX);
+ *name = xmalloc (TTY_NAME_MAX);
int err = stream_ttyname (u->s, *name, TTY_NAME_MAX);
if (err == 0)
{
@@ -2282,7 +2282,7 @@ nml_touch_nodes (namelist_info * nl)
{
index_type len = strlen (nl->var_name) + 1;
int dim;
- char * ext_name = (char*)get_mem (len + 1);
+ char * ext_name = (char*)xmalloc (len + 1);
memcpy (ext_name, nl->var_name, len-1);
memcpy (ext_name + len - 1, "%", 2);
for (nl = nl->next; nl; nl = nl->next)
@@ -2540,7 +2540,7 @@ nml_read_obj (st_parameter_dt *dtp, namelist_info * nl, index_type offset,
case BT_DERIVED:
obj_name_len = strlen (nl->var_name) + 1;
- obj_name = get_mem (obj_name_len+1);
+ obj_name = xmalloc (obj_name_len+1);
memcpy (obj_name, nl->var_name, obj_name_len-1);
memcpy (obj_name + obj_name_len - 1, "%", 2);
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
+/* Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
Contributed by Andy Vaught
F2003 I/O support contributed by Jerry DeLisle
@@ -538,7 +538,7 @@ new_unit (st_parameter_open *opp, gfc_unit *u, unit_flags * flags)
/* Create the unit structure. */
- u->file = get_mem (opp->file_len);
+ u->file = xmalloc (opp->file_len);
if (u->unit_number != opp->common.unit)
internal_error (&opp->common, "Unit number changed");
u->s = s;
@@ -3650,11 +3650,11 @@ st_set_nml_var (st_parameter_dt *dtp, void * var_addr, char * var_name,
namelist_info *nml;
size_t var_name_len = strlen (var_name);
- nml = (namelist_info*) get_mem (sizeof (namelist_info));
+ nml = (namelist_info*) xmalloc (sizeof (namelist_info));
nml->mem_pos = var_addr;
- nml->var_name = (char*) get_mem (var_name_len + 1);
+ nml->var_name = (char*) xmalloc (var_name_len + 1);
memcpy (nml->var_name, var_name, var_name_len);
nml->var_name[var_name_len] = '\0';
@@ -3668,9 +3668,9 @@ st_set_nml_var (st_parameter_dt *dtp, void * var_addr, char * var_name,
if (nml->var_rank > 0)
{
nml->dim = (descriptor_dimension*)
- get_mem (nml->var_rank * sizeof (descriptor_dimension));
+ xmalloc (nml->var_rank * sizeof (descriptor_dimension));
nml->ls = (array_loop_spec*)
- get_mem (nml->var_rank * sizeof (array_loop_spec));
+ xmalloc (nml->var_rank * sizeof (array_loop_spec));
}
else
{
@@ -409,7 +409,7 @@ get_internal_unit (st_parameter_dt *dtp)
{
iunit->rank = GFC_DESCRIPTOR_RANK (dtp->internal_unit_desc);
iunit->ls = (array_loop_spec *)
- get_mem (iunit->rank * sizeof (array_loop_spec));
+ xmalloc (iunit->rank * sizeof (array_loop_spec));
dtp->internal_unit_len *=
init_loop_spec (dtp->internal_unit_desc, iunit->ls, &start_record);
@@ -542,7 +542,7 @@ init_units (void)
u->endfile = NO_ENDFILE;
u->file_len = strlen (stdin_name);
- u->file = get_mem (u->file_len);
+ u->file = xmalloc (u->file_len);
memmove (u->file, stdin_name, u->file_len);
fbuf_init (u, 0);
@@ -572,7 +572,7 @@ init_units (void)
u->endfile = AT_ENDFILE;
u->file_len = strlen (stdout_name);
- u->file = get_mem (u->file_len);
+ u->file = xmalloc (u->file_len);
memmove (u->file, stdout_name, u->file_len);
fbuf_init (u, 0);
@@ -602,7 +602,7 @@ init_units (void)
u->endfile = AT_ENDFILE;
u->file_len = strlen (stderr_name);
- u->file = get_mem (u->file_len);
+ u->file = xmalloc (u->file_len);
memmove (u->file, stderr_name, u->file_len);
fbuf_init (u, 256); /* 256 bytes should be enough, probably not doing
@@ -759,7 +759,7 @@ filename_from_unit (int n)
/* Get the filename. */
if (u != NULL)
{
- filename = (char *) get_mem (u->file_len + 1);
+ filename = (char *) xmalloc (u->file_len + 1);
unpack_filename (filename, u->file, u->file_len);
return filename;
}
@@ -639,7 +639,7 @@ buf_init (unix_stream * s)
{
s->st.vptr = &buf_vtable;
- s->buffer = get_mem (BUFFER_SIZE);
+ s->buffer = xmalloc (BUFFER_SIZE);
return 0;
}
@@ -1082,7 +1082,7 @@ tempfile (st_parameter_open *opp)
slash = "";
// Take care that the template is longer in the mktemp() branch.
- template = get_mem (tempdirlen + 23);
+ template = xmalloc (tempdirlen + 23);
#ifdef HAVE_MKSTEMP
snprintf (template, tempdirlen + 23, "%s%sgfortrantmpXXXXXX",
@@ -1,4 +1,5 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
+ 2012
Free Software Foundation, Inc.
Contributed by Andy Vaught
Namelist output contributed by Paul Thomas
@@ -1864,7 +1865,7 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset,
base_var_name_len = base ? strlen (base->var_name) : 0;
ext_name_len = base_name_len + base_var_name_len
+ strlen (obj->var_name) + obj->var_rank * NML_DIGITS + 1;
- ext_name = (char*)get_mem (ext_name_len);
+ ext_name = (char*)xmalloc (ext_name_len);
memcpy (ext_name, base_name, base_name_len);
clen = strlen (obj->var_name + base_var_name_len);
@@ -1893,7 +1894,7 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset,
/* Now obj_name. */
obj_name_len = strlen (obj->var_name) + 1;
- obj_name = get_mem (obj_name_len+1);
+ obj_name = xmalloc (obj_name_len+1);
memcpy (obj_name, obj->var_name, obj_name_len-1);
memcpy (obj_name + obj_name_len-1, "%", 2);
@@ -753,11 +753,8 @@ internal_proto(set_fpu);
/* memory.c */
-extern void *get_mem (size_t) __attribute__ ((malloc));
-internal_proto(get_mem);
-
-extern void *internal_malloc_size (size_t) __attribute__ ((malloc));
-internal_proto(internal_malloc_size);
+extern void *xmalloc (size_t) __attribute__ ((malloc));
+internal_proto(xmalloc);
extern void *xcalloc (size_t, size_t) __attribute__ ((malloc));
internal_proto(xcalloc);
@@ -56,7 +56,7 @@ bessel_jn_r'rtype_kind` ('rtype` * const restrict ret, int n1, int n2, 'rtype_na
{
size_t size = n2 < n1 ? 0 : n2-n1+1;
GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1);
- ret->base_addr = internal_malloc_size (sizeof ('rtype_name`) * size);
+ ret->base_addr = xmalloc (sizeof ('rtype_name`) * size);
ret->offset = 0;
}
@@ -123,7 +123,7 @@ bessel_yn_r'rtype_kind` ('rtype` * const restrict ret, int n1, int n2,
{
size_t size = n2 < n1 ? 0 : n2-n1+1;
GFC_DIMENSION_SET(ret->dim[0], 0, size-1, 1);
- ret->base_addr = internal_malloc_size (sizeof ('rtype_name`) * size);
+ ret->base_addr = xmalloc (sizeof ('rtype_name`) * size);
ret->offset = 0;
}
@@ -81,7 +81,7 @@ cshift1 (gfc_array_char * const restrict ret,
{
int i;
- ret->base_addr = internal_malloc_size (size * arraysize);
+ ret->base_addr = xmalloc (size * arraysize);
ret->offset = 0;
ret->dtype = array->dtype;
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
@@ -106,8 +106,8 @@ eoshift1 (gfc_array_char * const restrict ret,
GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
}
- /* 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))
@@ -90,7 +90,7 @@ eoshift3 (gfc_array_char * const restrict ret,
{
int i;
- ret->base_addr = internal_malloc_size (size * arraysize);
+ ret->base_addr = xmalloc (size * arraysize);
ret->offset = 0;
ret->dtype = array->dtype;
for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
@@ -108,8 +108,8 @@ eoshift3 (gfc_array_char * const restrict ret,
GFC_DIMENSION_SET(ret->dim[i], 0, ub, str);
}
- /* 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))
@@ -30,7 +30,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
retarray->offset = 0;
- retarray->base_addr = internal_malloc_size (sizeof (rtype_name) * rank);
+ retarray->base_addr = xmalloc (sizeof (rtype_name) * rank);
}
else
{
@@ -133,7 +133,7 @@ void
GFC_DIMENSION_SET(retarray->dim[0], 0, rank - 1, 1);
retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
retarray->offset = 0;
- retarray->base_addr = internal_malloc_size (sizeof (rtype_name) * rank);
+ retarray->base_addr = xmalloc (sizeof (rtype_name) * rank);
}
else
{
@@ -264,7 +264,7 @@ void
GFC_DIMENSION_SET(retarray->dim[0], 0, rank-1, 1);
retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
retarray->offset = 0;
- retarray->base_addr = internal_malloc_size (sizeof (rtype_name) * rank);
+ retarray->base_addr = xmalloc (sizeof (rtype_name) * rank);
}
else if (unlikely (compile_options.bounds_check))
{
@@ -88,7 +88,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
alloc_size = sizeof (rtype_name) * GFC_DESCRIPTOR_STRIDE(retarray,rank-1)
* extent[rank-1];
- retarray->base_addr = internal_malloc_size (alloc_size);
+ retarray->base_addr = xmalloc (alloc_size);
if (alloc_size == 0)
{
/* Make sure we have a zero-sized array. */
@@ -273,7 +273,7 @@ void
return;
}
else
- retarray->base_addr = internal_malloc_size (alloc_size);
+ retarray->base_addr = xmalloc (alloc_size);
}
else
@@ -432,7 +432,7 @@ void
return;
}
else
- retarray->base_addr = internal_malloc_size (alloc_size);
+ retarray->base_addr = xmalloc (alloc_size);
}
else
{
@@ -99,7 +99,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
return;
}
else
- retarray->base_addr = internal_malloc_size (alloc_size);
+ retarray->base_addr = xmalloc (alloc_size);
}
else
{
@@ -79,7 +79,7 @@ internal_pack_'rtype_ccode` ('rtype` * source)
return source->base_addr;
/* Allocate storage for the destination. */
- destptr = ('rtype_name` *)internal_malloc_size (ssize * sizeof ('rtype_name`));
+ destptr = ('rtype_name` *)xmalloc (ssize * sizeof ('rtype_name`));
dest = destptr;
src = source->base_addr;
stride0 = stride[0];
@@ -125,7 +125,7 @@ matmul_'rtype_code` ('rtype` * const restrict retarray,
}
retarray->base_addr
- = internal_malloc_size (sizeof ('rtype_name`) * size0 ((array_t *) retarray));
+ = xmalloc (sizeof ('rtype_name`) * size0 ((array_t *) retarray));
retarray->offset = 0;
}
else if (unlikely (compile_options.bounds_check))
@@ -89,7 +89,7 @@ matmul_'rtype_code` ('rtype` * const restrict retarray,
}
retarray->base_addr
- = internal_malloc_size (sizeof ('rtype_name`) * size0 ((array_t *) retarray));
+ = xmalloc (sizeof ('rtype_name`) * size0 ((array_t *) retarray));
retarray->offset = 0;
}
else if (unlikely (compile_options.bounds_check))
@@ -169,8 +169,8 @@ pack_'rtype_code` ('rtype` *ret, const 'rtype` *array,
ret->offset = 0;
- /* internal_malloc_size allocates a single byte for zero size. */
- ret->base_addr = internal_malloc_size (sizeof ('rtype_name`) * total);
+ /* xmalloc allocates a single byte for zero size. */
+ ret->base_addr = xmalloc (sizeof ('rtype_name`) * total);
if (total == 0)
return;
@@ -1,5 +1,5 @@
-`/* Implementation of the NORM2 intrinsic
- Copyright 2010 Free Software Foundation, Inc.
+`/* Implementation of the PARITY intrinsic
+ Copyright 2010, 2012 Free Software Foundation, Inc.
Contributed by Tobias Burnus <burnus@net-b.de>
This file is part of the GNU Fortran runtime library (libgfortran).
@@ -119,7 +119,7 @@ reshape_'rtype_ccode` ('rtype` * const restrict ret,
else
alloc_size = rs * sizeof ('rtype_name`);
- ret->base_addr = internal_malloc_size (alloc_size);
+ ret->base_addr = xmalloc (alloc_size);
ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
}
@@ -50,7 +50,7 @@ shape_'rtype_kind` ('rtype` * const restrict ret,
{
GFC_DIMENSION_SET(ret->dim[0], 0, rank - 1, 1);
ret->offset = 0;
- ret->base_addr = internal_malloc_size (sizeof ('rtype_name`) * rank);
+ ret->base_addr = xmalloc (sizeof ('rtype_name`) * rank);
}
stride = GFC_DESCRIPTOR_STRIDE(ret,0);
@@ -102,8 +102,8 @@ spread_'rtype_code` ('rtype` *ret, const 'rtype` *source,
}
ret->offset = 0;
- /* internal_malloc_size allocates a single byte for zero size. */
- ret->base_addr = internal_malloc_size (rs * sizeof('rtype_name`));
+ /* xmalloc allocates a single byte for zero size. */
+ ret->base_addr = xmalloc (rs * sizeof('rtype_name`));
if (rs <= 0)
return;
}
@@ -245,7 +245,7 @@ spread_scalar_'rtype_code` ('rtype` *ret, const 'rtype_name` *source,
if (ret->base_addr == NULL)
{
- ret->base_addr = internal_malloc_size (ncopies * sizeof ('rtype_name`));
+ ret->base_addr = xmalloc (ncopies * sizeof ('rtype_name`));
ret->offset = 0;
GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
}
@@ -61,7 +61,7 @@ transpose_'rtype_code` ('rtype` * const restrict ret,
GFC_DIMENSION_SET(ret->dim[1], 0, GFC_DESCRIPTOR_EXTENT(source,0) - 1,
GFC_DESCRIPTOR_EXTENT(source, 1));
- ret->base_addr = internal_malloc_size (sizeof ('rtype_name`) * size0 ((array_t *) ret));
+ ret->base_addr = xmalloc (sizeof ('rtype_name`) * size0 ((array_t *) ret));
ret->offset = 0;
} else if (unlikely (compile_options.bounds_check))
{
@@ -100,7 +100,7 @@ unpack0_'rtype_code` ('rtype` *ret, const 'rtype` *vector,
rs *= extent[n];
}
ret->offset = 0;
- ret->base_addr = internal_malloc_size (rs * sizeof ('rtype_name`));
+ ret->base_addr = xmalloc (rs * sizeof ('rtype_name`));
}
else
{
@@ -245,7 +245,7 @@ unpack1_'rtype_code` ('rtype` *ret, const 'rtype` *vector,
rs *= extent[n];
}
ret->offset = 0;
- ret->base_addr = internal_malloc_size (rs * sizeof ('rtype_name`));
+ ret->base_addr = xmalloc (rs * sizeof ('rtype_name`));
}
else
{
@@ -1,5 +1,5 @@
/* Runtime conversion of strings from one character kind to another.
- Copyright 2008, 2009 Free Software Foundation, Inc.
+ Copyright 2008, 2009, 2012 Free Software Foundation, Inc.
This file is part of the GNU Fortran runtime library (libgfortran).
@@ -44,7 +44,7 @@ convert_char1_to_char4 (gfc_char4_t **dst, gfc_charlen_type len,
gfc_charlen_type i, l;
l = len > 0 ? len : 0;
- *dst = get_mem ((l + 1) * sizeof (gfc_char4_t));
+ *dst = xmalloc ((l + 1) * sizeof (gfc_char4_t));
for (i = 0; i < l; i++)
(*dst)[i] = src[i];
@@ -60,7 +60,7 @@ convert_char4_to_char1 (unsigned char **dst, gfc_charlen_type len,
gfc_charlen_type i, l;
l = len > 0 ? len : 0;
- *dst = get_mem ((l + 1) * sizeof (unsigned char));
+ *dst = xmalloc ((l + 1) * sizeof (unsigned char));
for (i = 0; i < l; i++)
(*dst)[i] = src[i];
@@ -1,7 +1,8 @@
-/* Copyright (C) 2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005, 2007, 2009, 2012
+ Free Software Foundation, Inc.
Contributed by Andy Vaught
-This file is part of the GNU Fortran 95 runtime library (libgfortran).
+This file is part of the GNU Fortran runtime library (libgfortran).
Libgfortran is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -807,7 +808,7 @@ void init_unformatted (variable * v)
}
else
{
- elist = get_mem (unit_count * sizeof (exception_t));
+ elist = xmalloc (unit_count * sizeof (exception_t));
do_count = 0;
p = val;
do_parse ();
@@ -178,7 +178,7 @@ internal_pack (gfc_array_char * source)
return source->base_addr;
/* Allocate storage for the destination. */
- destptr = internal_malloc_size (ssize * size);
+ destptr = xmalloc (ssize * size);
dest = (char *)destptr;
src = source->base_addr;
stride0 = stride[0] * size;
@@ -27,22 +27,17 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "libgfortran.h"
#include <stdlib.h>
-/* If GFC_CLEAR_MEMORY is defined, the memory allocation routines will
- return memory that is guaranteed to be set to zero. This can have
- a severe efficiency penalty, so it should never be set if good
- performance is desired, but it can help when you're debugging code. */
-/* #define GFC_CLEAR_MEMORY */
void *
-get_mem (size_t n)
+xmalloc (size_t n)
{
void *p;
-#ifdef GFC_CLEAR_MEMORY
- p = (void *) calloc (1, n);
-#else
- p = (void *) malloc (n);
-#endif
+ if (n == 0)
+ n = 1;
+
+ p = malloc (n);
+
if (p == NULL)
os_error ("Memory allocation failed");
@@ -50,18 +45,6 @@ get_mem (size_t n)
}
-/* Allocate memory for internal (compiler generated) use. */
-
-void *
-internal_malloc_size (size_t size)
-{
- if (unlikely (size == 0))
- size = 1;
-
- return get_mem (size);
-}
-
-
/* calloc wrapper that aborts on error. */
void *