i386 builds fail with GCC7 #385
Labels
No labels
api-spec
bug
CLA requested
CLA valid
compliance
DO NOT MERGE
duplicate
enhancement
feature branch
good first issue
HEADER FORMATTING ISSUE
help wanted
Information
invalid
Jira status: AWAITING REVIEW
Jira status: CLOSED
Jira status: DONE
Jira status: IN PROGRESS
Jira status: IN REVIEW
Jira status: OPEN
Jira status: REOPENED
Jira status: RESOLVED
mirrored
mirror internally
needs: backports
needs: ci
needs: design review
needs: preceding PR
needs: review
needs: work
notabug
open for community contribution
Product Backlog
question
ready for merge
security
stale
type: bug
type: enhancement
type: question
web pages
wontfix
writing
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-ARMmbed/mbed-crypto#385
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Building with GCC7, the
all.shtesttest_m32_everestcomponent fails with the following warning:In the test suite
test_suite_psathere's a test case function ofgenerate_random()which takesintas a parameterbytes_argand assigns it tobytesas asize_t. The parameter comes from the data file so comes in via standard IO so could be at the limit. Within this function, it makes a call to the macroASSERT_ALLOC(), passing that parameterbytes+sizeof(trail), without any boundary checks onbytesunchecked.Within
ASSERT_ALLOCthere is then a call tocallocthat takes a parameter of size assize_t, and passesbytes_arganintinto it.In the Everest m32 test, this is failing with the warning? Why? Well, we've moved from LP64, where
intis 32bits, andsize_tis 64 bits, to ILP32 whereintis 32bits andsize_tis 32 bits, leading to a potential underflow.This issue already has a PR to fix it with PR #377.
Issue request type
More precisely, GCC 7 emits this warning when building with UBSan (
-fsanitize=undefined) and-O2. It looks like a GCC bug where some transformations caused by an optimization such as inlining causes additional warnings that are not relevant to the original code. See https://github.com/ARMmbed/mbed-crypto/pull/377#issuecomment-593364500GCC bug or not, we do want our code to build without warnings on all non-ancient GCC versions.
This was fixed back in https://github.com/ARMmbed/mbed-crypto/pull/377, we just forgot to close the issue.