Dead loop on aarch64 platform

Open
#536 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp

Research direction

Start with the EOF comparisons in src/ext/env.cpp, then review the related comparisons in src/ext/cmd.cpp and reproduce the aarch64 build warnings. Trace the environment argument loops to determine why env.cpp can fail to terminate. Done means the aarch64 build no longer reports these tautological comparisons and the environment handling no longer dead-loops.

Written by the indexing model from the issue text.

Description

There are some tautological-constant-out-of-range-compare warnings on aarch64 platform, because char is an unsigned type on it. src/ext/cmd.cpp is fine because result is still correct in this situation, but src/ext/env.cpp doesn't work well.

external/boost/libs/process/src/ext/cmd.cpp:222:28: error: result of comparison of constant -1 with expression of type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' (aka 'char') is always true [-Werror,-Wtautological-constant-out-of-range-compare]
    while (procargs.back() != EOF)
           ~~~~~~~~~~~~~~~ ^  ~~~
external/boost/libs/process/src/ext/cmd.cpp:240:25: error: result of comparison of constant -1 with expression of type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' (aka 'char') is always false [-Werror,-Wtautological-constant-out-of-range-compare]
    if (procargs.back() == EOF)
        ~~~~~~~~~~~~~~~ ^  ~~~

external/boost/libs/process/src/ext/env.cpp:130:16: error: result of comparison of constant -1 with expression of type 'char' is always true [-Werror,-Wtautological-constant-out-of-range-compare]
    while (*nh != EOF)
           ~~~ ^  ~~~
external/boost/libs/process/src/ext/env.cpp:321:50: error: result of comparison of constant -1 with expression of type 'char' is always true [-Werror,-Wtautological-constant-out-of-range-compare]
    while (!procargs || procargs.get()[size - 1] != EOF)
                        ~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~
Dominant language
C++
Stars
145
Forks
151
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/process

All issues in boostorg/process

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.