Project

General

Profile

Actions

Bug #5083

closed

avoid undefined order of operations in assignments

Added by Rich Lowe almost 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Start date:
2014-08-12
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:

Description

In several places in our tree we have code which has undefined behaviour because it mutates on both sides of an assignment (which is not a sequence point).

Some are simple dual assignments:

foo = foo = 0

Others are actually convoluted:

(*ldvp) = ++*ldvp;

We should do neither.

Problems are:

usr/src/cmd/fs.d/ufs/mkfs/
usr/src/cmd/mdb/intel/modules/generic_cpu/
usr/src/cmd/scadm/sparc/mpxu/
usr/src/cmd/troff/
usr/src/uts/common/io/hxge/
usr/src/uts/common/io/ib/adapters/hermon/
usr/src/uts/common/io/ib/adapters/tavor/
usr/src/uts/common/io/nxge/
usr/src/uts/intel/io/dktp/
usr/src/uts/sun4u/serengeti/io/sghsc.c
Actions #1

Updated by Electric Monk over 7 years ago

  • Status changed from New to Closed
  • % Done changed from 80 to 100

git commit 2bc987325e3ded1865bff043128661815c4690b9

commit  2bc987325e3ded1865bff043128661815c4690b9
Author: Richard Lowe <richlowe@richlowe.net>
Date:   2014-08-29T16:13:11.000Z

    5083 avoid undefined order of operations in assignments
    Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
    Reviewed by: Jason King <jason.brian.king@gmail.com>
    Reviewed by: Dan McDonald <danmcd@omniti.com>
    Approved by: Dan McDonald <danmcd@omniti.com>

Actions

Also available in: Atom PDF