KhronosGroup / KhronosGroup/glslang
Error compiling for MIPS
- Dominant language
- C++
- Stars
- 3.6k
- Forks
- 989
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 31
Description
When building for MIPS, I get the following errors in [SPVRemapper.cpp](https://github.com/KhronosGroup/glslang/blob/2518af09c8b39423e76db9efdf94a5a478f4e5fc/SPIRV/SPVRemapper.cpp):
```
In file included from /source/glslang/SPIRV/SPVRemapper.cpp:36:
/source/glslang/SPIRV/SPVRemapper.h: In member function ‘spv::Id& spv::spirvbin_t::asId(unsigned int)’:
/source/glslang/SPIRV/SPVRemapper.h:162:72: error: cannot bind non-const lvalue reference of type ‘spv::Id&’ {aka ‘unsigned int&’} to a value of type ‘__gnu_cxx::__alloc_traits, long unsigned int>::value_type’ {aka ‘long unsigned int’}
162 | spv::Id& asId(unsigned word) { return spv[word]; }
| ^
/source/glslang/SPIRV/SPVRemapper.h: In member function ‘const spv::Id& spv::spirvbin_t::asId(unsigned int) const’:
/source/glslang/SPIRV/SPVRemapper.h:163:72: warning: returning reference to temporary [-Wreturn-local-addr]
163 | const spv::Id& asId(unsigned word) const { return spv[word]; }
| ^
/source/glslang/SPIRV/SPVRemapper.cpp: In member function ‘void spv::spirvbin_t::mapRemainder()’:
/source/glslang/SPIRV/SPVRemapper.cpp:369:32: error: no matching function for call to ‘max(spv::spirvbin_t::spirword_t&, spv::Id)’
369 | maxBound = std::max(maxBound, localId(id) + 1);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/c++/13.2.0/string:51,
from /source/glslang/SPIRV/SPVRemapper.h:39:
/usr/local/include/c++/13.2.0/bits/stl_algobase.h:257:5: note: candidate: ‘template constexpr const _Tp& std::max(const _Tp&, const _Tp&)’
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/local/include/c++/13.2.0/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
/source/glslang/SPIRV/SPVRemapper.cpp:369:32: note: deduced conflicting types for parameter ‘const _Tp’ (‘long unsigned int’ and ‘spv::Id’ {aka ‘unsigned int’})
369 | maxBound = std::max(maxBound, localId(id) + 1);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/13.2.0/bits/stl_algobase.h:303:5: note: candidate: ‘template constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/local/include/c++/13.2.0/bits/stl_algobase.h:303:5: note: template argument deduction/substitution failed:
/source/glslang/SPIRV/SPVRemapper.cpp:369:32: note: deduced conflicting types for parameter ‘const _Tp’ (‘long unsigned int’ and ‘spv::Id’ {aka ‘unsigned int’})
369 | maxBound = std::max(maxBound, localId(id) + 1);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/c++/13.2.0/functional:67,
from /source/glslang/SPIRV/SPVRemapper.h:71:
/usr/local/include/c++/13.2.0/bits/stl_algo.h:5795:5: note: candidate: ‘template constexpr _Tp std::max(initializer_list<_Tp>)’
5795 | max(initializer_list<_Tp> __l)
| ^~~
/usr/local/include/c++/13.2.0/bits/stl_algo.h:5795:5: note: template argument deduction/substitution failed:
/source/glslang/SPIRV/SPVRemapper.cpp:369:32: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘long unsigned int’
369 | maxBound = std::max(maxBound, localId(id) + 1);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/13.2.0/bits/stl_algo.h:5805:5: note: candidate: ‘template constexpr _Tp std::max(initializer_list<_Tp>, _Compare)’
5805 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/local/include/c++/13.2.0/bits/stl_algo.h:5805:5: note: template argument deduction/substitution failed:
/source/glslang/SPIRV/SPVRemapper.cpp:369:32: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘long unsigned int’
369 | maxBound = std::max(maxBound, localId(id) + 1);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
```
Contributor guide
Research direction
Start with SPIRV/SPVRemapper.h at the asId methods and SPIRV/SPVRemapper.cpp around line 369, using the reported MIPS build errors as the reproduction. Check the involved types and make the compilation succeed without the reported reference and std::max errors, then rebuild for MIPS to verify the fix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100