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 | |
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')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/gimple.c | 17 | ||||
-rw-r--r-- | gcc/gimple.h | 4 |
3 files changed, 19 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 730e8ed..70fff29 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,12 @@ 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. + +2018-01-12 Martin Liska <mliska@suse.cz> + * tree-core.h: Use uint64_t instead of int. * tree.c (tree_node_counts): Likewise. (tree_node_sizes): Likewise. 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"); } diff --git a/gcc/gimple.h b/gcc/gimple.h index 8c0e9ae..281015a 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -6386,8 +6386,8 @@ enum gimple_alloc_kind gimple_alloc_kind_all }; -extern int gimple_alloc_counts[]; -extern int gimple_alloc_sizes[]; +extern uint64_t gimple_alloc_counts[]; +extern uint64_t gimple_alloc_sizes[]; /* Return the allocation kind for a given stmt CODE. */ static inline enum gimple_alloc_kind |