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

[mips] std::regex_traits considers '-' to be a member of the 'w' class #26850

Closed
llvmbot opened this issue Feb 4, 2016 · 8 comments
Closed
Labels
bugzilla Issues migrated from bugzilla libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Feb 4, 2016

Bugzilla Link 26476
Resolution FIXED
Resolved on Feb 17, 2016 09:04
Version 3.8
OS Linux
Blocks #26433
Reporter LLVM Bugzilla Contributor
CC @mclow

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.

@mclow
Copy link
Contributor

mclow commented Feb 8, 2016

Is this the only failure in that test?
(i.e, if you comment out that assert and re-run it, does it pass)

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.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Feb 10, 2016

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.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Feb 11, 2016

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 '-'.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Feb 11, 2016

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.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Feb 11, 2016

I can confirm that this was the problem. I've posted a patch at http://reviews.llvm.org/D17132

@mclow
Copy link
Contributor

mclow commented Feb 11, 2016

In r260527, I added some tests to catch this if it happens again.
Can you please update to that version and run the tests, with and without your patch?

@llvmbot
Copy link
Collaborator Author

llvmbot commented Feb 15, 2016

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.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Feb 17, 2016

Committed an '#ifdef mips' version in r261088 and merged it in r261097

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

No branches or pull requests

2 participants