[Bug c++/70435] New: section attribute of a function template is not honored.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70435 Bug ID: 70435 Summary: section attribute of a function template is not honored. Product: gcc Version: 5.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: kukyakya at gmail dot com Target Milestone: --- namespace /* anonymous */ { [[gnu::section(".mysection")]] void regular_func() { } template [[gnu::section(".mysection")]] void template_func() { } } // namespace /* anonymous */ void (*ptr1)() = ®ular_func; void (*ptr2)() = &template_func; In the code above the section attribute is given to both of the regular function and the function template, but the templated function is not placed in .mysection but .text. $ g++ -std=c++14 a.cpp -c && objdump -t a.o | grep -E "regular|template" l F .mysection 0007 _ZN12_GLOBAL__N_112regular_funcEv l F .text 0007 _ZN12_GLOBAL__N_113template_funcIiEEvv ~/temp/c++/function_template_section $ I also tried it with clang and clang put the function into .mysection as I expected. $ clang++ -std=c++14 a.cpp -c && objdump -t a.o | grep -E "regular|template" l F .mysection 0006 _ZN12_GLOBAL__N_112regular_funcEv 0010 l F .mysection 0006 _ZN12_GLOBAL__N_113template_funcIiEEvv
[Bug c++/69065] [C++11] multiple alignas specifiers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69065 kukyakya at gmail dot com changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID |--- --- Comment #2 from kukyakya at gmail dot com --- Reopening the bug. It still does not accept 'alignas(pack...)' form. --- #include struct test { alignas(int, double) char _; }; int main() { std::cout << "alignof(int) is " << alignof(int) << std::endl; std::cout << "alignof(double) is " << alignof(double) << std::endl; std::cout << "alignof(test) is " << alignof(test) << std::endl; } --- $ g++ -Wall -Wextra -std=c++14 -pedantic -O2 a.cpp a.cpp:4:13: error: expected ‘)’ before ‘,’ token alignas(int, double) char _; ^ a.cpp:4:13: error: expected ‘)’ before ‘,’ token a.cpp:4:13: error: expected unqualified-id before ‘,’ token ---
[Bug c++/69065] [C++11] multiple alignas specifiers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69065 kukyakya at gmail dot com changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #1 from kukyakya at gmail dot com --- 'alignas' specifier is not meant to be used in type declaration. (http://stackoverflow.com/a/34006668/1030861) Was not a bug. Works as expected if used properly. --- #include struct test1 { alignas(int) alignas(double) char _; }; struct test2 { alignas(double) alignas(int) char _; }; int main() { std::cout << "alignof(int) is " << alignof(int) << std::endl; std::cout << "alignof(double) is " << alignof(double) << std::endl; std::cout << "alignof(test1) is " << alignof(test1) << std::endl; std::cout << "alignof(test2) is " << alignof(test2) << std::endl; } --- alignof(int) is 4 alignof(double) is 8 alignof(test1) is 8 alignof(test2) is 8 ---
[Bug c++/69065] New: [C++11] multiple alignas specifiers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69065 Bug ID: 69065 Summary: [C++11] multiple alignas specifiers Product: gcc Version: 5.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: kukyakya at gmail dot com Target Milestone: --- http://en.cppreference.com/w/cpp/language/alignas (quoting it since I don't have the C++11 standard documents now) states that `alignas` can be used in the form of `alignas(pack...)`, but both g++ and clang++ fail to compile it. struct alignas(int, double) test { }; So I tried to use multiple `alignas` specifiers, but got unexpected results. #include // struct alignas(int, double) test // { }; struct alignas(int) alignas(double) test1 { }; struct alignas(double) alignas(int) test2 { }; int main() { std::cout << "alignof(int) is " << alignof(int) << std::endl; std::cout << "alignof(double) is " << alignof(double) << std::endl; // std::cout << "alignof(test) is " << alignof(test) << std::endl; std::cout << "alignof(test1) is " << alignof(test1) << std::endl; std::cout << "alignof(test2) is " << alignof(test2) << std::endl; } alignof(int) is 4 alignof(double) is 8 alignof(test1) is 8 alignof(test2) is 4 With clang++ I got alignof(int) is 4 alignof(double) is 8 alignof(test1) is 8 alignof(test2) is 8 I'm not sure if it's okay to give multiple `alignas` specifiers, but I think it should have the strictest alignment if it's okay. G++ seems to apply only the latest `alignas` specifier.
[Bug lto/58203] New: memset/memcpy are discarded with -flto
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58203 Bug ID: 58203 Summary: memset/memcpy are discarded with -flto Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: kukyakya at gmail dot com It might be a duplicate of bug 51205 but it's happening again. [test.cpp] typedef void (*action_t)(const unsigned char*); extern "C" void _start(action_t action) { const unsigned char foo[256] = {}; action(foo); } typedef __SIZE_TYPE__ size_t; extern "C" void* //__attribute__((externally_visible)) // Workaround memset(void* dst, int c, size_t len) { unsigned char * d = (unsigned char*)dst; while(len--) *d++ = c; return dst; } [error] $ arm-none-linux-gnueabi-g++ -fno-exceptions -nostartfiles -static -nostdlib -nodefaultlibs -flto test.cpp -o test `memset' referenced in section `.text' of /tmp/cc7ooAE0.ltrans0.ltrans.o: defined in discarded section `.text' of /tmp/ccVDnjy6.o (symbol from plugin) collect2: error: ld returned 1 exit status [versions] arm-none-linux-gnueabi-g++ --version : 4.8.1 arm-none-linux-gnueabi-ld --version : 2.23.2
[Bug lto/58203] memset/memcpy are discarded with -flto
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58203 --- Comment #1 from kukyakya at gmail dot com --- Created attachment 30679 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30679&action=edit Test case