[cfe-users] scan-build: False positive "Assigned value is garbage or undefined" warning on open() result

Kyle Edwards via cfe-users cfe-users at lists.llvm.org
Mon Jan 14 14:15:00 PST 2019


Hello all,

CMake upstream here. After upgrading to clang 6 scan-build, we're
seeing a rather odd warning in our in-source libuv build. It's
complaining about "Assigned value is garbage or undefined" after
calling open() and comparing it to "== -1" rather than "< 0", but only
in this one particular call.

You can see the warning at https://open.cdash.org/viewBuildError.php?ty
pe=1&buildid=5707465 . This warning also appears when building libuv on
its own.

I've opened a PR on libuv upstream ( https://github.com/libuv/libuv/pul
l/2140 ) which fixes the warning, but what I don't understand is why
this is the only place where this appears - there are lots of other
places where open() is called and compared against -1, but they don't
trigger the warning. I also have not been able to come up with a
minimal reproducible example.

Anyone have any insight as to why this might be happening?

(I am not subscribed to this list, so please be sure to CC me in your
replies.)

Kyle



More information about the cfe-users mailing list