Bug ID: 77701
           Summary: suspicious code in go/
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: go
          Assignee: ian at airs dot com
          Reporter: bernd.edlinger at hotmail dot de
                CC: cmang at google dot com
  Target Milestone: ---


now here is also a -Wint-in-bool-context warning:

../../gcc-trunk/gcc/go/ In constructor 'Gcc_backend::Gcc_backend()':
../../gcc-trunk/gcc/go/ error: using integer constants in
boolean context [-Werror=int-in-bool-context]
   tree t = this->integer_type(BITS_PER_UNIT, 1)->get_tree();

the column info is off-by one, but I think it is a bug:

Gcc_backend::integer_type(bool is_unsigned, int bits);

  /* We need to define the fetch_and_add functions, since we use them
     for ++ and --.  */
  tree t = this->integer_type(BITS_PER_UNIT, 1)->get_tree();
  tree p = build_pointer_type(build_qualified_type(t, TYPE_QUAL_VOLATILE));
  this->define_builtin(BUILT_IN_SYNC_ADD_AND_FETCH_1, "__sync_fetch_and_add_1",
                       NULL, build_function_type_list(t, p, t, NULL_TREE),
                       false, false);

  t = this->integer_type(BITS_PER_UNIT * 2, 1)->get_tree();
  p = build_pointer_type(build_qualified_type(t, TYPE_QUAL_VOLATILE));
  this->define_builtin(BUILT_IN_SYNC_ADD_AND_FETCH_2, "__sync_fetch_and_add_2",
                       NULL, build_function_type_list(t, p, t, NULL_TREE),
                       false, false);

parameters seem to be swapped,
the warning did only catch the first instance, because the
expression was not not folded in the C++FE, but all places
look wrong.

Maybe its more easy to swap the parameters at the definition?

Reply via email to