Opened 21 months ago

Last modified 13 months ago

#11777 new bug

RTS source code issues

Reported by: simonpj Owned by:
Priority: normal Milestone:
Component: Runtime System Version: 7.10.3
Keywords: newcomer Cc: tiagosilva@…, simonmar, erikd
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by thomie)

Tiago Silva <tiagosilva@…> writes: Last night I started looking at the C files used in GHC and noticed these issues [edit: this list now shows only those issues that haven't been fixed yet]:

  • driver/utils/dynwrapper.c:
    int main(int argc, char *argv[]) {
        void *p;

void *p is apparently unused, even if the compiler optimizes it away.. you should check if something went missing.

  • rts/RetainerSet.c:
    #elif defined(RETAINER_SCHEME_CC)
    // Retainer scheme 3: retainer = cost centre
    printRetainerSetShort(FILE *f, RetainerSet *rs, nat max_length)
        char tmp[max_length + 1];
        int size;
        nat j;

Unlike the other functions around it, this function does nothing. Its variables are also not unused?

  • rts/win32/IOManager.c:
    AddIORequest, AddDelayRequest, AddProcRequest functions

If (!ioMan || !wItem) the functions either return 0 or FALSE, but they don't free wItem before. Is this optimized by the compiler?

Change History (8)

comment:1 Changed 20 months ago by Simon Marlow <marlowsd@…>

In 83eb4fd/ghc:

Small simplification (#11777)

DEAD_WEAK used to have a different layout, see

comment:2 Changed 20 months ago by bgamari

Regarding RetainerSet.c, perhaps we should trim down some of the retainer schemes? It looks like we currently use RETAINER_SCHEME_CCS. Is there anyone using the other two?

comment:3 Changed 20 months ago by simonmar

No, I think it's all experimental code and probably doesn't work. Wouldn't hurt to delete it.

comment:4 Changed 20 months ago by Ben Gamari <ben@…>

In d77981ed/ghc:

rts/RetainerProfile: Remove unused local

Reported in #11777.

comment:5 Changed 19 months ago by thomie

Cc: erikd added
Component: CompilerRuntime System
Description: modified (diff)
Keywords: newcomer added

I removed some issues from the description that have since been fixed.

comment:6 Changed 19 months ago by erikd

I am in the process of cleaning up and generally improving the quality of the C code throughtout the RTS. At some point I intend to turn on more C compiler warning flags and that will undoubtedly turn up stuff like this.

comment:7 Changed 13 months ago by dobenour

erikd: any progress?

comment:8 Changed 13 months ago by erikd

I've been really busy with a new job the last 6 months, so no progress by me personally on this issue.

However there are at least 3 or 4 others currently working on cleaning up the RTS and they do seem t be making definite progress. There have been dozens of commits to the rts/ part of the tree in the last 6 months and only a small number of them were for new features.

Note: See TracTickets for help on using tickets.