Menu

#256 Programming error in QP/C++ posix port

QPCPP
closed
None
1
2024-08-01
2020-01-22
Anonymous
No

It appears a bug in the posix port of QP/C++ was instroduced in version 6.7.0.

In version 6.6.0 the QActive::start function prototype included:

uint_fast16_t stkSize

But in version 6.7.0 it was changed to:

uint_fast16_t const stkSize

Later in the function we have the following:

// stack size not provided?
if (stkSize == 0U) {
    // set the allowed minimum
    stkSize = (uint_fast16_t)PTHREAD_STACK_MIN;
}

We get an error when compiling since we're trying to change a constant variable. Also it looks like this variable isn't actually used in the function. Maybe just a (void*)stkSize; at the top of the function?

Discussion

  • Quantum Leaps

    Quantum Leaps - 2020-01-22

    Yes, this bug has been introduced while trying to satisfy MISRA complance (parameter could be defined const). The bug will be fixed in the next upcoming QP/C++ 6.8.0.

    For now, the recommended fix is to remove the code:

    // stack size not provided?
    if (stkSize == 0U) {
        // set the allowed minimum
        stkSize = (uint_fast16_t)PTHREAD_STACK_MIN;
    }
    

    And to add:

    (void)stkSize; // unused parameter in the POSIX port
    

    --MMS

     

    Last edit: Quantum Leaps 2020-03-17
  • Anonymous

    Anonymous - 2020-01-24

    Thanks! Really appreciate the help!

     
  • Quantum Leaps

    Quantum Leaps - 2020-05-07
    • status: accepted --> closed
     
  • Quantum Leaps

    Quantum Leaps - 2020-05-07

    Fixed in QP/C++ 6.8.0.
    --MMS

     

Anonymous
Anonymous

Add attachments
Cancel