diff --git a/16-add-c-and-cxx-memory-align-investigation.patch b/16-add-c-and-cxx-memory-align-investigation.patch new file mode 100644 index 0000000000000000000000000000000000000000..8d759814ba18f152da043443e58ffeba264761dc --- /dev/null +++ b/16-add-c-and-cxx-memory-align-investigation.patch @@ -0,0 +1,1200 @@ +From b3b3bc0a58cc7146aff1087dff5ab4da52a9dae1 Mon Sep 17 00:00:00 2001 +From: huwei3 +Date: Tue, 13 Dec 2022 20:37:18 +0800 +Subject: [PATCH] add-c-and-cxx-memory-align-investigation + + +diff --git a/test/c_cxx_align_examples/c-and-cxx-align1.c b/test/c_cxx_align_examples/c-and-cxx-align1.c +new file mode 100644 +index 0000000..f257e55 +--- /dev/null ++++ b/test/c_cxx_align_examples/c-and-cxx-align1.c +@@ -0,0 +1,27 @@ ++#include ++#include ++int main() ++{ ++ char a; ++ short b; ++ int c; ++ long d; ++ long long e; ++ float f; ++ double g; ++ long double h; ++ int * ptr_one; ++ void * ptr_two; ++ ++ printf("%d\n", _Alignof(a) ); ++ printf("%d\n", _Alignof(b) ); ++ printf("%d\n", _Alignof(c) ); ++ printf("%d\n", _Alignof(d) ); ++ printf("%d\n", _Alignof(e) ); ++ printf("%d\n", _Alignof(f) ); ++ printf("%d\n", _Alignof(g) ); ++ printf("%d\n", _Alignof(h) ); ++ printf("%d\n", _Alignof( ptr_one ) ); ++ printf("%d\n", _Alignof( ptr_two ) ); ++ return 0; ++} +diff --git a/test/c_cxx_align_examples/c-and-cxx-align10.cpp b/test/c_cxx_align_examples/c-and-cxx-align10.cpp +new file mode 100644 +index 0000000..2a3babf +--- /dev/null ++++ b/test/c_cxx_align_examples/c-and-cxx-align10.cpp +@@ -0,0 +1,15 @@ ++#include ++#include ++using namespace std; ++ ++struct S ++{ ++ short f[3]; ++}; ++ ++int main() ++{ ++ cout<< "sizeof(S)=" << sizeof( S ) < ++#include ++using namespace std; ++ ++#pragma pack(push,1) //后边可以改为1,2,4,8 ++struct node ++{ ++ char m1; ++ long m2; ++}; ++#pragma pack(pop) ++ ++ ++int main() ++{ ++ char a; ++ short b; ++ int c; ++ double d[2]; ++ struct node s; ++ printf("a address=%p\n", &a ); ++ printf("b address=%p\n", &b ); ++ printf("c address=%p\n", &c ); ++ printf("d[0] address=%p\n", &( d[0] ) ); ++ printf("d[1] address=%p\n", &( d[1] ) ); ++ printf("s address=%p\n", &s ); ++ printf("s.m2 address=%p\n", &(s.m2) ); ++ ++ ++ return 0; ++} ++ +diff --git a/test/c_cxx_align_examples/c-and-cxx-align19.c b/test/c_cxx_align_examples/c-and-cxx-align19.c +new file mode 100644 +index 0000000..2e40d9f +--- /dev/null ++++ b/test/c_cxx_align_examples/c-and-cxx-align19.c +@@ -0,0 +1,18 @@ ++#include ++#include ++int main() ++{ ++ int a; ++ long c; ++ ++ printf("_Alignof(char)=%d\n", _Alignof(char) ); ++ printf("_Alignof(short)=%d\n", _Alignof(short) ); ++ printf("_Alignof(int)=%d\n", _Alignof(int) ); ++ printf("_Alignof(long)=%d\n", _Alignof(long) ); ++ printf("_Alignof(long)=%d\n", _Alignof(long long) ); ++ printf("_Alignof(float)=%d\n", _Alignof(float) ); ++ printf("_Alignof(double)=%d\n", _Alignof(double) ); ++ printf("_Alignof(long double)=%d\n", _Alignof(long double) ); ++ return 0; ++} ++ +diff --git a/test/c_cxx_align_examples/c-and-cxx-align2.cpp b/test/c_cxx_align_examples/c-and-cxx-align2.cpp +new file mode 100644 +index 0000000..a2dae4c +--- /dev/null ++++ b/test/c_cxx_align_examples/c-and-cxx-align2.cpp +@@ -0,0 +1,33 @@ ++#include ++#include ++using namespace std; ++ ++int main() ++{ ++ bool test; ++ char a; ++ short b; ++ int c; ++ long d; ++ long long e; ++ float f; ++ double g; ++ long double h; ++ int * ptr_one; ++ void * ptr_two; ++ ++ printf("%d\n", alignof(test) ); ++ printf("%d\n", alignof(a) ); ++ printf("%d\n", alignof(b) ); ++ printf("%d\n", alignof(c) ); ++ printf("%d\n", alignof(d) ); ++ printf("%d\n", alignof(e) ); ++ printf("%d\n", alignof(f) ); ++ printf("%d\n", alignof(g) ); ++ printf("%d\n", alignof(h) ); ++ printf("%d\n", alignof( ptr_one ) ); ++ printf("%d\n", alignof( ptr_two ) ); ++ printf("%d\n", alignof( int ) ); ++ return 0; ++} ++ +diff --git a/test/c_cxx_align_examples/c-and-cxx-align20.c b/test/c_cxx_align_examples/c-and-cxx-align20.c +new file mode 100644 +index 0000000..cb77bf3 +--- /dev/null ++++ b/test/c_cxx_align_examples/c-and-cxx-align20.c +@@ -0,0 +1,17 @@ ++#include ++#include ++int main() ++{ ++ int a; ++ long c; ++ ++ printf("__alignof__(char)=%d\n", __alignof__(char) ); ++ printf("__alignof__(short)=%d\n", __alignof__(short) ); ++ printf("__alignof__(int)=%d\n", __alignof__(int) ); ++ printf("__alignof__(long)=%d\n", __alignof__(long) ); ++ printf("__alignof__(long)=%d\n", __alignof__(long long) ); ++ printf("__alignof__(float)=%d\n", __alignof__(float) ); ++ printf("__alignof__(double)=%d\n", __alignof__(double) ); ++ printf("__alignof__(long double)=%d\n", __alignof__(long double) ); ++ return 0; ++} +diff --git a/test/c_cxx_align_examples/c-and-cxx-align21.c b/test/c_cxx_align_examples/c-and-cxx-align21.c +new file mode 100644 +index 0000000..08a3394 +--- /dev/null ++++ b/test/c_cxx_align_examples/c-and-cxx-align21.c +@@ -0,0 +1,11 @@ ++#include ++ ++int main() ++{ ++ int a; ++ printf( "_Alignof(a)=%d\n" ,_Alignof(a) ); ++ _Alignas(8) int b; ++ printf( "_Alignof(b)=%d\n" ,_Alignof(b) ); ++ return 0; ++} ++ +diff --git a/test/c_cxx_align_examples/c-and-cxx-align22.c b/test/c_cxx_align_examples/c-and-cxx-align22.c +new file mode 100644 +index 0000000..225aec1 +--- /dev/null ++++ b/test/c_cxx_align_examples/c-and-cxx-align22.c +@@ -0,0 +1,17 @@ ++#include ++#include ++int main() ++{ ++ int a; ++ long c; ++ ++ printf("alignof(char)=%d\n", alignof(char) ); ++ printf("alignof(short)=%d\n", alignof(short) ); ++ printf("alignof(int)=%d\n", alignof(int) ); ++ printf("alignof(long)=%d\n", alignof(long) ); ++ printf("alignof(long)=%d\n", alignof(long long) ); ++ printf("alignof(float)=%d\n", alignof(float) ); ++ printf("alignof(double)=%d\n", alignof(double) ); ++ printf("alignof(long double)=%d\n", alignof(long double) ); ++ return 0; ++} +diff --git a/test/c_cxx_align_examples/c-and-cxx-align23.cpp b/test/c_cxx_align_examples/c-and-cxx-align23.cpp +new file mode 100644 +index 0000000..81dbcee +--- /dev/null ++++ b/test/c_cxx_align_examples/c-and-cxx-align23.cpp +@@ -0,0 +1,26 @@ ++#include ++ ++struct Foo ++{ ++ int i; ++ float f; ++ char c; ++}; ++struct alignas(alignof(long double)) Foo2 ++{ ++}; ++struct Empty {}; ++struct alignas(64) Empty64 {}; ++ ++int main() ++{ ++ std::cout << "Alignment of" "\n" ++ "- char : " << alignof(char) << "\n" ++ "- pointer : " << alignof(int*) << "\n" ++ "- class Foo : " << alignof(Foo) << "\n" ++ "- class Foo2 : " << alignof(Foo2) << "\n" ++ "- empty class : " << alignof(Empty) << "\n" ++ "- empty class\n" ++ " with alignas(64): " << alignof(Empty64) << "\n"; ++} ++//https://en.cppreference.com/w/cpp/language/alignof +diff --git a/test/c_cxx_align_examples/c-and-cxx-align24.cpp b/test/c_cxx_align_examples/c-and-cxx-align24.cpp +new file mode 100644 +index 0000000..6dc2591 +--- /dev/null ++++ b/test/c_cxx_align_examples/c-and-cxx-align24.cpp +@@ -0,0 +1,14 @@ ++#include ++ ++struct Empty {}; ++ ++struct alignas(64) Empty64 {}; ++ ++int main() ++{ ++ std::cout << "Alignment of" "\n" ++ "- empty class : " << alignof(Empty) << "\n" ++ "- empty class\n" ++ " with alignas(64): " << alignof(Empty64) << "\n"; ++} ++//https://en.cppreference.com/w/cpp/language/alignof +diff --git a/test/c_cxx_align_examples/c-and-cxx-align25.cpp b/test/c_cxx_align_examples/c-and-cxx-align25.cpp +new file mode 100644 +index 0000000..b941aa9 +--- /dev/null ++++ b/test/c_cxx_align_examples/c-and-cxx-align25.cpp +@@ -0,0 +1,50 @@ ++#include ++#include ++ ++template ++struct MyAllocator ++{ ++ char data[N]; ++ void* p; ++ std::size_t sz; ++ MyAllocator() : p(data), sz(N) {} ++ template ++ T* aligned_alloc(std::size_t a = alignof(T)) ++ { ++ if (std::align(a, sizeof(T), p, sz)) ++ { ++ T* result = reinterpret_cast(p); ++ p = (char*)p + sizeof(T); ++ sz -= sizeof(T); ++ return result; ++ } ++ return nullptr; ++ } ++}; ++ ++int main() ++{ ++ MyAllocator<64> a; ++ std::cout << "allocated a.data at " << (void*)a.data ++ << " (" << sizeof a.data << " bytes)\n"; ++ ++ // allocate a char ++ if (char* p = a.aligned_alloc()) { ++ *p = 'a'; ++ std::cout << "allocated a char at " << (void*)p << '\n'; ++ } ++ ++ // allocate an int ++ if (int* p = a.aligned_alloc()) { ++ *p = 1; ++ std::cout << "allocated an int at " << (void*)p << '\n'; ++ } ++ ++ // allocate an int, aligned at 32-byte boundary ++ if (int* p = a.aligned_alloc(32)) { ++ *p = 2; ++ std::cout << "allocated an int at " << (void*)p << " (32 byte alignment)\n"; ++ } ++} ++ ++//https://en.cppreference.com/w/cpp/memory/align +diff --git a/test/c_cxx_align_examples/c-and-cxx-align26.cpp b/test/c_cxx_align_examples/c-and-cxx-align26.cpp +new file mode 100644 +index 0000000..d63d88e +--- /dev/null ++++ b/test/c_cxx_align_examples/c-and-cxx-align26.cpp +@@ -0,0 +1,16 @@ ++#include ++using namespace std; ++ ++typedef struct test_32 ++{ ++ char a; ++ char b; ++ double c; ++}test_32; ++ ++int main() ++{ ++ ++ cout< ++using namespace std; ++ ++#pragma pack(4) ++ ++typedef struct test_32 ++{ ++ char a; ++ char b; ++ double c; ++}test_32; ++ ++int main() ++{ ++ ++ cout<< sizeof(test_32)< ++using namespace std; ++ ++#pragma pack(16) ++ ++typedef struct test_32 ++{ ++ char a; ++ char b; ++ double c; ++}test_32; ++ ++int main() ++{ ++ ++ cout< ++using namespace std; ++ ++struct first ++{ ++ short f[3]; ++}; ++ ++struct __attribute__ ((aligned (8))) second ++{ ++ short f[3]; ++}; ++ ++int main() ++{ ++ cout<< sizeof( first ) < ++#include ++using namespace std; ++ ++int main() ++{ ++ const bool test=false; ++ const char a=1; ++ const short b=1; ++ const int c=2; ++ const long d=3; ++ const long long e=3; ++ const float f=2.3; ++ const double g=1.2; ++ const long double h=2.2; ++ const int * ptr_one=&c; ++ const void * ptr_two=&b; ++ ++ printf("%d\n", alignof(test) ); ++ printf("%d\n", alignof(a) ); ++ printf("%d\n", alignof(b) ); ++ printf("%d\n", alignof(c) ); ++ printf("%d\n", alignof(d) ); ++ printf("%d\n", alignof(e) ); ++ printf("%d\n", alignof(f) ); ++ printf("%d\n", alignof(g) ); ++ printf("%d\n", alignof(h) ); ++ printf("%d\n", alignof( ptr_one ) ); ++ printf("%d\n", alignof( ptr_two ) ); ++ printf("%d\n", alignof( int ) ); ++ return 0; ++} ++ +diff --git a/test/c_cxx_align_examples/c-and-cxx-align30.cpp b/test/c_cxx_align_examples/c-and-cxx-align30.cpp +new file mode 100644 +index 0000000..08e8c82 +--- /dev/null ++++ b/test/c_cxx_align_examples/c-and-cxx-align30.cpp +@@ -0,0 +1,13 @@ ++#include ++using namespace std; ++ ++int main() ++{ ++ char a; ++ char b __attribute__((aligned(8))); ++ cout << sizeof(a) < ++ ++void test() ++{ ++ printf("test"); ++} ++void __attribute__ ((aligned (8)))one() ++{ ++ printf("one"); ++} ++int main() ++{ ++ printf("__alignof__(test)=%d\n", __alignof__(test) ); ++ printf("__alignof__(one)=%d\n", __alignof__(one) ); ++ return 0; ++} +diff --git a/test/c_cxx_align_examples/c-and-cxx-align32.cpp b/test/c_cxx_align_examples/c-and-cxx-align32.cpp +new file mode 100644 +index 0000000..401ce2f +--- /dev/null ++++ b/test/c_cxx_align_examples/c-and-cxx-align32.cpp +@@ -0,0 +1,14 @@ ++#include ++using namespace std; ++ ++int main() ++{ ++ __attribute__((aligned(1))) ++ int a; ++ cout << alignof(a) < ++void test() ++{ ++ printf("test"); ++} ++void one() ++{ ++ printf("one"); ++} ++int main() ++{ ++ printf("__alignof__(test)=%d\n", __alignof__(test) ); ++ printf("address=%p\n", &test); ++ printf("__alignof__(one)=%d\n", __alignof__(one) ); ++ printf("address=%p\n", &one); ++ return 0; ++} ++ +diff --git a/test/c_cxx_align_examples/c-and-cxx-align34.cpp b/test/c_cxx_align_examples/c-and-cxx-align34.cpp +new file mode 100644 +index 0000000..0ec684d +--- /dev/null ++++ b/test/c_cxx_align_examples/c-and-cxx-align34.cpp +@@ -0,0 +1,15 @@ ++#include ++using namespace std; ++ ++struct S ++{ ++ char c; ++ long double a; ++}; ++ ++ ++int main() ++{ ++ cout<< sizeof( S ) < ++#include ++using namespace std; ++ ++int main() ++{ ++ static bool test; ++ static char a; ++ static short b; ++ static int c; ++ static long d; ++ static long long e; ++ static float f; ++ static double g; ++ static long double h; ++ static int * ptr_one; ++ static void * ptr_two; ++ ++ printf("%d\n", alignof(test) ); ++ printf("%d\n", alignof(a) ); ++ printf("%d\n", alignof(b) ); ++ printf("%d\n", alignof(c) ); ++ printf("%d\n", alignof(d) ); ++ printf("%d\n", alignof(e) ); ++ printf("%d\n", alignof(f) ); ++ printf("%d\n", alignof(g) ); ++ printf("%d\n", alignof(h) ); ++ printf("%d\n", alignof( ptr_one ) ); ++ printf("%d\n", alignof( ptr_two ) ); ++ printf("%d\n", alignof( int ) ); ++ return 0; ++} ++ +diff --git a/test/c_cxx_align_examples/c-and-cxx-align5.cpp b/test/c_cxx_align_examples/c-and-cxx-align5.cpp +new file mode 100644 +index 0000000..004345e +--- /dev/null ++++ b/test/c_cxx_align_examples/c-and-cxx-align5.cpp +@@ -0,0 +1,32 @@ ++#include ++#include ++using namespace std; ++ ++int main() ++{ ++ bool test; ++ char a; ++ short b; ++ int c; ++ long d; ++ long long e; ++ float f; ++ double g; ++ long double h; ++ int * ptr_one; ++ void * ptr_two; ++ ++ printf("%d\n", sizeof(test) ); ++ printf("%d\n", sizeof(a) ); ++ printf("%d\n", sizeof(b) ); ++ printf("%d\n", sizeof(c) ); ++ printf("%d\n", sizeof(d) ); ++ printf("%d\n", sizeof(e) ); ++ printf("%d\n", sizeof(f) ); ++ printf("%d\n", sizeof(g) ); ++ printf("%d\n", sizeof(h) ); ++ printf("%d\n", sizeof( ptr_one ) ); ++ printf("%d\n", sizeof( ptr_two ) ); ++ return 0; ++} ++ +diff --git a/test/c_cxx_align_examples/c-and-cxx-align6.cpp b/test/c_cxx_align_examples/c-and-cxx-align6.cpp +new file mode 100644 +index 0000000..272374e +--- /dev/null ++++ b/test/c_cxx_align_examples/c-and-cxx-align6.cpp +@@ -0,0 +1,32 @@ ++#include ++#include ++using namespace std; ++ ++int main() ++{ ++ bool test; ++ char a; ++ short b; ++ int c; ++ long d; ++ long long e; ++ float f; ++ double g; ++ long double h; ++ int * ptr_one; ++ void * ptr_two; ++ ++ printf("%d\n", __alignof__(test) ); ++ printf("%d\n", __alignof__(a) ); ++ printf("%d\n", __alignof__(b) ); ++ printf("%d\n", __alignof__(c) ); ++ printf("%d\n", __alignof__(d) ); ++ printf("%d\n", __alignof__(e) ); ++ printf("%d\n", __alignof__(f) ); ++ printf("%d\n", __alignof__(g) ); ++ printf("%d\n", __alignof__(h) ); ++ printf("%d\n", __alignof__( ptr_one ) ); ++ printf("%d\n", __alignof__( ptr_two ) ); ++ return 0; ++} ++ +diff --git a/test/c_cxx_align_examples/c-and-cxx-align7.cpp b/test/c_cxx_align_examples/c-and-cxx-align7.cpp +new file mode 100644 +index 0000000..3dabed2 +--- /dev/null ++++ b/test/c_cxx_align_examples/c-and-cxx-align7.cpp +@@ -0,0 +1,17 @@ ++#include ++#include ++using namespace std; ++ ++enum Foo ++{ ++ a, b, c = 10, d, e = 1, f, g = f + c ++}; ++ ++int main() ++{ ++ ++ cout< ++#include ++using namespace std; ++int test; ++int main() ++{ ++ int b=1; ++ cout << alignof(b) < ++#include ++using namespace std; ++ ++int main() ++{ ++ bool first; ++ bool second[3]; ++ int * ptr; ++ int * test[3]; ++ printf("sizeof(first)=%d alignof(first)=%d\n", sizeof(first), alignof(first) ); ++ printf("sizeof(second)=%d alignof(second)=%d\n", sizeof(second), alignof(second) ); ++ printf("sizeof(ptr)=%d alignof(ptr)=%d\n", sizeof(ptr), alignof(ptr) ); ++ printf("sizeof(test)=%d alignof(test)=%d\n", sizeof(test), alignof(test) ); ++ return 0; ++} ++ +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align1.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align1.sh +new file mode 100644 +index 0000000..d5b8b64 +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align1.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++gcc -std=c11 -w c-and-cxx-align1.c -o c-and-cxx-align1.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align10.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align10.sh +new file mode 100644 +index 0000000..9bf61ff +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align10.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ -std=c++11 -w c-and-cxx-align10.cpp -o c-and-cxx-align10.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align11.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align11.sh +new file mode 100644 +index 0000000..bb03a36 +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align11.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ -std=c++11 -w c-and-cxx-align11.cpp -o c-and-cxx-align11.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align12.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align12.sh +new file mode 100644 +index 0000000..1e91e49 +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align12.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ -std=c++11 -w c-and-cxx-align12.cpp -o c-and-cxx-align12.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align13.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align13.sh +new file mode 100644 +index 0000000..254fedc +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align13.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ -std=c++11 -w c-and-cxx-align13.cpp -o c-and-cxx-align13.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align14.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align14.sh +new file mode 100644 +index 0000000..df40f0b +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align14.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ -std=c++11 -w c-and-cxx-align14.cpp -o c-and-cxx-align14.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align15.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align15.sh +new file mode 100644 +index 0000000..d11c8d2 +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align15.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ -std=c++11 -w c-and-cxx-align15.cpp -o c-and-cxx-align15.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align16.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align16.sh +new file mode 100644 +index 0000000..efc607d +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align16.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ -std=c++11 -w c-and-cxx-align16.cpp -o c-and-cxx-align16.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align17.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align17.sh +new file mode 100644 +index 0000000..f9e3d87 +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align17.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++gcc -std=c11 -w c-and-cxx-align17.c -o c-and-cxx-align17.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align18.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align18.sh +new file mode 100644 +index 0000000..268a1b4 +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align18.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ c-and-cxx-align18.cpp -g -o c-and-cxx-align18.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align19.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align19.sh +new file mode 100644 +index 0000000..f44aff1 +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align19.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++gcc -std=c11 -w c-and-cxx-align19.c -o c-and-cxx-align19.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align2.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align2.sh +new file mode 100644 +index 0000000..230d78e +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align2.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ -std=c++11 -w c-and-cxx-align2.cpp -o c-and-cxx-align2.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align20.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align20.sh +new file mode 100644 +index 0000000..15a086d +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align20.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++gcc -std=c11 -w c-and-cxx-align20.c -o c-and-cxx-align20.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align21.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align21.sh +new file mode 100644 +index 0000000..1edecdd +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align21.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++gcc -std=c11 -w c-and-cxx-align21.c -o c-and-cxx-align21.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align22.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align22.sh +new file mode 100644 +index 0000000..e84fea4 +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align22.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++gcc -std=c11 -w c-and-cxx-align22.c -o c-and-cxx-align22.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align23.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align23.sh +new file mode 100644 +index 0000000..8a679c5 +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align23.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ -std=c++11 -w c-and-cxx-align23.cpp -o c-and-cxx-align23.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align24.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align24.sh +new file mode 100644 +index 0000000..a611b66 +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align24.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ -std=c++11 -w c-and-cxx-align24.cpp -o c-and-cxx-align24.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align25.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align25.sh +new file mode 100644 +index 0000000..02ea108 +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align25.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ -std=c++11 -w c-and-cxx-align25.cpp -o c-and-cxx-align25.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align26.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align26.sh +new file mode 100644 +index 0000000..fba1ad1 +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align26.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ -std=c++11 -w c-and-cxx-align26.cpp -o c-and-cxx-align26.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align27.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align27.sh +new file mode 100644 +index 0000000..9b39006 +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align27.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ -std=c++11 -w c-and-cxx-align27.cpp -o c-and-cxx-align27.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align28.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align28.sh +new file mode 100644 +index 0000000..7aa34fe +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align28.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ -std=c++11 -w c-and-cxx-align28.cpp -o c-and-cxx-align28.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align29.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align29.sh +new file mode 100644 +index 0000000..d92959d +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align29.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ -std=c++11 -w c-and-cxx-align29.cpp -o c-and-cxx-align29.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align3.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align3.sh +new file mode 100644 +index 0000000..a0734bd +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align3.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ -std=c++11 -w c-and-cxx-align3.cpp -o c-and-cxx-align3.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align30.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align30.sh +new file mode 100644 +index 0000000..2b0532c +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align30.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ -std=c++11 -w c-and-cxx-align30.cpp -o c-and-cxx-align30.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align31.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align31.sh +new file mode 100644 +index 0000000..e4b18c2 +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align31.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++gcc -std=c11 -w c-and-cxx-align31.c -o c-and-cxx-align31.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align32.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align32.sh +new file mode 100644 +index 0000000..29f84c2 +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align32.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ -std=c++11 -w c-and-cxx-align32.cpp -o c-and-cxx-align32.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align33.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align33.sh +new file mode 100644 +index 0000000..68d0916 +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align33.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++gcc -w c-and-cxx-align33.c -o c-and-cxx-align33.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align34.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align34.sh +new file mode 100644 +index 0000000..efd53c4 +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align34.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ -w c-and-cxx-align34.cpp -o c-and-cxx-align34.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align4.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align4.sh +new file mode 100644 +index 0000000..6cb6456 +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align4.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ -std=c++11 -w c-and-cxx-align4.cpp -o c-and-cxx-align4.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align5.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align5.sh +new file mode 100644 +index 0000000..8061a8d +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align5.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ -std=c++11 -w c-and-cxx-align5.cpp -o c-and-cxx-align5.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align6.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align6.sh +new file mode 100644 +index 0000000..8cc0cd0 +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align6.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ -std=c++11 -w c-and-cxx-align6.cpp -o c-and-cxx-align6.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align7.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align7.sh +new file mode 100644 +index 0000000..425b8a4 +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align7.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ -std=c++11 -w c-and-cxx-align7.cpp -o c-and-cxx-align7.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align8.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align8.sh +new file mode 100644 +index 0000000..aafdc66 +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align8.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ -std=c++11 -w c-and-cxx-align8.cpp -o c-and-cxx-align8.out +diff --git a/test/c_cxx_align_examples/run-compiler-c-cxx-align9.sh b/test/c_cxx_align_examples/run-compiler-c-cxx-align9.sh +new file mode 100644 +index 0000000..b083500 +--- /dev/null ++++ b/test/c_cxx_align_examples/run-compiler-c-cxx-align9.sh +@@ -0,0 +1,2 @@ ++#!/bin/bash ++g++ -std=c++11 -w c-and-cxx-align9.cpp -o c-and-cxx-align9.out +-- +2.37.1 (Apple Git-137.1) + diff --git a/flang.spec b/flang.spec index f4af1fab990eaa48df178d49e59f8ad5504b8f53..74faadbfcb061e335c948c517bad213d75d269ee 100644 --- a/flang.spec +++ b/flang.spec @@ -2,7 +2,7 @@ Name: flang Version: flang_20210324 -Release: 17 +Release: 18 Summary: Fortran language compiler targeting LLVM License: Apache-2.0 @@ -26,6 +26,7 @@ Patch11: 12-test-interoperability-with-c-c-call-fortran-function.patch Patch12: 13-test-interoperability-with-c-c-call-fortran-global-and-struct.patch Patch13: 14-add-test-cases-for-attribute-declarations-and-specifications-2.patch Patch14: 15-add-test-cases-for-types-2.patch +Patch15: 16-add-c-and-cxx-memory-align-investigation.patch %description Flang depends on a fork of the LLVM project (https://github.com/flang-compiler/classic-flang-llvm-project). The fork made some changes to the upstream LLVM project to support Flang toolchain. Flang cannot build independently for now. @@ -47,6 +48,9 @@ TODO: support build Flang. %changelog +* Tue Dec 13 2022 huwei - flang_20210324-18 +- Add 16-add-c-and-cxx-memory-align-investigation.patch for add c and cxx memory align investigation + * Thu Dec 8 2022 xieyihui - flang_20210324-17 - Fix 4-add-test-cases-for-openmp-optimization.patch for add new test cases for OpenMP optimization and modify the test method