diff options
author | Martin Liska <mliska@suse.cz> | 2018-01-12 15:47:26 +0100 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2018-01-12 14:47:26 +0000 |
commit | 33b366c3d4e96c37b60d440edff64f915cc1aaaf (patch) | |
tree | d74c032a2ed76fefc4ee3ce3417b5d327e3b0f01 /gcc/gimple.c | |
parent | 00e4d22dc1e8224e090be6dac970fe583e8f39ac (diff) | |
download | gcc-33b366c3d4e96c37b60d440edff64f915cc1aaaf.zip gcc-33b366c3d4e96c37b60d440edff64f915cc1aaaf.tar.gz gcc-33b366c3d4e96c37b60d440edff64f915cc1aaaf.tar.bz2 |
Fix integer overflow in stats of GIMPLE statements.
2018-01-12 Martin Liska <mliska@suse.cz>
* gimple.c (gimple_alloc_counts): Use uint64_t instead of int.
(gimple_alloc_sizes): Likewise.
(dump_gimple_statistics): Use PRIu64 in printf format.
* gimple.h: Change uint64_t to int.
From-SVN: r256584
Diffstat (limited to 'gcc/gimple.c')
-rw-r--r-- | gcc/gimple.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/gcc/gimple.c b/gcc/gimple.c index e24b9fd..c1b7229 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -77,8 +77,8 @@ EXPORTED_CONST enum gimple_statement_structure_enum gss_for_code_[] = { /* Gimple stats. */ -int gimple_alloc_counts[(int) gimple_alloc_kind_all]; -int gimple_alloc_sizes[(int) gimple_alloc_kind_all]; +uint64_t gimple_alloc_counts[(int) gimple_alloc_kind_all]; +uint64_t gimple_alloc_sizes[(int) gimple_alloc_kind_all]; /* Keep in sync with gimple.h:enum gimple_alloc_kind. */ static const char * const gimple_alloc_kind_names[] = { @@ -2057,11 +2057,12 @@ gimple_assign_rhs_could_trap_p (gimple *s) void dump_gimple_statistics (void) { - int i, total_tuples = 0, total_bytes = 0; + int i; + uint64_t total_tuples = 0, total_bytes = 0; if (! GATHER_STATISTICS) { - fprintf (stderr, "No gimple statistics\n"); + fprintf (stderr, "No GIMPLE statistics\n"); return; } @@ -2070,13 +2071,15 @@ dump_gimple_statistics (void) fprintf (stderr, "---------------------------------------\n"); for (i = 0; i < (int) gimple_alloc_kind_all; ++i) { - fprintf (stderr, "%-20s %7d %10d\n", gimple_alloc_kind_names[i], - gimple_alloc_counts[i], gimple_alloc_sizes[i]); + fprintf (stderr, "%-20s %7" PRIu64 " %10" PRIu64 "\n", + gimple_alloc_kind_names[i], gimple_alloc_counts[i], + gimple_alloc_sizes[i]); total_tuples += gimple_alloc_counts[i]; total_bytes += gimple_alloc_sizes[i]; } fprintf (stderr, "---------------------------------------\n"); - fprintf (stderr, "%-20s %7d %10d\n", "Total", total_tuples, total_bytes); + fprintf (stderr, "%-20s %7" PRIu64 " %10" PRIu64 "\n", "Total", + total_tuples, total_bytes); fprintf (stderr, "---------------------------------------\n"); } |