PR26410, UBSAN: symbols.c:1818

Don't memset(0,0,0).

	PR 26410
	* symbols.c (dollar_label_count, dollar_label_max): Make size_t.
	(dollar_label_clear): Don't call memset with NULL pointer.
This commit is contained in:
Alan Modra 2020-08-25 14:51:21 +09:30
parent ca159256b4
commit 30b940a097
2 changed files with 10 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2020-08-25 Alan Modra <amodra@gmail.com>
PR 26410
* symbols.c (dollar_label_count, dollar_label_max): Make size_t.
(dollar_label_clear): Don't call memset with NULL pointer.
2020-08-25 Alan Modra <amodra@gmail.com>
* config/tc-arc.c (declare_register_set): Avoid false positive

View File

@ -1761,8 +1761,8 @@ snapshot_symbol (symbolS **symbolPP, valueT *valueP, segT *segP, fragS **fragPP)
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)
@ -1798,7 +1798,8 @@ dollar_label_instance (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