Ticket #3910: 0001-Use-signed-comparison-for-RTS-N-x-0-test.patch

File 0001-Use-signed-comparison-for-RTS-N-x-0-test.patch, 1.3 KB (added by duncan, 7 months ago)

Patch: Use signed comparison for +RTS -N x <= 0 test

  • rts/RtsFlags.c

    From 1eae02d09dc4ff201b2604317ad64b9e56f15cb1 Mon Sep 17 00:00:00 2001
    From: Duncan Coutts <duncan@well-typed.com>
    Date: Thu, 27 Oct 2011 13:16:24 +0100
    Subject: [PATCH 1/2] Use signed comparison for +RTS -N x <= 0 test
    
    Otherwise we can use +RTS -N-1 and get 2^32 or 2^64 capabilities
    which doesn't work out so well...
    ---
     rts/RtsFlags.c |    9 +++++----
     1 files changed, 5 insertions(+), 4 deletions(-)
    
    diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c
    index dcfedc0..d6da873 100644
    a b  
    10741074                    RtsFlags.ParFlags.nNodes = getNumberOfProcessors(); 
    10751075#endif 
    10761076                } else { 
    1077                     RtsFlags.ParFlags.nNodes 
    1078                       = strtol(rts_argv[arg]+2, (char **) NULL, 10); 
    1079                     if (RtsFlags.ParFlags.nNodes <= 0) { 
     1077                    int nNodes; 
     1078                    nNodes = strtol(rts_argv[arg]+2, (char **) NULL, 10); 
     1079                    if (nNodes <= 0) { 
    10801080                      errorBelch("bad value for -N"); 
    10811081                      error = rtsTrue; 
    10821082                    } 
    10831083#if defined(PROFILING) 
    1084                     if (RtsFlags.ParFlags.nNodes > 1) { 
     1084                    if (nNodes > 1) { 
    10851085                        errorBelch("bad option %s: only -N1 is supported with profiling", rts_argv[arg]); 
    10861086                      error = rtsTrue; 
    10871087                    } 
    10881088#endif 
     1089                    RtsFlags.ParFlags.nNodes = (nat)nNodes; 
    10891090                } 
    10901091                ) break; 
    10911092