[MBT] new ticket for pkg gcc "ICE: in emit_move_insn, at expr.c:3165 (inline assembly?)"

bugs at pld-linux.org bugs at pld-linux.org
Sun Apr 4 13:39:54 CEST 2004


Date: 2004-04-04 13:39:53+02	Author: Arturs Zoldners (azazel) <az at rpiva.lv> 
Title:         ICE: in emit_move_insn, at expr.c:3165 (inline assembly?)
Ticket ID:     #874
Ticket URL:    http://bugs.pld-linux.org/?bug=874
Package:       gcc-5:3.3.3-2
Distribution:  PLD-2.0.main PLD-nest.test
Category:      doesn't work as it should
Current state: opened
Text:

*************************************
gcc -Wall -v --save-temps -c main.cc:
*************************************

Reading specs from /usr/lib/gcc-lib/i386-pld-linux/3.3.3/specs
Configured with: ../configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --infodir=/usr/share/info --mandir=/usr/share/man --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-languages=c,c++,f77,objc,ada,java,ksi --enable-c99 --enable-long-long --enable-multilib --enable-nls --with-gnu-as --with-gnu-ld --with-system-zlib --with-slibdir=/lib --without-x i386-pld-linux
Thread model: posix
gcc version 3.3.3 (PLD Linux)
 /usr/lib/gcc-lib/i386-pld-linux/3.3.3/cc1plus -E -D__GNUG__=3 -quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=3 -D_GNU_SOURCE main.cpp main.ii
ignoring nonexistent directory "/usr/include/c++/3.3.3"
ignoring nonexistent directory "/usr/include/c++/3.3.3/i386-pld-linux"
ignoring nonexistent directory "/usr/include/c++/3.3.3/backward"
ignoring nonexistent directory "/usr/i386-pld-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc-lib/i386-pld-linux/3.3.3/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i386-pld-linux/3.3.3/cc1plus -fpreprocessed main.ii -quiet -dumpbase main.cpp -auxbase main -version -o main.s
GNU C++ version 3.3.3 (PLD Linux) (i386-pld-linux)
	compiled by GNU C version 3.3.3 (PLD Linux).
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64225
main.cpp: In function `bool cas(volatile T&, const T&, const T&) [with T = 
   lockfree::queue<packet::buffer_base>::atomic_ptr]':
main.cpp:13: internal compiler error: in emit_move_insn, at expr.c:3165
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugs.pld-linux.org/> for instructions.

*************************************
main.ii: Code that triggers ICE (reduced)
*************************************

# 1 "main.cpp"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "main.cpp"




template<typename T> bool cas(volatile T& what, const T& test_val, const T& new_val) __attribute__((always_inline));
template<typename T> bool cas(volatile T& what, const T& test_val, const T& new_val)
{
        bool ret;
        switch (sizeof(T))
        {
                case 4:
                {
                        __asm__ __volatile__
                        (
                                "cmpxchgl %1,%2;\n\t"
                                "sete %0;\n\t"
                                :
                                "=q"(ret)
                                :
                                "q"(new_val),
                                "m"(what),
                                "a"(test_val)
                                :
                                "memory", "cc"
                        );
                        return ret;
                }
                case 8:
                {
                        bool ret;
                        __asm__ __volatile__
                        (
                                "cmpxchg8b %5;\n\t"
                                "sete %0;\n\t"
                                :
                                "=q" (ret)
                                :
                                "a" (((unsigned long*)&test_val)[0]),
                                "d" (((unsigned long*)&test_val)[1]),
                                "b" (((unsigned long*)&new_val )[0]),
                                "c" (((unsigned long*)&new_val )[1]),
                                "m" (what)
                                :
                                "memory", "cc"
                        );
                        return ret;
                }
                default:
                {

                        return false;
                }
        }
}

namespace lockfree
{
        template<class T> class queue
        {
        public:
                class lifo_fifo_base {};
                class node;

        protected:
                class node_base
                {
                public:
                        node* next;
                        node_base(): next(0) {}
                };

        public:
                class node: public node_base, public T
                {
                public:
                        lifo_fifo_base* container;

                        node(): node_base(), T(), container(0) {}
                };

        protected:
                class atomic_ptr
                {
                public:
                        node_base nod;
                        unsigned long ver;

                        atomic_ptr(): ver(0) {}
                        atomic_ptr(const volatile atomic_ptr& a) {ver = a.ver;nod.next = a.nod.next;}
                        atomic_ptr& operator = (const volatile atomic_ptr& a) {ver = a.ver; nod.next = a.nod.next; return *this;}
                };

        public:
                class lifo: public lifo_fifo_base
                {
                private:
                        volatile atomic_ptr head;

                public:
                        lifo() {}

                        node* pop(void)
                        {
                                atomic_ptr ol;
                                atomic_ptr ne;

                                do
                                {
                                        ol = head;
                                        ne.nod.next = ol.nod.next->next;
                                        ne.ver = ol.ver + 1;
                                }
                                while(!cas(head, ol, ne));

                                bool rc = cas<lifo_fifo_base*>(ol.nod.next->container, this, 0);


                                return ol.nod.next;
                        }
                };
        };
};

namespace packet
{
        class buffer_base
        {
        public:
                buffer_base() {};
                void* data;
        };

        typedef lockfree::queue<buffer_base> queue;

        typedef queue::node buffer;
        typedef queue::lifo lifo;

        extern lifo free;

        buffer* new_buffer(void)
        {
                buffer* ret = free.pop();
                return ret;
        }
};

int main(int argc, char *argv[])
{
        return 0;
}




More information about the pld-bugs mailing list