chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] A question on C_reclaim


From: Jörg F . Wittenberger
Subject: [Chicken-users] A question on C_reclaim
Date: 14 Oct 2011 20:55:34 +0200

Hi,

I'm again getting complaints from valgrind and now gcc, since I
begin to compile runtime.c with -Wall -Wno-unused (at this time).

Reading the source wrt. the warnings (I'm afraid those might end
up under -OX as code which will in reward trigger valgrind more
or less reasonably.)

In increasing importance:

1) gcc warns in C_reclaim about possibly being used without
  initialisation.  I believe gcc just did not get that gc_mode
  == GC_MAJOR && C_enable_gcweak ...

  Since this is the same issue as with the exactf these days
http://lists.nongnu.org/archive/html/chicken-users/2011-10/msg00067.html
  I'm afraid I better don't trust gcc too much here.

  For aesthetic reasons I'd rather get it shut.
  I'm more comfortable if the compiler is quite.

  As solution I'd intent to use "int weakn=0" .

2) gcc believes that "start" might be used be fore initialization

  The code is too complicated for me to prove it wrong.

  For the sake of safety I'd change the declaration to:

    C_byte *tmp, *start = C_fromspace_top;

  and at line 2698 (wrt. git master, the "if" of the
  "Entry point for second-level GC") just use "start", which
  already has the valud from C_fromspace_top.

3.) The actual question:

   gcc claims tgc used without initialization.
   Pertains to
     if(C_post_gc_hook != NULL) C_post_gc_hook(gc_mode, tgc);

   In fact tgc appears to me to be assigned on GC_MAJOR exclusively.
   I don't know enough about the semantics of C_post_gc_hook
   (though I assume it's almost always the NULL it is initially.)

   I'd pull the call into the conditional just above like this:

 if(gc_mode == GC_MAJOR) {
   gc_count_1 = 0;
   if(C_post_gc_hook != NULL) C_post_gc_hook(gc_mode, tgc);
 }


Could this break things anywhere else?

Bwst Regards

/Jörg






reply via email to

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