[gambit-list] When gsc makes gcc unhappy with symbol redefinitions

Marc Feeley feeley at iro.umontreal.ca
Wed May 10 08:12:06 EDT 2017


In your file I see these expressions:

  (define std/srfi/14#:char-set
    (make-struct-type '#::char-set3224 '#f '1 ':char-set '((fields: s)) '#f))

  (if (##structure-instance-of? _bcs3729_ '#::char-set3224) ...)

Note that #::char-set3224 appears multiple times, and it is an *uninterned* symbol.  When the parser reads these uninterned symbols, multiple independent symbols with the same name are created.  So your code is faulty because you will not get the same uninterned symbol (as you probably intended).

The error message you are getting is due to the Gambit compiler not handling this faulty case well.  I will add a better handling of this (not generating identically named #defines) but still that will not make your code work as intended.

Marc



> On May 10, 2017, at 6:19 AM, Dimitris Vyzovitis <vyzo at hackzen.org> wrote:
> 
> Bringing this up to the list, because this is an interesting output from gsc and the file attachment feature of github doesn't work.
> So I have this file which is the compiled output of gxc for srfi-14, with some optimizations applied (namely inlining of struct ops in this case).
> This results to gsc generating a bunch of cascading redefinitions, which result in gcc warnings.
> 
> > gsc 14__0.scm 
> 14__0.c:337:0: warning: "___SYM__3a_char_2d_set3224" redefined
>  #define ___SYM__3a_char_2d_set3224 ___SYM(3,___S__3a_char_2d_set3224)
>  ^
> 14__0.c:336:0: note: this is the location of the previous definition
>  #define ___SYM__3a_char_2d_set3224 ___SYM(2,___S__3a_char_2d_set3224)
>  ^
> 14__0.c:338:0: warning: "___SYM__3a_char_2d_set3224" redefined
>  #define ___SYM__3a_char_2d_set3224 ___SYM(4,___S__3a_char_2d_set3224)
>  ^
> 14__0.c:337:0: note: this is the location of the previous definition
>  #define ___SYM__3a_char_2d_set3224 ___SYM(3,___S__3a_char_2d_set3224)
>  ^
> 14__0.c:339:0: warning: "___SYM__3a_char_2d_set3224" redefined
>  #define ___SYM__3a_char_2d_set3224 ___SYM(5,___S__3a_char_2d_set3224)
>  ^
> 14__0.c:338:0: note: this is the location of the previous definition
>  #define ___SYM__3a_char_2d_set3224 ___SYM(4,___S__3a_char_2d_set3224)
>  ^
> 
> So what's up with that?
> 
> -- vyzo
> <14__0.scm>_______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list




More information about the Gambit-list mailing list