compiler: initialize gogo fields
authorIan Lance Taylor <ian@gcc.gnu.org>
Wed, 22 Mar 2017 21:02:53 +0000 (21:02 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 22 Mar 2017 21:02:53 +0000 (21:02 +0000)
    A couple of the data members in the Gogo class were not
    being initialized properly. This was causing "uninitialized value"
    errors during Valgrind memcheck runs. This patch insures that
    all of the fields receive an initial value.

    Reviewed-on: https://go-review.googlesource.com/38470

From-SVN: r246407

gcc/go/gofrontend/go.cc
gcc/go/gofrontend/gogo.cc

index e0e84e3adc2510bf019c2fb715a19ce82d49896a..7050accbc5e33dc631bc006d9228ac1c1c1bd89f 100644 (file)
@@ -34,10 +34,8 @@ go_create_gogo(const struct go_create_gogo_args* args)
 
   if (args->relative_import_path != NULL)
     ::gogo->set_relative_import_path(args->relative_import_path);
-  if (args->check_divide_by_zero)
-    ::gogo->set_check_divide_by_zero(args->check_divide_by_zero);
-  if (args->check_divide_overflow)
-    ::gogo->set_check_divide_overflow(args->check_divide_overflow);
+  ::gogo->set_check_divide_by_zero(args->check_divide_by_zero);
+  ::gogo->set_check_divide_overflow(args->check_divide_overflow);
   if (args->compiling_runtime)
     ::gogo->set_compiling_runtime(args->compiling_runtime);
   if (args->c_header != NULL)
index c5ce5d9ecec9c0152e8ec13437dec6ff67c7a306..a190917512a2abf8df765c8f99ff48a6467a90ef 100644 (file)
@@ -50,6 +50,11 @@ Gogo::Gogo(Backend* backend, Linemap* linemap, int, int pointer_size)
     pkgpath_from_option_(false),
     prefix_from_option_(false),
     relative_import_path_(),
+    c_header_(),
+    check_divide_by_zero_(true),
+    check_divide_overflow_(true),
+    compiling_runtime_(false),
+    debug_escape_level_(0),
     verify_types_(),
     interface_types_(),
     specific_type_functions_(),