public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug modula2/108405] New: modula-2: Testsuite fails: concurrentstore.mod, contimer.mod, tinytimer.mod on Darwin (and likely elsewhere)
@ 2023-01-14 10:12 iains at gcc dot gnu.org
  2023-01-14 10:14 ` [Bug modula2/108405] " iains at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: iains at gcc dot gnu.org @ 2023-01-14 10:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108405

            Bug ID: 108405
           Summary: modula-2: Testsuite fails: concurrentstore.mod,
                    contimer.mod, tinytimer.mod on Darwin (and likely
                    elsewhere)
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: modula2
          Assignee: gaius at gcc dot gnu.org
          Reporter: iains at gcc dot gnu.org
  Target Milestone: ---

The test cases in the subject all fail on Darwin for the same reason, there is
an attempt to set a stack size that violates the constraints of
pthread_attr_setstacksize.

On Darwin;
     pthread_attr_setstacksize() will fail if:
     [EINVAL]           stacksize is less than PTHREAD_STACK_MIN
     [EINVAL]           stacksize is not a multiple of the system page size.

On Linux:
       pthread_attr_setstacksize() can fail with the following error:

       EINVAL The stack size is less than PTHREAD_STACK_MIN (16384) bytes.
       On some systems, pthread_attr_setstacksize() can fail with the error
EINVAL if stacksize is not a multiple of the system page size.

--- So the report reported on Darwin might well occur also on (at least some)
Linux systems.

The problem is in
 PROCEDURE initPreemptive (seconds, microsecs: CARDINAL) ;
which tries to call 
 Create (timer, 10000000, MAX (Urgency), NIL, timerId) ;

Where 10000000 violates the constraints on stack size (definitely on Darwin,
maybe on some Linux).

So .. the short-term solution is to fix initPreemptive to use a suitable value
(patch to be posted).

However:

1. We should have detected the bad user value earlier and thrown an exception?
2. It is not clear to me how these magic numbers (embedded in the library) have
been chosen (there is 8Mb as defaultSize and then here we add 10Mb)  perhaps
this is something that should be configured or at least set according to a
target query?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug modula2/108405] modula-2: Testsuite fails: concurrentstore.mod, contimer.mod, tinytimer.mod on Darwin (and likely elsewhere)
  2023-01-14 10:12 [Bug modula2/108405] New: modula-2: Testsuite fails: concurrentstore.mod, contimer.mod, tinytimer.mod on Darwin (and likely elsewhere) iains at gcc dot gnu.org
@ 2023-01-14 10:14 ` iains at gcc dot gnu.org
  2023-01-14 10:24 ` iains at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: iains at gcc dot gnu.org @ 2023-01-14 10:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108405

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-darwin
           Keywords|                            |testsuite-fail

--- Comment #1 from Iain Sandoe <iains at gcc dot gnu.org> ---
note that a default size of 8Mb is not enough for either Linux or Arm64 Darwin
(both have PTHREAD_STACK_MIN of 16384).

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug modula2/108405] modula-2: Testsuite fails: concurrentstore.mod, contimer.mod, tinytimer.mod on Darwin (and likely elsewhere)
  2023-01-14 10:12 [Bug modula2/108405] New: modula-2: Testsuite fails: concurrentstore.mod, contimer.mod, tinytimer.mod on Darwin (and likely elsewhere) iains at gcc dot gnu.org
  2023-01-14 10:14 ` [Bug modula2/108405] " iains at gcc dot gnu.org
@ 2023-01-14 10:24 ` iains at gcc dot gnu.org
  2023-01-14 10:31 ` schwab@linux-m68k.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: iains at gcc dot gnu.org @ 2023-01-14 10:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108405

--- Comment #2 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Iain Sandoe from comment #1)
> note that a default size of 8Mb is not enough for either Linux or Arm64
> Darwin (both have PTHREAD_STACK_MIN of 16384).

this is, of course, rubbish .. the default is 8Mb not 8k (which is fine for
both 4096 and 16384 page sizes).

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug modula2/108405] modula-2: Testsuite fails: concurrentstore.mod, contimer.mod, tinytimer.mod on Darwin (and likely elsewhere)
  2023-01-14 10:12 [Bug modula2/108405] New: modula-2: Testsuite fails: concurrentstore.mod, contimer.mod, tinytimer.mod on Darwin (and likely elsewhere) iains at gcc dot gnu.org
  2023-01-14 10:14 ` [Bug modula2/108405] " iains at gcc dot gnu.org
  2023-01-14 10:24 ` iains at gcc dot gnu.org
@ 2023-01-14 10:31 ` schwab@linux-m68k.org
  2023-01-23 17:26 ` cvs-commit at gcc dot gnu.org
  2023-01-23 17:31 ` iains at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: schwab@linux-m68k.org @ 2023-01-14 10:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108405

--- Comment #3 from Andreas Schwab <schwab@linux-m68k.org> ---
NPTL does not have the alignment restriction.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug modula2/108405] modula-2: Testsuite fails: concurrentstore.mod, contimer.mod, tinytimer.mod on Darwin (and likely elsewhere)
  2023-01-14 10:12 [Bug modula2/108405] New: modula-2: Testsuite fails: concurrentstore.mod, contimer.mod, tinytimer.mod on Darwin (and likely elsewhere) iains at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-01-14 10:31 ` schwab@linux-m68k.org
@ 2023-01-23 17:26 ` cvs-commit at gcc dot gnu.org
  2023-01-23 17:31 ` iains at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-23 17:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108405

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>:

https://gcc.gnu.org/g:bcc023e2b4dd0dc1fd1fca3ea12664d5bdade4dc

commit r13-5307-gbcc023e2b4dd0dc1fd1fca3ea12664d5bdade4dc
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Sat Jan 14 10:20:47 2023 +0000

    modula-2: Fix stack size request in initPreemptive [PR108405]

    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 <iain@sandoe.co.uk>

            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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug modula2/108405] modula-2: Testsuite fails: concurrentstore.mod, contimer.mod, tinytimer.mod on Darwin (and likely elsewhere)
  2023-01-14 10:12 [Bug modula2/108405] New: modula-2: Testsuite fails: concurrentstore.mod, contimer.mod, tinytimer.mod on Darwin (and likely elsewhere) iains at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-01-23 17:26 ` cvs-commit at gcc dot gnu.org
@ 2023-01-23 17:31 ` iains at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: iains at gcc dot gnu.org @ 2023-01-23 17:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108405

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #5 from Iain Sandoe <iains at gcc dot gnu.org> ---
so fixed on trunk.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-01-23 17:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-14 10:12 [Bug modula2/108405] New: modula-2: Testsuite fails: concurrentstore.mod, contimer.mod, tinytimer.mod on Darwin (and likely elsewhere) iains at gcc dot gnu.org
2023-01-14 10:14 ` [Bug modula2/108405] " iains at gcc dot gnu.org
2023-01-14 10:24 ` iains at gcc dot gnu.org
2023-01-14 10:31 ` schwab@linux-m68k.org
2023-01-23 17:26 ` cvs-commit at gcc dot gnu.org
2023-01-23 17:31 ` iains at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).