[all-commits] [llvm/llvm-project] 1d13c5: Revert (and fix properly) "Uninitialize the file d...

Mircea Trofin via All-commits all-commits at lists.llvm.org
Wed Feb 1 17:45:06 PST 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1d13c5ec47664ab123f0cf02b349a271e5b446ab
  Author: Mircea Trofin <mtrofin at google.com>
  Date:   2023-02-01 (Wed, 01 Feb 2023)

  Changed paths:
    M llvm/include/llvm/Analysis/InteractiveModelRunner.h

  Log Message:
  Revert (and fix properly) "Uninitialize the file descriptor."

This reverts commit f514b0e144db063931d19a8ebc2dc42083d0eb2f.

The culprit is that InEC is initialized before Inbound, and Inbound's
initialization happens through a call to openFileForRead. However, the
typical initialization order warnings don't fire; so the behavior was:
Inbound is initialized correctly by openFileForRead; then it's reset to
whatever initializer value (0 originally).

A fix is to move Inbound's decl upfront. I'd still prefer initializing
it to something - and -1 seems like a more appropriate value (it causes
a fail-fast rather than a hang due to trying to read from a
valid-looking but unopen fd).

More information about the All-commits mailing list