From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by sourceware.org (Postfix) with ESMTPS id 1BA973858D39 for ; Sat, 14 Jan 2023 10:50:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1BA973858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-x32a.google.com with SMTP id k22-20020a05600c1c9600b003d1ee3a6289so18919421wms.2 for ; Sat, 14 Jan 2023 02:50:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=e/k74FfaA+GvEL+yM7Tvu/Rx9Lrrq0pG6kR0KZkaip0=; b=npLm5rPJCo4Joc5pgMQ063IWUxQFj4ys00vaY4WnuvXZSDrcOaj4bXQ7BO3oksr7ca I+PUrXQidCsqCgxS47MYbBhm7RxCuqHFQD+kO2M+c2B1KxnxIxsWJbAfIF4QB5+Xz9Xw p/NQ5+Gry9nIDHryTNvhfC7AnLpi1ZtrhSNy1imgysZm7rpnr2jOEoeCBYDoytBuISYI /9k+sOGJe1SkYPQ06d1padl1hdeyZcoEbi8bpRaFvcVgOmKFH/kc8lSLdiMlhWyy5U/g HRORQzAdQou7lSglgqMJ3IcQrK+dP6ZmZo4aEgcPsan9IXpSmQi9LyUxxluQCw7IQ+GH Okaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=e/k74FfaA+GvEL+yM7Tvu/Rx9Lrrq0pG6kR0KZkaip0=; b=wOlVV2e0iROqE3r04kNo4agF7tP5LcPbFT6Pt7JoSa3Opt9S+uqp7X1ou4Mxlthaug FHMF3xH+qGCKnyTws1po+L0k4kwE2dI/XBlz5fZV8GvJMcYqWDn9j5y6rz+Z87phffEm HdH4ajU+Z/6YpjdHLwzuvlKt6VME2GRje6wk9yQ4OXFNPJvtGHaNdNBjemuzpMbTslmy Z32HIEZI7SU12g1sCioH0mkHPdoIdF5OcPbcouyyV+HN+zdNKKa1DEoEyB5Qni4B4bQD wND77AlxvvtgcvEyHmjmYKe4Rrglf+i0ZTW/g2RhneMtSWlpDWBbWChSwQGssFaAz+2M TTuQ== X-Gm-Message-State: AFqh2kpk2Br4xRVyQ81Y+KdhVDOAj4o6j5Vl2kIFjIVRtoClAgCEJlsW RvVBUZX8z1Y/wt88Gj8khFvy1T8yBCg= X-Google-Smtp-Source: AMrXdXv7zcygoq7jsxZhDseNgcpg/tw9mXU7CoVveJUcbE3A8EHOup2+jWxBakKrBUSAAbDimS2hXg== X-Received: by 2002:a05:600c:3b22:b0:3c6:e63e:814b with SMTP id m34-20020a05600c3b2200b003c6e63e814bmr60106782wms.2.1673693447514; Sat, 14 Jan 2023 02:50:47 -0800 (PST) Received: from localhost.localdomain (host81-138-1-83.in-addr.btopenworld.com. [81.138.1.83]) by smtp.gmail.com with ESMTPSA id j15-20020a5d452f000000b0028f9132e9ddsm21064159wra.39.2023.01.14.02.50.46 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 14 Jan 2023 02:50:47 -0800 (PST) From: Iain Sandoe X-Google-Original-From: Iain Sandoe To: gcc-patches@gcc.gnu.org Cc: gaiusmod2@gmail.com Subject: [PATCH] modula-2: Fix stack size request in initPreemptive [PR108405] Date: Sat, 14 Jan 2023 10:50:46 +0000 Message-Id: <20230114105046.35020-1-iain@sandoe.co.uk> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) Reply-To: iain@sandoe.co.uk MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Given that, currently, this value is not configurable per target the short-term solution is to avoid a bad request. Tested on x86_64-darwin21, OK for trunk? thanks Iain --- 8< --- As noted in the PR, the problem is that we make a request for additional stack that violates the constraints on some systems. This patch chooses a value that is divisible by common OS page sizes. TODO: the user value should be checked and then an exception thrown if it is not suitable. Signed-off-by: Iain Sandoe PR modula2/108405 gcc/m2/ChangeLog: * gm2-libs-iso/Preemptive.mod (initPreemptive): Use a value for extra space that is divisible by common OS pagesizes. --- gcc/m2/gm2-libs-iso/Preemptive.mod | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/m2/gm2-libs-iso/Preemptive.mod b/gcc/m2/gm2-libs-iso/Preemptive.mod index 59940b6bae8..e747028d5be 100644 --- a/gcc/m2/gm2-libs-iso/Preemptive.mod +++ b/gcc/m2/gm2-libs-iso/Preemptive.mod @@ -33,6 +33,9 @@ FROM libc IMPORT printf ; CONST debugging = FALSE ; + (* The space we request becomes part of a stack request, which generally + has constraints on size and alignment. *) + extraWorkSpace = 10 * 1024 * 1024 ; (* timer - the timer process which runs at maximum scheduling priority with @@ -107,7 +110,7 @@ BEGIN IF NOT init THEN init := TRUE ; - Create (timer, 10000000, MAX (Urgency), NIL, timerId) ; + Create (timer, extraWorkSpace, MAX (Urgency), NIL, timerId) ; Activate (timerId) END END initPreemptive ; -- 2.37.1 (Apple Git-137.1)