New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bignum: excessively long string literal triggers clang precautionary warning #482

Closed
aaronmdjones opened this Issue May 17, 2016 · 3 comments

Comments

Projects
None yet
3 participants
@aaronmdjones
Copy link
Contributor

aaronmdjones commented May 17, 2016

When compiling bignum.c with clang, I receive the following warning:

mbedtls/library/bignum.c:1125:9: warning: string literal of length 4872 exceeds maximum length 4095 that ISO C99 compilers are required to support [-Woverlength-strings]
        MULADDC_INIT
        ^~~~~~~~~~~~
mbedtls/include/mbedtls/bn_mul.h:165:9: note: expanded from macro 'MULADDC_INIT'
        "movq   %3, %%rsi           \n\t"   \
        ^

It seems as if removing the trailing spaces before \n\t might be a good approach to reduce its length while not removing any instructions.

@ciarmcom

This comment has been minimized.

Copy link
Member

ciarmcom commented May 17, 2016

ARM Internal Ref: IOTSSL-772

@ciarmcom ciarmcom added the mirrored label May 17, 2016

@sbutcher-arm sbutcher-arm added the bug label May 17, 2016

@sbutcher-arm

This comment has been minimized.

Copy link
Collaborator

sbutcher-arm commented May 30, 2016

Thanks for the feedback. Can I ask what version of clang you are using? I haven't seen these warnings so far. I'm sure it's a legitimate issue, but I'd like to ensure I can reproduce it and make it part of our test regime before we fix it.

@aaronmdjones

This comment has been minimized.

Copy link
Contributor

aaronmdjones commented May 31, 2016

 $ clang -g -O2 -DMBEDTLS_CONFIG_FILE='"mbedtls-cfg.h"' -Isrc/include -Imbedtls/include \
   -Wall -Wextra -Wpedantic -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fPIC -DPIC \
   -Wa,--noexecstack -c -o mbedtls/library/bignum.o mbedtls/library/bignum.c

mbedtls/library/bignum.c:1125:9: warning: string literal of length 4872 exceeds maximum
                                          length 4095 that ISO C99 compilers are required
                                          to support [-Woverlength-strings]
        MULADDC_INIT
        ^~~~~~~~~~~~

mbedtls/include/mbedtls/bn_mul.h:165:9: note: expanded from macro 'MULADDC_INIT'
        "movq   %3, %%rsi           \n\t"   \
        ^

1 warning generated.
 $ clang --version
Debian clang version 3.5.0-10 (tags/RELEASE_350/final) (based on LLVM 3.5.0)
Target: x86_64-pc-linux-gnu
Thread model: posix

redtangent added a commit to redtangent/mbedtls that referenced this issue Sep 30, 2018

Strip trailing whitespace in bn_mul.h
Remove the trailing whitespace from the inline assembly for AMD64 target, to
overcome a warning in Clang, which was objecting to the string literal
generated by the inline assembly being greater than 4096 characters specified
by the ISO C99 standard. (-Woverlength-strings)

This is a cosmetic change and doesn't change the logic of the code in any way.

This change only fixes the problem for AMD64 target, and leaves other targets as
they are.

Fixes ARMmbed#482.

redtangent added a commit to redtangent/mbedtls that referenced this issue Sep 30, 2018

Add Changelog entry for ARMmbed#482
Add Changelog entry for inline assembly/literal strings too long issue with
Clang.

redtangent added a commit to redtangent/mbedtls that referenced this issue Sep 30, 2018

Add Changelog entry for ARMmbed#482
Add Changelog entry for inline assembly/literal strings too long issue with
Clang.

redtangent added a commit to redtangent/mbedtls that referenced this issue Oct 6, 2018

Strip trailing whitespace in bn_mul.h
Remove the trailing whitespace from the inline assembly for AMD64 target, to
overcome a warning in Clang, which was objecting to the string literal
generated by the inline assembly being greater than 4096 characters specified
by the ISO C99 standard. (-Woverlength-strings)

This is a cosmetic change and doesn't change the logic of the code in any way.

This change only fixes the problem for AMD64 target, and leaves other targets as
they are.

Fixes ARMmbed#482.

redtangent added a commit to redtangent/mbedtls that referenced this issue Oct 6, 2018

Add Changelog entry for ARMmbed#482
Add Changelog entry for inline assembly/literal strings too long issue with
Clang.

redtangent added a commit to redtangent/mbedtls that referenced this issue Oct 6, 2018

Strip trailing whitespace in bn_mul.h
Remove the trailing whitespace from the inline assembly for AMD64 target, to
overcome a warning in Clang, which was objecting to the string literal
generated by the inline assembly being greater than 4096 characters specified
by the ISO C99 standard. (-Woverlength-strings)

This is a cosmetic change and doesn't change the logic of the code in any way.

This change only fixes the problem for AMD64 target, and leaves other targets as
they are.

Fixes ARMmbed#482.

redtangent added a commit to redtangent/mbedtls that referenced this issue Oct 6, 2018

Add Changelog entry for ARMmbed#482
Add Changelog entry for inline assembly/literal strings too long issue with
Clang.

redtangent added a commit to redtangent/mbedtls that referenced this issue Oct 9, 2018

Add Changelog entry for ARMmbed#482
Add Changelog entry for inline assembly/literal strings too long issue with
Clang.

@Patater Patater closed this in #2039 Dec 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment