RTEMS | _Processor_mask_Find_last_set() use breaks GCC14+ builds using "-std" flags (#5501)

Matteo Concas (@matteo.concas) gitlab at rtems.org
Thu Feb 26 13:33:51 UTC 2026



Matteo Concas created an issue: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5501



## Summary

`_Processor_mask_Find_last_set()` calls the `flsl()` function. This function is declared in `strings.h` but behind a `__BSD_VISIBLE` guard (which is 0 in our case). This means it is effectively not declared, this is fine most of the time but when using `-std=c11` (or another standard like C99) it will throw an "implicit declaration of function 'flsl' [-Wimplicit-function-declaration]" error.

## Steps to reproduce

Add "-std=c11" to your flags and compile a binary making use of `_Processor_mask_Find_last_set()` will give you this:

```bash
/prefix/bsp/lib/include/rtems/score/processormaskimpl.h: In function '_Processor_mask_Find_last_set':
/prefix/bsp/lib/include/rtems/score/processormaskimpl.h:285:21: error: implicit declaration of function 'flsl' [-Wimplicit-function-declaration]
  285 |   return (uint32_t) __BIT_FLS( CPU_MAXIMUM_PROCESSORS, a );
      |                     ^~~~~~~~~
```

Using `-std=gnu11` instead will "fix" it but we should probably use something else like `__builtin_ctzl()` instead.

<!--Pre-set options
- milestone-->

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5501
You're receiving this email because of your account on gitlab.rtems.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260226/c8f62969/attachment.htm>


More information about the bugs mailing list