[llvm-bugs] [Bug 47877] New: clang accepts an alignment value that is not a positive integral power of 2

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 16 05:09:56 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=47877

            Bug ID: 47877
           Summary: clang accepts an alignment value that is not a
                    positive integral power of 2
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tangyixuan at mail.dlut.edu.cn
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Hi, the following code allocates memory for an integer variable 'a' with '5',
which is not an integral power of two. However, Clang accepts it. 

Please take a look at paragraph [4]:  
http://eel.is/c++draft/basic.align

$ cat s.cpp
void * a = new int __attribute__ ((aligned (5)))();

$ g++ -c s.cpp
s.cpp:1:48: error: requested alignment ‘5’ is not a positive power of 2
    1 | void * a = new int __attribute__ ((aligned (5)))();

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201016/a08b492a/attachment-0001.html>


More information about the llvm-bugs mailing list