Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permute.hh -> Call to abs is ambiguous #35

Open
frederick-m-k opened this issue Nov 5, 2022 · 0 comments
Open

Permute.hh -> Call to abs is ambiguous #35

frederick-m-k opened this issue Nov 5, 2022 · 0 comments

Comments

@frederick-m-k
Copy link

Hi guys,

I tried to setup and install RASR for the first time following the Beginners How To on https://www-i6.informatik.rwth-aachen.de/rwth-asr/manual/index.php/Beginner%27s_Howto
I executed the scripts/requirements.sh and this executed well.

Error

When running the Makefile, I got three error for compiling Permute.cc:

compiling Permute.cc
In file included from Permute.cc:15:
./Permute.hh:303:60: error: call to 'abs' is ambiguous
            if (!Precursor::states_[s].used_[i] && (size_t(abs(i - Precursor::states_[s].depth_)) < Precursor::distortionLimit_)) {  // !!! LIMIT
                                                           ^~~
./Permute.hh:294:5: note: in instantiation of member function 'Fsa::IBMPermuteAutomaton<Fsa::NoProcessing>::permuteArcs' requested here
    IBMPermuteAutomaton(ConstAutomatonRef f, u32 windowSize, u16 distortionLimit, Processing* processing)
    ^
Permute.cc:23:34: note: in instantiation of member function 'Fsa::IBMPermuteAutomaton<Fsa::NoProcessing>::IBMPermuteAutomaton' requested here
    return ConstAutomatonRef(new T(f, windowSize, distortionLimit, new NoProcessing));
                                 ^
Permute.cc:27:12: note: in instantiation of function template specialization 'Fsa::permute<Fsa::IBMPermuteAutomaton<Fsa::NoProcessing>>' requested here
    return permute<IBMPermuteAutomaton<NoProcessing>>(f, windowSize, distortionLimit);
           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdlib.h:132:6: note: candidate function
int      abs(int) __pure2;
         ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/stdlib.h:107:39: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT {
                                      ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/stdlib.h:111:44: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {
                                           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/stdlib.h:118:40: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY float abs(float __lcpp_x) _NOEXCEPT {
                                       ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/stdlib.h:122:41: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY double abs(double __lcpp_x) _NOEXCEPT {
                                        ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/stdlib.h:127:1: note: candidate function
abs(long double __lcpp_x) _NOEXCEPT {
^

This error occurred thrice, since the abs function is called three times.

There are possible abs functions for int, long, long long, float, double, and long double.
Therefore, the input for abs is either non of those or has to be set directly.

Possible solution

I'm not a proficient C++ programmer, so my solution might not be right.
Please comment on this and feel free to correct my approach.

When setting the datatype of the abs parameter, the error resolves:

public:
    IBMPermuteAutomaton(ConstAutomatonRef f, u32 windowSize, u16 distortionLimit, Processing* processing)
            : PermuteAutomaton<Processing>(f, windowSize, distortionLimit, processing){};
    virtual void permuteArcs(State* sp) const {
        StateId s          = sp->id();
        u32     lowerLimit = 0;
        u32     upperLimit = std::min(size_t(Precursor::states_[s].depth_ + Precursor::windowSize_), Precursor::states_[s].used_.size());
        Precursor::processing_->processState(Precursor::states_[s].used_, lowerLimit, upperLimit);
        for (u32 i = lowerLimit; i < upperLimit; ++i)
            if (!Precursor::states_[s].used_[i] && (size_t(abs(int(i - Precursor::states_[s].depth_))) < Precursor::distortionLimit_)) {  // !!! LIMIT    <-----
                u32  depth = Precursor::states_[s].depth_ + 1;
                Arc* a     = sp->newArc();
                *a         = Precursor::arcs_[i];
                a->target_ = Precursor::insertState(depth, Precursor::states_[s].used_, i);
                Precursor::processing_->processArc(i - Precursor::states_[s].depth_, a);
            }
    }
    virtual std::string describe() const {
        return Core::form("ibm-permute(%s,%d)", Precursor::fsa_->describe().c_str(), Precursor::windowSize_);
    }
};

Adding an int(...) inside the abs(...), resolved the error.

This could be a versioning issue. Here my version information:

  • MacOS Cataline 12.0.1
  • gcc 12.2.0
    Maybe someone can reproduce this and check if the error occurs as well.

Regards,
Frederick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant