https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81749

            Bug ID: 81749
           Summary: std::align: runtime error: negation of 8 cannot be
                    represented in type 'size_t'
           Product: gcc
           Version: 7.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: max at maxbruckner dot de
  Target Milestone: ---

Created attachment 41944
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41944&action=edit
C++ file to reproduce the error

When compiling code with clangs undefined behavior sanitizer (clang++ 4.0.1
-fsanitize=unsigned-integer-overflow) that uses std::align, a runtime error
occurs:

/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../include/c++/7.1.1/memory:117:54:
runtime error: negation of 8 cannot be represented in type 'size_t' (aka
'unsigned long')

The issue can be reproduced with the C++ and Makefile from the attachments.

The full output of my test:

alignof(intmax_t) = 8              
alloced = 0x5606f17e7c21           
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.1.1/../../../../include/c++/7.1.1/memory:117:54:
runtime error: negation of 8 cannot be represented in type 'size_t' (aka
'unsigned long')
address = 0x5606f17e7c28           
space = 92

Reply via email to