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
[mips] std::regex_traits considers '-' to be a member of the 'w' class #26850
Comments
Is this the only failure in that test? I suspect that ctype_base (defined in __locale) is not getting built correctly for your system; there's a set of #ifdefs for different systems there, and none for mips. |
The 'assert(!t.isctype('@', t.lookup_classname(s.begin(), s.end())));' on line 31 and then the wchar_t version of the same two on lines 159 and 160 also fail. I've only had a quick look at ctype_base in __locale so far but my machine should be covered by the GLIBC. I'll keep digging. |
It looks like the result of lookup_classname() is wrong. If I understand this correctly, it should return a bitmask to test against the values in classic_table. I think this class should be digit|alpha|upper|lower but some how 'graph' has crept in too. This then matches the punct|graph|print used for the '-'. |
I'm fairly certain the problem is __regex_word. It's trying to use an unoccupied bit (0x80) but this bit is only unoccupied on little endian machines. On big-endian the bytes are reversed in the enum containing _ISgraph/_ISprint/etc. (by _ISbit() in /usr/include/ctype.h) so __regex_word and _ISgraph happen to have the same value. It seems that __regex_word needs to be 0x8000 on a big-endian machine. It's late so I'm leaving a build running overnight to confirm. I should know if this is the problem in the morning. |
I can confirm that this was the problem. I've posted a patch at http://reviews.llvm.org/D17132 |
In r260527, I added some tests to catch this if it happens again. |
The tests you added in r260527 pass even without my patch. This is because the table is shared between C and C++ and we're colliding with the _ISgraph bit used by C rather than any of the C++ related bits. |
Committed an '#ifdef mips' version in r261088 and merged it in r261097 |
Extended Description
It currently fails with this assertion:
isctype.pass.cpp:30: int main(): Assertion `!t.isctype('-', t.lookup_classname(s.begin(), s.end()))' failed.
this test passed in the previous release.
The text was updated successfully, but these errors were encountered: