public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/26592]  New: g++ ICE in cp_expr_size expanding template with inline assembly
@ 2006-03-07 12:04 cjh at managesoft dot com
  2006-03-07 12:26 ` [Bug c++/26592] " reichelt at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: cjh at managesoft dot com @ 2006-03-07 12:04 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1992 bytes --]

ICE in this version of G++, my previous Debian version worked.
Compiling a method of a class that subclasses a template that
contains inline assembly code (used for atomic instructions),
see complete code snippet below. Command line "g++ -c foo.c"
yields error message:

g++_bug.cxx: In member function ‘void LatchC::latch(int) volatile’:
g++_bug.cxx:34: internal compiler error: in cp_expr_size, at
cp/cp-objcp-common.c:101

template <class T>
class AtomicM
{
public:
        AtomicM(T i = T()) : val(i) { }
        AtomicM(const AtomicM& from) : val(from.val) { }
        AtomicM& operator=(const AtomicM& from)
                { exchange(from.val); return *this; }

        inline T exchangeCmp(T e, T comparand) volatile
        {
                register int eax asm("eax") = comparand;
                __asm__ __volatile__(
                        "lock; cmpxchg %2,%0"
                                : "+m" (val)
                                , "+a" (eax)
                                : "q" (e)
                                : "cc"
                );
                return (T)eax;
        }

protected:
        volatile T val;
};

class LatchC
        : private AtomicM<int>
{
public:
        inline void latch(int i) volatile
        {
                while (exchangeCmp(i, 0) != 0)
                        yield(1);
        }
        void enter();
private:
        static void yield(int ms);
};

void
LatchC::enter()
{
        latch(1);
}


-- 
           Summary: g++ ICE in cp_expr_size expanding template with inline
                    assembly
           Product: gcc
           Version: 4.0.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: cjh at managesoft dot com
 GCC build triplet: i486-pc-linux-gnu
  GCC host triplet: i486-pc-linux-gnu
GCC target triplet: i486-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26592


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/26592] g++ ICE in cp_expr_size expanding template with inline assembly
  2006-03-07 12:04 [Bug c++/26592] New: g++ ICE in cp_expr_size expanding template with inline assembly cjh at managesoft dot com
@ 2006-03-07 12:26 ` reichelt at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2006-03-07 12:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from reichelt at gcc dot gnu dot org  2006-03-07 12:26 -------
I already entered your previous report into the database,
but forgot to notify you, sorry.


*** This bug has been marked as a duplicate of 26577 ***


-- 

reichelt at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26592


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-03-07 12:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-07 12:04 [Bug c++/26592] New: g++ ICE in cp_expr_size expanding template with inline assembly cjh at managesoft dot com
2006-03-07 12:26 ` [Bug c++/26592] " reichelt at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).