[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#109351: g++ -mcpu=k6 ICE



Package: g++-3.0
Version: 1:3.0.1-0pre010811
Severity: normal
File: /usr/bin/g++-3.0

falk@oldeoog:~/src/yucata% g++-3.0   -c -mcpu=k6 -O2  bug.ii
bug.cc: In function `int alphaBetaWithMemory(Board, bool, int, int, int)':
bug.cc:128: Unrecognizable insn:
(insn 1671 141 1672 (parallel[ 
            (set (reg/v:SI 2 ecx [56])
                (const_int 0 [0x0]))
            (clobber (reg:CC 17 flags))
        ] ) -1 (nil)
    (expr_list:REG_UNUSED (reg:CC 17 flags)
        (nil)))
bug.cc:128: Internal compiler error in insn_default_length, at insn-attrtab.c:
   223
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

	Falk

--- bug.ii -----------------------------------------------------------
# 1 "bug.cc"
# 1 "/usr/include/assert.h" 1 3
# 36 "/usr/include/assert.h" 3
# 1 "/usr/include/features.h" 1 3
# 283 "/usr/include/features.h" 3
# 1 "/usr/include/sys/cdefs.h" 1 3
# 284 "/usr/include/features.h" 2 3
# 312 "/usr/include/features.h" 3
# 1 "/usr/include/gnu/stubs.h" 1 3
# 313 "/usr/include/features.h" 2 3
# 37 "/usr/include/assert.h" 2 3
# 65 "/usr/include/assert.h" 3
extern "C" {


extern void __assert_fail (__const char *__assertion, __const char *__file,
                           unsigned int __line, __const char *__function)
     throw () __attribute__ ((__noreturn__));


extern void __assert_perror_fail (int __errnum, __const char *__file,
                                  unsigned int __line,
                                  __const char *__function)
     throw () __attribute__ ((__noreturn__));




extern void __assert (const char *__assertion, const char *__file, int __line)
     throw () __attribute__ ((__noreturn__));


}
# 2 "bug.cc" 2
# 1 "/usr/lib/gcc-lib/i386-linux/3.0.1/include/limits.h" 1 3
# 11 "/usr/lib/gcc-lib/i386-linux/3.0.1/include/limits.h" 3
# 1 "/usr/lib/gcc-lib/i386-linux/3.0.1/include/syslimits.h" 1 3






# 1 "/usr/lib/gcc-lib/i386-linux/3.0.1/include/limits.h" 1 3
# 125 "/usr/lib/gcc-lib/i386-linux/3.0.1/include/limits.h" 3
# 1 "/usr/include/limits.h" 1 3
# 26 "/usr/include/limits.h" 3
# 1 "/usr/include/features.h" 1 3
# 27 "/usr/include/limits.h" 2 3
# 144 "/usr/include/limits.h" 3
# 1 "/usr/include/bits/posix1_lim.h" 1 3
# 126 "/usr/include/bits/posix1_lim.h" 3
# 1 "/usr/include/bits/local_lim.h" 1 3
# 36 "/usr/include/bits/local_lim.h" 3
# 1 "/usr/include/linux/limits.h" 1 3
# 37 "/usr/include/bits/local_lim.h" 2 3
# 127 "/usr/include/bits/posix1_lim.h" 2 3
# 145 "/usr/include/limits.h" 2 3



# 1 "/usr/include/bits/posix2_lim.h" 1 3
# 149 "/usr/include/limits.h" 2 3



# 1 "/usr/include/bits/xopen_lim.h" 1 3
# 34 "/usr/include/bits/xopen_lim.h" 3
# 1 "/usr/include/bits/stdio_lim.h" 1 3
# 35 "/usr/include/bits/xopen_lim.h" 2 3
# 136 "/usr/include/bits/xopen_lim.h" 3
# 1 "/usr/include/bits/wordsize.h" 1 3
# 137 "/usr/include/bits/xopen_lim.h" 2 3
# 153 "/usr/include/limits.h" 2 3
# 126 "/usr/lib/gcc-lib/i386-linux/3.0.1/include/limits.h" 2 3
# 8 "/usr/lib/gcc-lib/i386-linux/3.0.1/include/syslimits.h" 2 3
# 12 "/usr/lib/gcc-lib/i386-linux/3.0.1/include/limits.h" 2 3
# 3 "bug.cc" 2

inline int min(int x, int y) { if (y < x) return y; return x; }
inline int max(int x, int y) { if (y < x) return x; return y; }
inline int abs(int x) { if (x < 0) return -x; return x; }

static const unsigned BOARD_SIZE = 40;

static const unsigned EXTRA_FIELDS = 5;
static const unsigned MAX_CARDS = 7;
static const unsigned MOVE_JUMP = 5;
static const unsigned MOVE_REPEAT = 6;

enum Card {
    CARD_1 = (1 << 0),
    CARD_2 = (1 << 1),
    CARD_3 = (1 << 2),
    CARD_4 = (1 << 3),
    CARD_5 = (1 << 4),
    CARD_JUMP = (1 << 5),
    CARD_REPEAT = (1 << 6),
    CARD_ALL = CARD_1 | CARD_2 | CARD_3 | CARD_4 | CARD_5 | CARD_JUMP | CARD_REPEAT
};
inline Card card(unsigned move) { return Card(1 << move); }

enum Field { EMPTY, STONE, BLUE_STONE, RED_STONE };
enum Player { PLAYER_WHITE, PLAYER_RED };
enum Result { NOT_FINISHED, WHITE_WINS, RED_WINS, DRAW };

inline Player otherPlayer(Player player)
    { return player == PLAYER_WHITE ? PLAYER_RED : PLAYER_WHITE; }

class Board {
public:
    Board() { }
    Board(const Board& board, unsigned move);
    unsigned pos(Player player) const
        { return player == PLAYER_WHITE ? posWhite : posRed; }
    unsigned cards(Player player) const
        { return player == PLAYER_WHITE ? cardsWhite : cardsRed; }
    unsigned stones(Player player) const
        { return player == PLAYER_WHITE ? stonesWhite : stonesRed; }
    int blueStones(Player player) const
        { return player == PLAYER_WHITE ? blueStonesWhite : blueStonesRed; }
    unsigned lastMove() const { return lastMove_; }
    Player currentPlayer() const { return currentPlayer_; }
    bool canMove(unsigned move) const {
        return cards(currentPlayer()) & card(move)
            && (lastMove() != move
                || cards(currentPlayer()) == card(move));
    }
    bool gameOver() const {
        return pos(PLAYER_WHITE) >= BOARD_SIZE - 1
            || pos(PLAYER_RED) >= BOARD_SIZE - 1;
    }

    static int points(int stones, int blueStones) {
        (static_cast<void> ((blueStones >= -1 && blueStones < 10) ? 0 : (__assert_fail ("blueStones >= -1 && blueStones < 10", "bug.cc", 59, __PRETTY_FUNCTION__), 0)));
        static const unsigned PENALTIES[]
            = { 0, 0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55 };
        int points = stones - PENALTIES[blueStones + 1];
        return points < 0 ? 0 : points;

    }
    int points(Player player) const
        { return points(stones(player), blueStones(player)); }

private:
    unsigned posWhite;
    unsigned posRed;
    unsigned cardsWhite;
    unsigned cardsRed;
    unsigned stonesWhite;
    unsigned stonesRed;
    signed blueStonesWhite;
    signed blueStonesRed;
    unsigned lastMove_;
    Player currentPlayer_;
};

int alphaBetaWithMemory(Board board, bool isMaxNode,
                        int alpha, int beta, int depthLeft) {
    if (board.gameOver()) {
        Player maxPlayer = isMaxNode ?
            board.currentPlayer() : otherPlayer(board.currentPlayer());
        int pointsMax = board.points(maxPlayer),
            pointsMin = board.points(otherPlayer(maxPlayer));
        (static_cast<void> ((abs(pointsMax - pointsMin) < 1000) ? 0 : (__assert_fail ("abs(pointsMax - pointsMin) < 1000", "bug.cc", 89, __PRETTY_FUNCTION__), 0)));
        if (pointsMax == pointsMin)
            return 0;
        if (pointsMax > pointsMin)
            return 10000 + (pointsMax - pointsMin);
        else
            return -10000 + (pointsMax - pointsMin);
    }

    int g = 666666;
    if (isMaxNode) {
        g = (-2147483647 -1);
        int a = alpha;
        for (unsigned move = 0; move < MAX_CARDS; ++move) {
            if (!board.canMove(move))
                continue;
            g = max(g, alphaBetaWithMemory(Board(board, move), false,
                                                a, beta, depthLeft - 1));
            (static_cast<void> ((abs(g) < 100000) ? 0 : (__assert_fail ("abs(g) < 100000", "bug.cc", 107, __PRETTY_FUNCTION__), 0)));
            if (g >= beta)
                break;
            a = max(a, g);
        }
        (static_cast<void> ((g != (-2147483647 -1)) ? 0 : (__assert_fail ("g != (-2147483647-1)", "bug.cc", 112, __PRETTY_FUNCTION__), 0)));
    } else {
        g = 2147483647;
        int b = beta;
        for (unsigned move = 0; move < MAX_CARDS; ++move) {
            if (!board.canMove(move))
                continue;
            g = min(g, alphaBetaWithMemory(Board(board, move), true,
                                                alpha, b, depthLeft - 1));
            (static_cast<void> ((abs(g) < 100000) ? 0 : (__assert_fail ("abs(g) < 100000", "bug.cc", 121, __PRETTY_FUNCTION__), 0)));
            if (g <= alpha)
                break;
            b = min(b, g);
        }
        (static_cast<void> ((g != 2147483647) ? 0 : (__assert_fail ("g != 2147483647", "bug.cc", 126, __PRETTY_FUNCTION__), 0)));
    }
}

----------------------------------------------------------------------

-- System Information
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux oldeoog 2.4.9 #3 Sun Aug 19 13:37:57 CEST 2001 i586
Locale: LANG=C, LC_CTYPE=C

Versions of packages g++-3.0 depends on:
ii  gcc-3.0               1:3.0.1-0pre010811 The GNU C compiler.
ii  gcc-3.0-base          1:3.0.1-0pre010811 The GNU Compiler Collection (base 
ii  libc6                 2.2.3-11           GNU C Library: Shared libraries an
ii  libstdc++3-dev        1:3.0.1-0pre010811 The GNU stdc++ library version 3 (




Reply to: