[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gforth] FYI: gforth and gcc 4.7
From: |
Andrew Haley |
Subject: |
Re: [gforth] FYI: gforth and gcc 4.7 |
Date: |
Thu, 12 Apr 2012 16:55:20 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 |
On 04/12/2012 04:49 PM, Anton Ertl wrote:
> On Thu, Apr 12, 2012 at 04:24:35PM +0100, Andrew Haley wrote:
>> I found a couple of gforth bugs, FYI.
> ...
>> It's this bug, which returns the address of a local array:
>>
>> diff -r f14bc589172e prim
>> --- a/prim Thu Apr 12 14:42:46 2012 +0100
>> +++ b/prim Thu Apr 12 14:51:21 2012 +0100
>> @@ -1950,7 +1950,7 @@
>>
>> newline ( -- c_addr u ) gforth
>> ""String containing the newline sequence of the host OS""
>> -char newline[] = {
>> +static const char newline[] = {
>> #if DIRSEP=='/'
>> /* Unix */
>> '\n'
>
> Thanks. Why do you think that this is a bug in Gforth and not in gcc?
I think it's returning the address of a local string that is in
a block that has been exited.
>> We might as well also fix this other bug, which prevents the disassembler
>> from
>> working:
>>
>> diff -r f14bc589172e dis-gdb.fs
>> --- a/dis-gdb.fs Thu Apr 12 14:42:46 2012 +0100
>> +++ b/dis-gdb.fs Thu Apr 12 14:51:21 2012 +0100
>> @@ -25,7 +25,7 @@
>> : disasm-gdb { addr u -- }
>> base @ >r hex
>> s\" type mktemp >/dev/null && type gdb >/dev/null && file=`mktemp -t
>> gforthdis.XXXXXXXXXX` && file2=`mktemp -t gforthdis.XXXXXXXXXX` && echo
>> \"set verbose off\nset logging file $file\nset logging on\ndisas " save-mem
>> ( addr u addr1 u1 )
>> - addr 0 <<# bl hold # #s 'x hold # #> append-extend-string #>>
>> + addr 0 <<# bl hold ',' hold # #s 'x hold # #> append-extend-string #>>
>> addr u + 0 <<# # #s 'x hold # #> append-extend-string #>>
>> r> base ! cr
>> s\" \nset logging off\nquit\n\" >$file2 && gdb -nx -q -p `ps -p $$ -o
>> ppid=` -x $file2 2>/dev/null >/dev/null && rm $file2 && grep -v \"of
>> assembler\" $file && rm $file" append-extend-string
>
> This is from an incompatible syntax change in gdb 7.1. With this
> patch, gforth will no longer work with gdb 7.0 and earlier. The
> workaround for that is:
>
> http://www.complang.tuwien.ac.at/viewcvs/cgi-bin/viewcvs.cgi/gforth/dis-gdb.fs?r1=1.13&r2=1.8&makepatch=1&diff_format=h
Ohh, yuck.
Andrew.