pan-users
[Top][All Lists]
Advanced

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

Re: [Pan-users] Re: make errors


From: walt
Subject: Re: [Pan-users] Re: make errors
Date: Thu, 19 Jun 2008 06:33:43 -0700
User-agent: Thunderbird 3.0a2pre (X11/2008061905)

David Shochat wrote:

On Jun 18, 2008, at 11:34 PM, walt wrote:

David Shochat wrote:

On Jun 18, 2008, at 8:27 PM, walt wrote:


How about:

char *p;
...
int *q = (int *) p;
q++;
p = (char *) q;

That would have the same net effect and is accepted by gcc 4.2.3, which
does not accept the original construct.

Well, here is my first attempt at implementing your suggestion, but it
produces exactly the same compiler error as the original code. Perhaps
in the morning when I'm more awake I'll do better.

(snip)


- *((unsigned long int *) tmp)++ =
+ *qtmp = *((unsigned long int *) b1)++;
+ qtmp++;
+ tmp = (char *)qtmp;
+/* *((unsigned long int *) tmp)++ =
*((unsigned long int *) b1)++;
+*/
}
else
{
--n2;
- *((unsigned long int *) tmp)++ =
+ *qtmp = *((unsigned long int *) b2)++;
+ qtmp++;
+ tmp = (char *)qtmp;
+/* *((unsigned long int *) tmp)++ =
*((unsigned long int *) b2)++;
+*/

I think that should be:
qtmp = (unsigned long int *) tmp;
qb2 = (unsigned long int *) b2;
*qtmp++ = *qb2++;
tmp = (char *)qtmp;
b2 = (char *) qb2;
Not sure about the last line: I'm assuming that b2 is a char*.
Is this code from old pan or new pan? Maybe I'll try doing the actual
patch.

Please do.  My new patch based on your idea compiles beautifully but
crashes when I enter a group.  The crash report generated by bugbuddy
mentions that the value of 'tmp' was optimized out :o)  This is old pan.


--- pan/base/msort.c.orig       2001-06-18 11:33:38.000000000 -0700
+++ pan/base/msort.c    2008-06-19 06:14:20.000000000 -0700
@@ -43,6 +43,7 @@
        char *tmp;
        char *b1, *b2;
        size_t n1, n2;
+       unsigned long int *qtmp, *qb1, *qb2;
        const int opsiz = sizeof(unsigned long int);

        if (n <= 1)
@@ -65,14 +66,26 @@
                        if ((*cmp) (b1, b2) <= 0)
                        {
                                --n1;
-                               *((unsigned long int *) tmp)++ =
+                               qtmp = (unsigned long int *) tmp;
+                               qb1 = (unsigned long int *) b1;
+                               *qtmp++ = *qb1++;
+                               tmp = (char *)qtmp;
+                               b1 = (char *)qb1;
+/*                             *((unsigned long int *) tmp)++ =
                                        *((unsigned long int *) b1)++;
+*/
                        }
                        else
                        {
                                --n2;
-                               *((unsigned long int *) tmp)++ =
+                               qtmp = (unsigned long int *) tmp;
+                               qb2 = (unsigned long int *) b2;
+                               *qtmp++ = *b2++;
+                               tmp = (char *)qtmp;
+                               b2 = (char *) qb2;
+/*                             *((unsigned long int *) tmp)++ =
                                        *((unsigned long int *) b2)++;
+*/
                        }
                }
        else





reply via email to

[Prev in Thread] Current Thread [Next in Thread]