#include "subsegs.h"
#include "write.h"
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#ifndef CHAR_BIT
+#define CHAR_BIT 8
+#endif
+
struct symbol_flags
{
/* Whether the symbol is a local_symbol. */
++local_symbol_conversion_count;
- xtra = (struct xsymbol *) obstack_alloc (¬es, sizeof *xtra);
+ xtra = (struct xsymbol *) obstack_alloc (¬es, sizeof (*xtra));
+ memset (xtra, 0, sizeof (*xtra));
val = ent->lsy.value;
ent->sy.x = xtra;
right = 1;
}
+ if ((op == O_left_shift || op == O_right_shift)
+ && (valueT) right >= sizeof (valueT) * CHAR_BIT)
+ {
+ as_warn_value_out_of_range (_("shift count"), right, 0,
+ sizeof (valueT) * CHAR_BIT - 1,
+ NULL, 0);
+ left = right = 0;
+ }
switch (symp->x->value.X_op)
{
case O_multiply: left *= right; break;
case O_divide: left /= right; break;
case O_modulus: left %= right; break;
- case O_left_shift: left <<= right; break;
- case O_right_shift: left >>= right; break;
+ case O_left_shift:
+ left = (valueT) left << (valueT) right; break;
+ case O_right_shift:
+ left = (valueT) left >> (valueT) right; break;
case O_bit_inclusive_or: left |= right; break;
case O_bit_or_not: left |= ~right; break;
case O_bit_exclusive_or: left ^= right; break;
static long *dollar_labels;
static long *dollar_label_instances;
static char *dollar_label_defines;
-static unsigned long dollar_label_count;
-static unsigned long dollar_label_max;
+static size_t dollar_label_count;
+static size_t dollar_label_max;
int
dollar_label_defined (long label)
void
dollar_label_clear (void)
{
- memset (dollar_label_defines, '\0', (unsigned int) dollar_label_count);
+ if (dollar_label_count)
+ memset (dollar_label_defines, '\0', dollar_label_count);
}
#define DOLLAR_LABEL_BUMP_BY 10