[Bug c++/64755] Error in optimization with std::array
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64755 mednafen at gmail dot com changed: What|Removed |Added CC||mednafen at gmail dot com --- Comment #2 from mednafen at gmail dot com --- It looks like your code violates strict aliasing rules. Does the code in question work as you intend it to if you compile with -fno-strict-aliasing ?
[Bug c++/64755] Error in optimization with std::array
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64755 --- Comment #3 from mednafen at gmail dot com --- It looks like your code violates strict aliasing rules. Does the code in question work as you intend it to if you compile with -fno-strict-aliasing ?
[Bug c/63843] New: wrong code generation at -O1 and higher
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63843 Bug ID: 63843 Summary: wrong code generation at -O1 and higher Product: gcc Version: 5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: mednafen at gmail dot com Created attachment 33955 -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33955action=edit Testcase, good output is 8181. trunk revision 217451 gcc (GCC) 5.0.0 20141112 (experimental) Linux x86_64 $ ~mednafen/gcc-dev/bin/gcc -O0 -o tc tc.c $ ./tc 8181 $ ~mednafen/gcc-dev/bin/gcc -O1 -o tc tc.c $ ./tc ff81 $ ~mednafen/gcc-dev/bin/gcc -O1 -fno-tree-copyrename -o tc tc.c $ ./tc 8181
[Bug c/63729] New: Type-punning through a union fails to circumvent strict aliasing under certain conditions.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63729 Bug ID: 63729 Summary: Type-punning through a union fails to circumvent strict aliasing under certain conditions. Product: gcc Version: 4.9.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: mednafen at gmail dot com Linux x86_64, gcc 4.9.2 Bad: $ gcc -Wall -O2 -o pun pun.c $ ./pun 0x0005 Good: $ gcc -Wall -fno-strict-aliasing -O2 -o pun pun.c $ ./pun 0x0001 // // // typedef unsigned char uint8; typedef unsigned short uint16; typedef unsigned int uint32; typedef union { uint16 data16[256]; uint32 data32[128]; } zu; uint32 __attribute__((noinline,noclone)) test(uint32 offset) { zu z; *(uint32*)(((uint8*)z.data32) + offset) = 4; *(uint16*)(((uint8*)z.data16) + offset) = 0; *(uint32*)(((uint8*)z.data32) + offset) = *(uint32*)(((uint8*)z.data32) + offset) + 1; return *(uint32*)(((uint8*)z.data32) + offset); } int main() { __builtin_printf(0x%08x\n, test(0)); return 0; }
[Bug c/63729] Type-punning through a union fails to circumvent strict aliasing under certain conditions.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63729 --- Comment #2 from mednafen at gmail dot com --- If this construct is invalid as you say it is, then how exactly is one supposed to access data of arbitrary types at arbitrary byte offsets in a contiguous chunk of memory?
[Bug c/63729] Type-punning through a union fails to circumvent strict aliasing under certain conditions.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63729 mednafen at gmail dot com changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #4 from mednafen at gmail dot com --- Thanks, I hadn't realized gcc's optimizer was that good now, even though I really should have.
[Bug target/63661] [4.9/5 Regression] -O2 miscompiles on OSX 10.10 Yosemite
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63661 mednafen at gmail dot com changed: What|Removed |Added CC||mednafen at gmail dot com --- Comment #19 from mednafen at gmail dot com --- Created attachment 33870 -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=33870action=edit Simplified testcase. Simplified testcase, tested to be broken on x86_64 Linux. $ /usr/local/gcc-4.9.2/bin/gcc -O2 -fpic -o testcase-alt testcase-alt.c ./testcase-alt A: 0x7fffd8416f60 B: 0x4014 5 $ /usr/local/gcc-4.9.2/bin/gcc -O2 -fpic -mtune=nehalem -o testcase-alt testcase-alt.c ./testcase-alt A: 0x7fffc9fb1730 B: 0x7fffc9fb1730 6.95331e-310 Aborted
[Bug c/58454] New: Potentially wrong(or at least weird/inconsistent) code generation with -O2 -fno-strict-overflow
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58454 Bug ID: 58454 Summary: Potentially wrong(or at least weird/inconsistent) code generation with -O2 -fno-strict-overflow Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: mednafen at gmail dot com Created attachment 30844 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=30844action=edit Testcase program. Working: XXX@willow:~/halt$ /usr/local/gcc-4.8.1/bin/gcc -Wall -O0 -o halt halt.c XXX@willow:~/halt$ ./halt IMm3: IMm2: *** IMm1: ** IM: * : XXX@willow:~/halt$ /usr/local/gcc-4.8.1/bin/gcc -Wall -O2 -o halt halt.c XXX@willow:~/halt$ ./halt IMm3: IMm3: IMm3: IMm3: IMm3: IMm3: IMm3: IMm3: IMm3: IMm3: IMm3: IMm3: IMm3: IMm3: IMm3: IMm3: IMm3: IMm3: IMm3: IMm3: IMm3: IMm3: IMm3: IMm3: IMm3: Aborted Working: XXX@willow:~/halt$ /usr/local/gcc-4.8.1/bin/gcc -Wall -O2 -fno-aggressive-loop-optimizations -o halt halt.c XXX@willow:~/halt$ ./halt IMm3: Aborted Broken: XXX@willow:~/halt$ /usr/local/gcc-4.8.1/bin/gcc -Wall -O2 -fno-strict-overflow -o halt halt.c XXX@willow:~/halt$ ./halt IMm3: IMm2: *** IMm1: *Aborted Broken: XXX@willow:~/halt$ /usr/local/gcc-4.8.1/bin/gcc -Wall -O2 -fno-aggressive-loop-optimizations -fno-strict-overflow -o halt halt.c XXX@willow:~/halt$ ./halt IMm3: IMm2: *** IMm1: *Aborted Working: XXX@willow:~/halt$ /usr/local/gcc-4.8.1/bin/gcc -Wall -O2 -fno-strict-overflow -fno-tree-vrp -o halt halt.c XXX@willow:~/halt$ ./halt IMm3: IMm2: *** IMm1: ** IM: * Working: XXX@willow:~/halt$ /usr/local/gcc-4.8.1/bin/gcc -Wall -O2 -fno-strict-overflow -fwrapv -o halt halt.c XXX@willow:~/halt$ ./halt IMm3: IMm2: *** IMm1: ** IM: * XXX@willow:~/halt$ /usr/local/gcc-4.8.1/bin/gcc -v Using built-in specs. COLLECT_GCC=/usr/local/gcc-4.8.1/bin/gcc COLLECT_LTO_WRAPPER=/usr/local/gcc-4.8.1/libexec/gcc/x86_64-unknown-linux-gnu/4.8.1/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc-4.8.1/configure --prefix=/usr/local/gcc-4.8.1 Thread model: posix gcc version 4.8.1 (GCC)
[Bug c/58454] Potentially wrong(or at least weird/inconsistent) code generation with -O2 -fno-strict-overflow
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58454 --- Comment #2 from mednafen at gmail dot com --- Your assertion conflicts with the gcc 4.2 release change-list at http://gcc.gnu.org/gcc-4.2/changes.html when the strict-overflow options were added. Additionally, -fwrapv produces unnecessarily bloated code compared to -fno-strict-overflow, in my experience.
[Bug c/56125] New: -O2 -ffast-math generates bad code when dividing a double by the square of another double.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56125 Bug #: 56125 Summary: -O2 -ffast-math generates bad code when dividing a double by the square of another double. Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: medna...@gmail.com Created attachment 29288 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29288 Test program. XXX@willow:~$ gcc -O0 -o weird weird.c XXX@willow:~$ ./weird 7.25 XXX@willow:~$ gcc -O2 -o weird weird.c XXX@willow:~$ ./weird 7.25 XXX@willow:~$ gcc -ffast-math -O2 -o weird weird.c XXX@willow:~$ ./weird 5.126524 Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.7.2 (Debian 4.7.2-5)