[Bug c/89163] New: Missed optimization: sar and shr equivalent for non-negative numbers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89163 Bug ID: 89163 Summary: Missed optimization: sar and shr equivalent for non-negative numbers Product: gcc Version: 8.2.1 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: tspiteri at ieee dot org Target Milestone: --- For the minimized test case below, shift is equivalent to same_as, because shr and sar are equivalent for non-negative numbers. The generated code is not the same. int shift(int i) { return i >= 0 ? (unsigned)i >> 8 : i >> 8; } int same_as(int i) { return i >> 8; } shift: movl%edi, %edx movl%edi, %eax shrl$8, %edx sarl$8, %eax testl %edi, %edi cmovns %edx, %eax ret same_as: movl%edi, %eax sarl$8, %eax ret
[Bug c++/47544] New: c++0x linker does not find =default constructor for explicitly instantiated template
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47544 Summary: c++0x linker does not find =default constructor for explicitly instantiated template Product: gcc Version: 4.5.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: tspit...@ieee.org When compiling the file a.cpp below, the linker does not find the constructor of an explicitly instantiated template if the constructor is defined using = default. $ cat a.cpp template typename T struct s { s(); }; extern template struct sint; template typename T sT::s() = default; //sT::s() {} // gives no error template struct sint; int main() { sint a; } $ g++-4.5 -std=c++0x a.cpp /tmp/cc4PTe2q.o(.text+0x10): In function `main': : undefined reference to `sint::s()' collect2: ld returned 1 exit status $ g++-4.5 -v Using built-in specs. COLLECT_GCC=g++-4.5 COLLECT_LTO_WRAPPER=/home/eeyts/root/libexec/gcc/x86_64-unknown-linux-gnu/4.5.2/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc-4.5.2/configure --prefix=/home/eeyts/root --disable-shared --enable-threads=posix --enable-__cxa_atexit --enable-libgomp --disable-libunwind-exceptions --enable-languages=c,c++,ada --with-gmp=/home/eeyts/root --with-mpfr=/home/eeyts/root --with-mpc=/home/eeyts/root --with-host-libstdcxx=/usr/lib64/libstdc++.so.6 --with-ppl=/home/eeyts/root --with-cloog=/home/eeyts/root --with-libelf=/home/eeyts/root --program-suffix=-4.5 Thread model: posix gcc version 4.5.2 (GCC) $ ld -v GNU ld version 2.15.92.0.2 20040927
[Bug c++/44870] New: -pedantic causes error when calling function with rvalue argument inside template
Inside a template function, calling another function that takes an rvalue reference as argument with a temporary value incorrectly results in an error when the -pedantic flag is used. Reduced test case: void foo(int data); template typename T void bar(T t) { foo(int()); } void baz() { bar(0); } Compilation command: g++-4.5 -std=c++0x -c b.cpp -pedantic Output from compilation command: b.cpp: In function void bar(T): b.cpp:5:12: error: invalid initialization of reference of type int from expression of type int b.cpp:1:6: error: in passing argument 1 of void foo(int) Output of g++-4.5 -v: Using built-in specs. COLLECT_GCC=g++-4.5 COLLECT_LTO_WRAPPER=/home/eeyts/root/libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc-4.5.0/configure --prefix=/home/eeyts/root --disable-shared --enable-threads=posix --enable-__cxa_atexit --enable-libgomp --disable-libunwind-exceptions --enable-languages=c,c++ --with-gmp=/home/eeyts/root --with-mpfr=/home/eeyts/root --with-mpc=/home/eeyts/root --with-host-libstdcxx=/usr/lib64/libstdc++.so.6 --with-ppl=/home/eeyts/root --with-cloog=/home/eeyts/root --with-libelf=/home/eeyts/root --program-suffix=-4.5 Thread model: posix gcc version 4.5.0 (GCC) -- Summary: -pedantic causes error when calling function with rvalue argument inside template Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tspiteri at ieee dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44870
[Bug libstdc++/44875] New: libstdc++ status documentation fails to mention missing c++0x io members
In http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.200x, the documentation states that 27 Input/output library is implemented, except for 27.2.3 Thread safety, which is partially implemented. But there are missing move constructors, move assignment operators, move() member functions, and swap() member functions in sections 27.5 to 27.9, so I think that they should be listed as Partial until the functions are implemented. -- Summary: libstdc++ status documentation fails to mention missing c++0x io members Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: tspiteri at ieee dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44875