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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to