C++ clang UBsan suppression flag name












4















Running the gzip.hpp code from boost version 1.64 with clang's ubsan gives the following message:



path/to/boost/1_64_0/include/boost/iostreams/filter/gzip.hpp:674:16: runtime error: implicit conversion from type 'int' of value 139 (32-bit, signed) to type 'char' changed the value to -117 (8-bit, signed)
#0 0x7fed40b77bc2 in boost::iostreams::basic_gzip_compressor<std::allocator<char> >::basic_gzip_compressor(boost::iostreams::gzip_params const&, long)


I'd like to suppress this with with a suppression file. For other warnings this has worked:



 unsigned-integer-overflow:path/to/boost/*


In this case I would expect that this should work



implicit-integer-sign-change:/lfs/vlsi/tools/boost/*


but it gives at runtime



UndefinedBehaviorSanitizer: failed to parse suppressions


What is the right name of this sanatizer flag?



See also: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#runtime-suppressions



and from https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#available-checks




-fsanitize=implicit-integer-sign-change: Implicit conversion between integer types, if that changes the sign of the value. That is, if the
the original value was negative and the new value is positive (or
zero), or the original value was positive, and the new value is
negative. Issues caught by this sanitizer are not undefined behavior,
but are often unintentional.











share|improve this question





























    4















    Running the gzip.hpp code from boost version 1.64 with clang's ubsan gives the following message:



    path/to/boost/1_64_0/include/boost/iostreams/filter/gzip.hpp:674:16: runtime error: implicit conversion from type 'int' of value 139 (32-bit, signed) to type 'char' changed the value to -117 (8-bit, signed)
    #0 0x7fed40b77bc2 in boost::iostreams::basic_gzip_compressor<std::allocator<char> >::basic_gzip_compressor(boost::iostreams::gzip_params const&, long)


    I'd like to suppress this with with a suppression file. For other warnings this has worked:



     unsigned-integer-overflow:path/to/boost/*


    In this case I would expect that this should work



    implicit-integer-sign-change:/lfs/vlsi/tools/boost/*


    but it gives at runtime



    UndefinedBehaviorSanitizer: failed to parse suppressions


    What is the right name of this sanatizer flag?



    See also: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#runtime-suppressions



    and from https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#available-checks




    -fsanitize=implicit-integer-sign-change: Implicit conversion between integer types, if that changes the sign of the value. That is, if the
    the original value was negative and the new value is positive (or
    zero), or the original value was positive, and the new value is
    negative. Issues caught by this sanitizer are not undefined behavior,
    but are often unintentional.











    share|improve this question



























      4












      4








      4








      Running the gzip.hpp code from boost version 1.64 with clang's ubsan gives the following message:



      path/to/boost/1_64_0/include/boost/iostreams/filter/gzip.hpp:674:16: runtime error: implicit conversion from type 'int' of value 139 (32-bit, signed) to type 'char' changed the value to -117 (8-bit, signed)
      #0 0x7fed40b77bc2 in boost::iostreams::basic_gzip_compressor<std::allocator<char> >::basic_gzip_compressor(boost::iostreams::gzip_params const&, long)


      I'd like to suppress this with with a suppression file. For other warnings this has worked:



       unsigned-integer-overflow:path/to/boost/*


      In this case I would expect that this should work



      implicit-integer-sign-change:/lfs/vlsi/tools/boost/*


      but it gives at runtime



      UndefinedBehaviorSanitizer: failed to parse suppressions


      What is the right name of this sanatizer flag?



      See also: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#runtime-suppressions



      and from https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#available-checks




      -fsanitize=implicit-integer-sign-change: Implicit conversion between integer types, if that changes the sign of the value. That is, if the
      the original value was negative and the new value is positive (or
      zero), or the original value was positive, and the new value is
      negative. Issues caught by this sanitizer are not undefined behavior,
      but are often unintentional.











      share|improve this question
















      Running the gzip.hpp code from boost version 1.64 with clang's ubsan gives the following message:



      path/to/boost/1_64_0/include/boost/iostreams/filter/gzip.hpp:674:16: runtime error: implicit conversion from type 'int' of value 139 (32-bit, signed) to type 'char' changed the value to -117 (8-bit, signed)
      #0 0x7fed40b77bc2 in boost::iostreams::basic_gzip_compressor<std::allocator<char> >::basic_gzip_compressor(boost::iostreams::gzip_params const&, long)


      I'd like to suppress this with with a suppression file. For other warnings this has worked:



       unsigned-integer-overflow:path/to/boost/*


      In this case I would expect that this should work



      implicit-integer-sign-change:/lfs/vlsi/tools/boost/*


      but it gives at runtime



      UndefinedBehaviorSanitizer: failed to parse suppressions


      What is the right name of this sanatizer flag?



      See also: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#runtime-suppressions



      and from https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#available-checks




      -fsanitize=implicit-integer-sign-change: Implicit conversion between integer types, if that changes the sign of the value. That is, if the
      the original value was negative and the new value is positive (or
      zero), or the original value was positive, and the new value is
      negative. Issues caught by this sanitizer are not undefined behavior,
      but are often unintentional.








      c++ clang++ ubsan






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 25 '18 at 10:32







      Elrond1337

















      asked Nov 25 '18 at 10:14









      Elrond1337Elrond1337

      153212




      153212
























          2 Answers
          2






          active

          oldest

          votes


















          2














          I have been helped on the llvm cfe-dev mailing list



          TLDR: The name of the warning type is not implicit-integer-sign-change but instead implicit-integer-truncation which can be suppressed as expected. The name of the error type can be found out using export UBSAN_OPTIONS=report_error_type=1.






          share|improve this answer































            0














            According to this very documentation you're reading you suppress UBSan messages using the following step :




            Disabling Instrumentation
            with__attribute__((no_sanitize("undefined")))¶



            You disable UBSan checks for particular functions
            with __attribute__((no_sanitize("undefined"))). You can use all values
            of -fsanitize= flag in this attribute, e.g. if your function
            deliberately contains possible signed integer overflow, you can
            use__attribute__((no_sanitize("signed-integer-overflow"))).



            This attribute may not be supported by other compilers, so consider
            using it together with #ifdefined(clang).




            So what you should do is: check the documentation in the same page for what you want to suppress and conjugate it with use__attribute__((no_sanitize("here_goes_checks_you_want_to_suppress"))). or use__attribute__((no_sanitize("undefined"))). to disable UBSan altogether.



            Apart of that seems UBSan is throwing a SIGNED integer overflow and you're trying to suppress UNSIGNED integer overflow.



            LINKS: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html






            share|improve this answer
























            • The __attribute__ way is only one way to suppress UBsan messages. Runtime suppressions are the alternative I'd like to use, since I don't want to alter the boost library. As for the unsigned-integer-overflow: This is the flag I was able to use for a different boost warning.

              – Elrond1337
              Nov 25 '18 at 11:04













            • Have you tried using signed-integer-overflow:path/to/boost/1_64_0/include/boost/iostreams/filter/gzip.hpp?

              – Ezequiel Barbosa
              Nov 25 '18 at 11:23











            • I personally doubt very much you can suppress this specific error using anything other than signed-integer-overflow since that's clearly the issue UBSan is catching

              – Ezequiel Barbosa
              Nov 25 '18 at 11:24











            • I must disappoint you, signed-integer-overflow does get parsed but the gzip.hpp still gets reported.

              – Elrond1337
              Nov 26 '18 at 6:58











            • The question is specifically about runtime UBSan suppressions.

              – yugr
              Nov 26 '18 at 7:38











            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53466501%2fc-clang-ubsan-suppression-flag-name%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            I have been helped on the llvm cfe-dev mailing list



            TLDR: The name of the warning type is not implicit-integer-sign-change but instead implicit-integer-truncation which can be suppressed as expected. The name of the error type can be found out using export UBSAN_OPTIONS=report_error_type=1.






            share|improve this answer




























              2














              I have been helped on the llvm cfe-dev mailing list



              TLDR: The name of the warning type is not implicit-integer-sign-change but instead implicit-integer-truncation which can be suppressed as expected. The name of the error type can be found out using export UBSAN_OPTIONS=report_error_type=1.






              share|improve this answer


























                2












                2








                2







                I have been helped on the llvm cfe-dev mailing list



                TLDR: The name of the warning type is not implicit-integer-sign-change but instead implicit-integer-truncation which can be suppressed as expected. The name of the error type can be found out using export UBSAN_OPTIONS=report_error_type=1.






                share|improve this answer













                I have been helped on the llvm cfe-dev mailing list



                TLDR: The name of the warning type is not implicit-integer-sign-change but instead implicit-integer-truncation which can be suppressed as expected. The name of the error type can be found out using export UBSAN_OPTIONS=report_error_type=1.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 28 at 8:03









                Elrond1337Elrond1337

                153212




                153212

























                    0














                    According to this very documentation you're reading you suppress UBSan messages using the following step :




                    Disabling Instrumentation
                    with__attribute__((no_sanitize("undefined")))¶



                    You disable UBSan checks for particular functions
                    with __attribute__((no_sanitize("undefined"))). You can use all values
                    of -fsanitize= flag in this attribute, e.g. if your function
                    deliberately contains possible signed integer overflow, you can
                    use__attribute__((no_sanitize("signed-integer-overflow"))).



                    This attribute may not be supported by other compilers, so consider
                    using it together with #ifdefined(clang).




                    So what you should do is: check the documentation in the same page for what you want to suppress and conjugate it with use__attribute__((no_sanitize("here_goes_checks_you_want_to_suppress"))). or use__attribute__((no_sanitize("undefined"))). to disable UBSan altogether.



                    Apart of that seems UBSan is throwing a SIGNED integer overflow and you're trying to suppress UNSIGNED integer overflow.



                    LINKS: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html






                    share|improve this answer
























                    • The __attribute__ way is only one way to suppress UBsan messages. Runtime suppressions are the alternative I'd like to use, since I don't want to alter the boost library. As for the unsigned-integer-overflow: This is the flag I was able to use for a different boost warning.

                      – Elrond1337
                      Nov 25 '18 at 11:04













                    • Have you tried using signed-integer-overflow:path/to/boost/1_64_0/include/boost/iostreams/filter/gzip.hpp?

                      – Ezequiel Barbosa
                      Nov 25 '18 at 11:23











                    • I personally doubt very much you can suppress this specific error using anything other than signed-integer-overflow since that's clearly the issue UBSan is catching

                      – Ezequiel Barbosa
                      Nov 25 '18 at 11:24











                    • I must disappoint you, signed-integer-overflow does get parsed but the gzip.hpp still gets reported.

                      – Elrond1337
                      Nov 26 '18 at 6:58











                    • The question is specifically about runtime UBSan suppressions.

                      – yugr
                      Nov 26 '18 at 7:38
















                    0














                    According to this very documentation you're reading you suppress UBSan messages using the following step :




                    Disabling Instrumentation
                    with__attribute__((no_sanitize("undefined")))¶



                    You disable UBSan checks for particular functions
                    with __attribute__((no_sanitize("undefined"))). You can use all values
                    of -fsanitize= flag in this attribute, e.g. if your function
                    deliberately contains possible signed integer overflow, you can
                    use__attribute__((no_sanitize("signed-integer-overflow"))).



                    This attribute may not be supported by other compilers, so consider
                    using it together with #ifdefined(clang).




                    So what you should do is: check the documentation in the same page for what you want to suppress and conjugate it with use__attribute__((no_sanitize("here_goes_checks_you_want_to_suppress"))). or use__attribute__((no_sanitize("undefined"))). to disable UBSan altogether.



                    Apart of that seems UBSan is throwing a SIGNED integer overflow and you're trying to suppress UNSIGNED integer overflow.



                    LINKS: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html






                    share|improve this answer
























                    • The __attribute__ way is only one way to suppress UBsan messages. Runtime suppressions are the alternative I'd like to use, since I don't want to alter the boost library. As for the unsigned-integer-overflow: This is the flag I was able to use for a different boost warning.

                      – Elrond1337
                      Nov 25 '18 at 11:04













                    • Have you tried using signed-integer-overflow:path/to/boost/1_64_0/include/boost/iostreams/filter/gzip.hpp?

                      – Ezequiel Barbosa
                      Nov 25 '18 at 11:23











                    • I personally doubt very much you can suppress this specific error using anything other than signed-integer-overflow since that's clearly the issue UBSan is catching

                      – Ezequiel Barbosa
                      Nov 25 '18 at 11:24











                    • I must disappoint you, signed-integer-overflow does get parsed but the gzip.hpp still gets reported.

                      – Elrond1337
                      Nov 26 '18 at 6:58











                    • The question is specifically about runtime UBSan suppressions.

                      – yugr
                      Nov 26 '18 at 7:38














                    0












                    0








                    0







                    According to this very documentation you're reading you suppress UBSan messages using the following step :




                    Disabling Instrumentation
                    with__attribute__((no_sanitize("undefined")))¶



                    You disable UBSan checks for particular functions
                    with __attribute__((no_sanitize("undefined"))). You can use all values
                    of -fsanitize= flag in this attribute, e.g. if your function
                    deliberately contains possible signed integer overflow, you can
                    use__attribute__((no_sanitize("signed-integer-overflow"))).



                    This attribute may not be supported by other compilers, so consider
                    using it together with #ifdefined(clang).




                    So what you should do is: check the documentation in the same page for what you want to suppress and conjugate it with use__attribute__((no_sanitize("here_goes_checks_you_want_to_suppress"))). or use__attribute__((no_sanitize("undefined"))). to disable UBSan altogether.



                    Apart of that seems UBSan is throwing a SIGNED integer overflow and you're trying to suppress UNSIGNED integer overflow.



                    LINKS: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html






                    share|improve this answer













                    According to this very documentation you're reading you suppress UBSan messages using the following step :




                    Disabling Instrumentation
                    with__attribute__((no_sanitize("undefined")))¶



                    You disable UBSan checks for particular functions
                    with __attribute__((no_sanitize("undefined"))). You can use all values
                    of -fsanitize= flag in this attribute, e.g. if your function
                    deliberately contains possible signed integer overflow, you can
                    use__attribute__((no_sanitize("signed-integer-overflow"))).



                    This attribute may not be supported by other compilers, so consider
                    using it together with #ifdefined(clang).




                    So what you should do is: check the documentation in the same page for what you want to suppress and conjugate it with use__attribute__((no_sanitize("here_goes_checks_you_want_to_suppress"))). or use__attribute__((no_sanitize("undefined"))). to disable UBSan altogether.



                    Apart of that seems UBSan is throwing a SIGNED integer overflow and you're trying to suppress UNSIGNED integer overflow.



                    LINKS: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 25 '18 at 10:56









                    Ezequiel BarbosaEzequiel Barbosa

                    1488




                    1488













                    • The __attribute__ way is only one way to suppress UBsan messages. Runtime suppressions are the alternative I'd like to use, since I don't want to alter the boost library. As for the unsigned-integer-overflow: This is the flag I was able to use for a different boost warning.

                      – Elrond1337
                      Nov 25 '18 at 11:04













                    • Have you tried using signed-integer-overflow:path/to/boost/1_64_0/include/boost/iostreams/filter/gzip.hpp?

                      – Ezequiel Barbosa
                      Nov 25 '18 at 11:23











                    • I personally doubt very much you can suppress this specific error using anything other than signed-integer-overflow since that's clearly the issue UBSan is catching

                      – Ezequiel Barbosa
                      Nov 25 '18 at 11:24











                    • I must disappoint you, signed-integer-overflow does get parsed but the gzip.hpp still gets reported.

                      – Elrond1337
                      Nov 26 '18 at 6:58











                    • The question is specifically about runtime UBSan suppressions.

                      – yugr
                      Nov 26 '18 at 7:38



















                    • The __attribute__ way is only one way to suppress UBsan messages. Runtime suppressions are the alternative I'd like to use, since I don't want to alter the boost library. As for the unsigned-integer-overflow: This is the flag I was able to use for a different boost warning.

                      – Elrond1337
                      Nov 25 '18 at 11:04













                    • Have you tried using signed-integer-overflow:path/to/boost/1_64_0/include/boost/iostreams/filter/gzip.hpp?

                      – Ezequiel Barbosa
                      Nov 25 '18 at 11:23











                    • I personally doubt very much you can suppress this specific error using anything other than signed-integer-overflow since that's clearly the issue UBSan is catching

                      – Ezequiel Barbosa
                      Nov 25 '18 at 11:24











                    • I must disappoint you, signed-integer-overflow does get parsed but the gzip.hpp still gets reported.

                      – Elrond1337
                      Nov 26 '18 at 6:58











                    • The question is specifically about runtime UBSan suppressions.

                      – yugr
                      Nov 26 '18 at 7:38

















                    The __attribute__ way is only one way to suppress UBsan messages. Runtime suppressions are the alternative I'd like to use, since I don't want to alter the boost library. As for the unsigned-integer-overflow: This is the flag I was able to use for a different boost warning.

                    – Elrond1337
                    Nov 25 '18 at 11:04







                    The __attribute__ way is only one way to suppress UBsan messages. Runtime suppressions are the alternative I'd like to use, since I don't want to alter the boost library. As for the unsigned-integer-overflow: This is the flag I was able to use for a different boost warning.

                    – Elrond1337
                    Nov 25 '18 at 11:04















                    Have you tried using signed-integer-overflow:path/to/boost/1_64_0/include/boost/iostreams/filter/gzip.hpp?

                    – Ezequiel Barbosa
                    Nov 25 '18 at 11:23





                    Have you tried using signed-integer-overflow:path/to/boost/1_64_0/include/boost/iostreams/filter/gzip.hpp?

                    – Ezequiel Barbosa
                    Nov 25 '18 at 11:23













                    I personally doubt very much you can suppress this specific error using anything other than signed-integer-overflow since that's clearly the issue UBSan is catching

                    – Ezequiel Barbosa
                    Nov 25 '18 at 11:24





                    I personally doubt very much you can suppress this specific error using anything other than signed-integer-overflow since that's clearly the issue UBSan is catching

                    – Ezequiel Barbosa
                    Nov 25 '18 at 11:24













                    I must disappoint you, signed-integer-overflow does get parsed but the gzip.hpp still gets reported.

                    – Elrond1337
                    Nov 26 '18 at 6:58





                    I must disappoint you, signed-integer-overflow does get parsed but the gzip.hpp still gets reported.

                    – Elrond1337
                    Nov 26 '18 at 6:58













                    The question is specifically about runtime UBSan suppressions.

                    – yugr
                    Nov 26 '18 at 7:38





                    The question is specifically about runtime UBSan suppressions.

                    – yugr
                    Nov 26 '18 at 7:38


















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53466501%2fc-clang-ubsan-suppression-flag-name%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Costa Masnaga

                    Fotorealismo

                    Sidney Franklin