Trolltech Home | Qt4-preview-feedback Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt4-preview-feedback Archive, April 2007
ASSERT: "d->ref == 1" problem with Qt4.3beta on PowerPC


Message 1 in thread

Hi,


We are so far 3 different users to have problem with Qt 4.3beta on PowerPC32 
(Linux i.e. X11 Version). See posts on the newsgroup trolltech.qt-interest 
and http://lists.trolltech.com/qt-interest/2007-04/thread00010-0.html .

As suggested by Dimitri, I'm posting on this list to give you some 
feedback. :)

Qt compiles without problem, but we have the following runtime error while 
using many Qt binaries, like "assistant" or "qdbusxml2cpp" (and many more):
 
ASSERT: "d->ref == 1" in file tools/qlistdata.cpp, line 132
Aborted

:(
As we all use PowerPC processors (I have a Mac Mini PowerG4), it may be some 
endianess issue...?

Please tell us if you need some more info (see also the post of "Jon" with 
backtraces). We'll be glad to help you. Any advise to help us to solve our 
problem would be welcome. (Because this is of course *not* an April Fools' 
joke!)
Thanks!

-- 
 [ signature omitted ] 

Message 2 in thread

On Sunday 01 April 2007, Nicolas Roffet wrote:
> ASSERT: "d->ref == 1" in file tools/qlistdata.cpp, line 132
> Aborted
> 
> :(
> As we all use PowerPC processors (I have a Mac Mini PowerG4), it may be some 
> endianess issue...?

I guess it's rather an issue with the assembly code that is used for atomic refcounting.

-- 
 [ signature omitted ] 

Message 3 in thread

On Sunday 01 April 2007 22:33:54 Nicolas Roffet wrote:
> Hi,
>
>
> We are so far 3 different users to have problem with Qt 4.3beta on
> PowerPC32 (Linux i.e. X11 Version). See posts on the newsgroup
> trolltech.qt-interest and
> http://lists.trolltech.com/qt-interest/2007-04/thread00010-0.html .
>
> As suggested by Dimitri, I'm posting on this list to give you some
> feedback. :)
>
> Qt compiles without problem, but we have the following runtime error while
> using many Qt binaries, like "assistant" or "qdbusxml2cpp" (and many more):
>
> ASSERT: "d->ref == 1" in file tools/qlistdata.cpp, line 132
> Aborted
>
> :(
>
> As we all use PowerPC processors (I have a Mac Mini PowerG4), it may be
> some endianess issue...?
>
> Please tell us if you need some more info (see also the post of "Jon" with
> backtraces). We'll be glad to help you. Any advise to help us to solve our
> problem would be welcome. (Because this is of course *not* an April Fools'
> joke!)

Hi!

can you try the attached patch and see if that fixes the crashes for you?

Thanks!

Simon
==== //depot/qt/4.3/src/corelib/arch/qatomic_powerpc.h#2 - /home/shausman/dev/qt-4.3/src/corelib/arch/qatomic_powerpc.h ====
==== //depot/qt/4.3/src/corelib/arch/qatomic_powerpc.h#2 - /home/shausman/dev/qt-4.3/src/corelib/arch/qatomic_powerpc.h ====
--- /tmp/tmp.653.23	2007-04-02 11:54:15.000000000 +0200
+++ /home/shausman/dev/qt-4.3/src/corelib/arch/qatomic_powerpc.h	2007-04-02 11:54:01.000000000 +0200
@@ -51,16 +51,16 @@ inline int q_atomic_test_and_set_acquire
 {
     register int tmp;
     register int ret;
-    asm volatile("lwarx  %0,0,%3\n"
-                 "cmpw   %0,%4\n"
+    asm volatile("lwarx  %0,0,%2\n"
+                 "cmpw   %0,%3\n"
                  "bne-   $+20\n"
-                 "stwcx. %5,0,%3\n"
+                 "stwcx. %4,0,%2\n"
                  "bne-   $-16\n"
                  "li     %1,1\n"
                  "b      $+8\n"
                  "li     %1,0\n"
                  "eieio\n"
-                 : "=&r" (tmp), "=&r" (ret), "=m" (*ptr)
+                 : "=&r" (tmp), "=&r" (ret)
                  : "r" (ptr), "r" (expected), "r" (newval)
                  : "cc", "memory");
     return ret;
@@ -71,15 +71,15 @@ inline int q_atomic_test_and_set_release
     register int tmp;
     register int ret;
     asm volatile("eieio\n"
-                 "lwarx  %0,0,%3\n"
-                 "cmpw   %0,%4\n"
+                 "lwarx  %0,0,%2\n"
+                 "cmpw   %0,%3\n"
                  "bne-   $+20\n"
-                 "stwcx. %5,0,%3\n"
+                 "stwcx. %4,0,%2\n"
                  "bne-   $-16\n"
                  "li     %1,1\n"
                  "b      $+8\n"
                  "li     %1,0\n"
-                 : "=&r" (tmp), "=&r" (ret), "=m" (*ptr)
+                 : "=&r" (tmp), "=&r" (ret)
                  : "r" (ptr), "r" (expected), "r" (newval)
                  : "cc", "memory");
     return ret;
@@ -89,15 +89,15 @@ inline int q_atomic_test_and_set_ptr(vol
 {
     register void *tmp;
     register int ret;
-    asm volatile(LPARX"  %0,0,%3\n"
-                 CMPP"   %0,%4\n"
+    asm volatile(LPARX"  %0,0,%2\n"
+                 CMPP"   %0,%3\n"
                  "bne-   $+20\n"
-                 STPCX"  %5,0,%3\n"
+                 STPCX"  %4,0,%2\n"
                  "bne-   $-16\n"
                  "li     %1,1\n"
                  "b      $+8\n"
                  "li     %1,0\n"
-                 : "=&r" (tmp), "=&r" (ret), "=m" (*reinterpret_cast<volatile long *>(ptr))
+                 : "=&r" (tmp), "=&r" (ret)
                  : "r" (ptr), "r" (expected), "r" (newval)
                  : "cc", "memory");
     return ret;
@@ -107,11 +107,11 @@ inline int q_atomic_increment(volatile i
 {
     register int ret;
     register int one = 1;
-    asm volatile("lwarx  %0, 0, %2\n"
-                 "add    %0, %3, %0\n"
-                 "stwcx. %0, 0, %2\n"
+    asm volatile("lwarx  %0, 0, %1\n"
+                 "add    %0, %2, %0\n"
+                 "stwcx. %0, 0, %1\n"
                  "bne-   $-12\n"
-                 : "=&r" (ret), "=m" (*ptr)
+                 : "=&r" (ret)
                  : "r" (ptr), "r" (one)
                  : "cc", "memory");
     return ret;
@@ -121,11 +121,11 @@ inline int q_atomic_decrement(volatile i
 {
     register int ret;
     register int one = -1;
-    asm volatile("lwarx  %0, 0, %2\n"
-                 "add    %0, %3, %0\n"
-                 "stwcx. %0, 0, %2\n"
+    asm volatile("lwarx  %0, 0, %1\n"
+                 "add    %0, %2, %0\n"
+                 "stwcx. %0, 0, %1\n"
                  "bne-   $-12\n"
-                 : "=&r" (ret), "=m" (*ptr)
+                 : "=&r" (ret)
                  : "r" (ptr), "r" (one)
                  : "cc", "memory");
     return ret;
@@ -134,10 +134,10 @@ inline int q_atomic_decrement(volatile i
 inline int q_atomic_set_int(volatile int *ptr, int newval)
 {
     register int ret;
-    asm volatile("lwarx  %0, 0, %2\n"
-                 "stwcx. %2, 0, %2\n"
+    asm volatile("lwarx  %0, 0, %1\n"
+                 "stwcx. %2, 0, %1\n"
                  "bne-   $-8\n"
-                 : "=&r" (ret), "=m" (*ptr)
+                 : "=&r" (ret)
                  : "r" (ptr), "r" (newval)
                  : "cc", "memory");
     return ret;
@@ -146,10 +146,10 @@ inline int q_atomic_set_int(volatile int
 inline void *q_atomic_set_ptr(volatile void *ptr, void *newval)
 {
     register void *ret;
-    asm volatile(LPARX"  %0, 0, %2\n"
-                 STPCX"  %2, 0, %2\n"
+    asm volatile(LPARX"  %0, 0, %1\n"
+                 STPCX"  %2, 0, %1\n"
                  "bne-   $-8\n"
-                 : "=&r" (ret), "=m" (*reinterpret_cast<volatile long *>(ptr))
+                 : "=&r" (ret)
                  : "r" (ptr), "r" (newval)
                  : "cc", "memory");
     return ret;

Attachment:

Attachment: pgpXL31ZkS1Gx.pgp
Description: PGP signature


Message 4 in thread

Hi Simon,


> > [...] Qt compiles without problem, but we have the following runtime error
> > while using many Qt binaries, [...]
> >
> > ASSERT: "d->ref == 1" in file tools/qlistdata.cpp, line 132
> > [...]
>
> can you try the attached patch and see if that fixes the crashes for you?
>
> Thanks!

I just tried your patch and it's working! :)
Qt compiles and at runtime, I don't have the "ASSERT" error anymore! Qt 
Assistant (for instance) starts without problem now.
Thanks a lot for your help! :)

-- 
 [ signature omitted ]