std::isalpha() bug in MinGW 4.7.2?

I'm using Nuwen's distribution, found here:
http://nuwen.net/mingw.html

Can someone confirm this to be a bug? Thanks.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <cctype>
#include <iostream>
#include <limits>
#include <ostream>

int main()
{
    char c = std::numeric_limits<char>::min();

    do
    {
        if (std::isalpha(c))
            std::cout << c << ' ';
    }
    while (c++ != std::numeric_limits<char>::max());

    std::cout << std::endl;
}
(output edited for readability)

ƒ „ ‡ ˆ ‹ Œ  Ž   ‘ ’ “ ” • – — ˜ ™ š › œ  ž Ÿ 
  ¡ ¢ £ ¤ ¥ ¦ § ¨ « ¬ ­ ® ¯ ° ± ² ³ ´ µ ¶ · ¸ ¹ 
º » ¼ ½ ¾ À Â Ã Ä Å Æ Ç È Ë Ì Í Î Ð Ñ Ò Ó Ô Õ Ö 
× Ø Û Ü ß à ã ä ç è ë ì ï ð ó ô ÷ ø ü A B C D E 
F G H I J K L M N O P Q R S T U V W X Y Z a b c 
d e f g h i j k l m n o p q r s t u v w x y z 
It gives me the expected result using his distribution:
1
2
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 
a b c d e f g h i j k l m n o p q r s t u v w x y z 

This is using Wine, although I normally wouldn't expect it to make a difference, especially when linking statically.
Perhaps it's locale specific?
Maybe I corrupted my installation somehow. I'll post back if I bump into this again. Otherwise, it was a false alarm.
Bump.
Clean reinstall of Windows. Re-download of Nuwen's distro.
Ran Memtest86+ (which didn't show any errors).

I am still having this problem. Any ideas as to why?
As for Windows' locale setting, it's United States.
1
2
3
4
int main()
{
    std::isalpha(std::numeric_limits<char>::min());
}


This causes an assertion failure for me in VS2010.

Otherwise I get this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <cctype>
#include <iostream>
#include <limits>
#include <ostream>

int main()
{
    unsigned char c = std::numeric_limits<char>::min();

    do
    {
        if (std::isalpha(c))
            std::cout << c << ' ';
    }
    while (c++ != std::numeric_limits<char>::max());

    std::cout << std::endl;
}
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 
a b c d e f g h i j k l m n o p q r s t u v w x y z
Press any key to continue . . .
You should not check from the very lower value of a char.
As the assertion failure (in VS10) shows, using a value under 0 shouldn't be used. Not talking about the standard, but, you should only try positive values.
Topic archived. No new replies allowed.