tests_suite_base64 build failure with C23 libc #876

Open
opened 2026-08-26 04:49:34 -05:00 by gilles-peskine-arm · 1 comment
gilles-peskine-arm commented 2026-08-26 04:49:34 -05:00 (Migrated from github.com)

The build fails with gcc -Wall -Wextra -Werror -O with GCC ≥15 in the full config:

../source/tests/suites/test_suite_base64.function: In function ‘test_dec_chars’:
../source/tests/suites/test_suite_base64.function:42:11: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
cc1: all warnings being treated as errors

More precisely, this warning pops up when the C language version is C23, not with earlier versions (C99, C11, C17). So this affects GCC ≥15 by default, and also affects earlier versions if you pass -std=c23 (or -std=c2x) explicitly. This does not affect most of our build components because we have -std=c11 in our default CFLAGS.

Observed on Ubuntu 26.04 with GCC 15.2 where this is the default compiler. Also observed with GCC 14.3 and GCC 16.1.

Affects 3.6 and development (and presumably 1.1). Only affects configurations with MBEDTLS_TEST_HOOKS enabled.

The build fails with `gcc -Wall -Wextra -Werror -O` with GCC ≥15 in the `full` config: ``` ../source/tests/suites/test_suite_base64.function: In function ‘test_dec_chars’: ../source/tests/suites/test_suite_base64.function:42:11: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] cc1: all warnings being treated as errors ``` More precisely, this warning pops up when the C language version is C23, not with earlier versions (C99, C11, C17). So this affects GCC ≥15 by default, and also affects earlier versions if you pass `-std=c23` (or `-std=c2x`) explicitly. This does not affect most of our build components because we have `-std=c11` in our default `CFLAGS`. Observed on Ubuntu 26.04 with GCC 15.2 where this is the default compiler. Also observed with GCC 14.3 and GCC 16.1. Affects 3.6 and development (and presumably 1.1). Only affects configurations with `MBEDTLS_TEST_HOOKS` enabled.
gilles-peskine-arm commented 2026-09-09 12:04:30 -05:00 (Migrated from github.com)

I can reproduce this with various compiler versions under Ubuntu 26.04, but not with the same compiler versions under Ubuntu 24.04. So it must have something to do with libc headers rather than the compiler version.

I can reproduce this with various compiler versions under Ubuntu 26.04, but not with the same compiler versions under Ubuntu 24.04. So it must have something to do with libc headers rather than the compiler version.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-Mbed-TLS/TF-PSA-Crypto#876
No description provided.