[gambit-list] Puzzlement (different behavior of compiled code)

Mikael mikael.rcv at gmail.com
Sun Jun 10 10:44:38 EDT 2012


I cannot see any possibility that the compiler would confuse things in such
a way that instead of doing (string->keyword "path") it does
(string->symbol "path:") . Can you please reduce this bug to its simplest
form and tell the outcome here? This ought to shed light over what's wrong.

Brgds

2012/6/10 David Rush <kumoyuki at gmail.com>

> On 10 June 2012 14:31, Mikael <mikael.rcv at gmail.com> wrote:
> >
> > Uh this is funny:
> >
> > (open-output-file '(|path:| "test.flog" |create:| maybe |append:| #t))
> >
> > look there, there's  |:s around the keywords. This means they're *not*
> > actually keywords but *symbols* that kind of look like keywords.
>
> That is interesting. I have no idea why, as I said it's the same code
> in both cases (code was included in the tail of the OP)
>
> > Tried to reproduce your error on 4.6.2:
> >
> > $ cat a.scm
> > (write (cons abcde: 123))
> > $ gsi a.scm
> > (abcde: . 123)$ gsc -exe a.scm
> > $ ./a
> > (abcde: . 123)
>
> I wonder if mine is a case that occurs because the code renames cons
> (in an attempt to avoid variable capture while expanding macros) so
> that instead of cons the var referenced is actually _cons_23 - leading
> to compiler confusion about special cases.
>
> > Do you compile this code just with gsc filename.scm  or (compile-file
> > "filename.scm") or do you have some preprocessor on it?
>
> from the original message:
>
> -----------------------------------------------------------------------
> drr at dibbuk$ make target=gambit test/bug.gambit
> gsc -:s -link test/bug.Gambit
> gcc -I/home/drr/include test/bug.c test/bug_.c -o test/bug.gambit \
>               -L/home/drr/lib -lgambc -lm -lutil -ldl
> ------------------------------------------------------------------------
>
> which is something of a habit i have with Gambit going back many years
> in order to actually insert a lot of gcc optimization flags (*not*
> included in this test case)
>
> > Do you see any other reasons for why this occured?
>
> just what I suggested above. It gives me something to try anyway.
>
> d
> --
> GPG Public key at http://cyber-rush.org/drr/gpg-public-key.txt
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20120610/08e2e327/attachment.htm>


More information about the Gambit-list mailing list