Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 84132 - GDB 6.3 does not compile with GCC 4.0
Summary: GDB 6.3 does not compile with GCC 4.0
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GCC Porting (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-04 14:49 UTC by Mark Loeser (RETIRED)
Modified: 2005-04-22 21:48 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
GCC4 compile fix (gdb-6.3-gcc4.patch,818 bytes, patch)
2005-03-04 14:50 UTC, Mark Loeser (RETIRED)
Details | Diff
GCC4 compile fix (gdb-6.3-scanmem.patch,6.48 KB, patch)
2005-03-12 22:25 UTC, Mark Loeser (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Loeser (RETIRED) gentoo-dev 2005-03-04 14:49:54 UTC
Attached is a patch that fixes the compile error.
Comment 1 Mark Loeser (RETIRED) gentoo-dev 2005-03-04 14:50:31 UTC
Created attachment 52684 [details, diff]
GCC4 compile fix
Comment 2 SpanKY gentoo-dev 2005-03-08 15:41:33 UTC
do you have an upstream fix ?  you cant just remove the left hand cast and have it work
Comment 3 Mark Loeser (RETIRED) gentoo-dev 2005-03-08 16:16:53 UTC
True, it was late when I did this.  I will look upstream.  Funny how GDB didn't crash when I was using it though.
Comment 4 Mark Loeser (RETIRED) gentoo-dev 2005-03-08 17:10:24 UTC
Actually, the problem isn't even with gdb-6.3 itself.  The problem is with: gdb-6.3-scanmem.patch
That is where the "broken" code lies right now.
Comment 5 Mark Loeser (RETIRED) gentoo-dev 2005-03-12 22:25:09 UTC
Created attachment 53309 [details, diff]
GCC4 compile fix

Actually, looking at this again, with 1 slight change, this patch works fine. 
I tried out scanmem with one of my own programs and it seems to work perfectly
fine still.  GDB compiles fine without this patch, but this slight change
shouldn't break the feature the patch adds.
Comment 6 SpanKY gentoo-dev 2005-04-20 19:26:47 UTC
erm you sure ?

with this change:
              int *pint;
-             (unsigned char *) pint = (unsigned char *) (data + i);
+             *pint = (int*)data + i;

the original behavior had data as a pointer of type 'unsigned char *' before adding 1 while the new behavior casts data to type 'int *' before adding 1 ... when doing pointer addition, constants are multiplied by the # of bytes the type the pointer points to ...

simple test:
$ cat test.c
void main()
{
        char *b = 50;
        printf("%i %i\n", b + 1, (int*)b + 1);
}
$ gcc test.c -w && ./a.out 
51 54

the second change looks ok i think ... the original code looked just plain wrong though:
    unsigned char typc;
...
    (int) typc = atoi(pattern);
wtf is that supposed to mean ? :)
Comment 7 SpanKY gentoo-dev 2005-04-22 21:48:21 UTC
fixed patch in portage