Menu

#405 Problem with GLIBC > 2.34

3.0.0.0
closed
2355 (1)
2024-02-05
2022-12-01
No

In file src/vos/posix/vos_thread.c the following initialization is performed:

const size_t    cDefaultStackSize   = 4u * PTHREAD_STACK_MIN;

In glibc versions over 2.34, PTHREAD_STACK_MIN macro can not be considered as constant, since it is defined as follows:

#   define PTHREAD_STACK_MIN __sysconf (__SC_THREAD_STACK_MIN_VALUE)

In theory, sysconf can return -1, so the compiler claims that initialization is not constant:

src/vos/posix/vos_thread.c:81:39: error: initializer element is not constant
   81 | const size_t    cDefaultStackSize   = 4u * PTHREAD_STACK_MIN;

A temporal fix is to change cDefaultStackSize initialization with a define like the following:

#define cDefaultStackSize (4u * PTHREAD_STACK_MIN)

No patch is provided since it would be needed to analize implications of this workaround.

Regards,
Adrian

Discussion

  • Adrian Moran

    Adrian Moran - 2022-12-01
    • Milestone: 2.1.0.0 --> 2.2.0.0
     
  • Chris Wetzler

    Chris Wetzler - 2022-12-15
    • assigned_to: Adrian Moran --> Chris Wetzler
     
  • Chris Wetzler

    Chris Wetzler - 2022-12-15

    ... yes, already saw same here with Ubuntu 22.04 and gcc-11

     
  • Armin-Hagen Weiss

    • labels: --> 2355
    • status: open --> pending
     
  • Armin-Hagen Weiss

    Patched like proposed. Additional check of cDefaultStackSize added.

     
  • Armin-Hagen Weiss

    • status: pending --> closed
    • assigned_to: Chris Wetzler --> Armin-Hagen Weiss
     
  • Armin-Hagen Weiss

    Definition of the default stack size changed fom constand to #define and additional check added.

     

Log in to post a comment.

MongoDB Logo MongoDB