WebAssembly / WebAssembly/wabt

`HUGE_VAL` and `HUGE_VALF` are not constant expressions on AIX

Open Beginner friendly
#2,849 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
8.1k
Forks
827
Avg merge
4d 6h
Merged PRs (30d)
18

Description

Even though HUGE_VAL and HUGE_VALF are defined to be described as constant expressions, on AIX they lean on reinterpret casts to a static variable, preventing them from being constant expressions. This is the only issue that prevents wabt from building on AIX.

[ 18%] Building CXX object CMakeFiles/wabt.dir/src/literal.cc.o
In file included from /opt/freeware/lib/gcc/powerpc-ibm-aix7.2.0.0/12/include/c++/cmath:45,
                 from /home/tcr/wabt/src/literal.cc:30:
/home/tcr/wabt/src/literal.cc:66:37: error: 'reinterpret_cast' is not a constant expression
   66 |   static constexpr float kHugeVal = HUGE_VALF;
      |                                     ^~~~~~~~~
/home/tcr/wabt/src/literal.cc:79:37: error: 'reinterpret_cast' is not a constant expression
   79 |   static constexpr float kHugeVal = HUGE_VAL;
      |                                     ^~~~~~~~
make[2]: *** [CMakeFiles/wabt.dir/build.make:373: CMakeFiles/wabt.dir/src/literal.cc.o] Error 1

Contributor guide

Open the contributing guide

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.

Research direction

Start in src/literal.cc at the kHugeVal definitions around lines 66 and 79, then inspect how HUGE_VALF and HUGE_VAL are provided by the AIX C++ headers. Reproduce the reported AIX build and adjust the handling so these definitions compile as constant expressions; done means wabt builds past literal.cc on AIX.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.