[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
gcc-bugzilla@gcc.gnu.org
Sat Jan 14 10:12:18 GMT 2023
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?
More information about the Gcc-bugs
mailing list