[Bug other/21863] strange code generation
--- Additional Comments From alonsoschaich at gmx dot de 2005-06-01 17:50 --- Created an attachment (id=9008) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9008&action=view) precompiled code and assembly output -save-temps -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21863
[Bug other/21863] New: strange code generation
Given the appended input this code gets generated by gcc 3.4 / 4.0 / 4.1 version when launched by "g++ matrix.cpp -o matrix -O2 -Wall -Wextra -pedantic -std=c++98 -save-temps": .LCFI2: leal-48(%ebp), %ecx leal-88(%ebp), %ebx subl$100, %esp .LCFI3: movl$1, -48(%ebp) movl$2, -44(%ebp) andl$-16, %esp movl$3, -40(%ebp) movl$4, -36(%ebp) subl$16, %esp movl$5, -32(%ebp) movl$6, -28(%ebp) movl$7, -24(%ebp) movl$8, -20(%ebp) movl$9, -16(%ebp) movl$10, -12(%ebp) .p2align 4,,7 could be replaced by .LCFI2: leal-48(%ebp), %ecx leal-88(%ebp), %ebx .LCFI3: movl$1, -48(%ebp) movl$2, -44(%ebp) movl$3, -40(%ebp) movl$4, -36(%ebp) movl$5, -32(%ebp) movl$6, -28(%ebp) movl$7, -24(%ebp) movl$8, -20(%ebp) movl$9, -16(%ebp) movl$10, -12(%ebp) .p2align 4,,7 Since esp won't be accessed in the remaining program. gcc -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../gcc-4.1-20050528/configure --prefix=/import/share/tools --with-local-prefix=/import/share/tools --with-arch=athlon --enable-version-specific-runtime-libs --enable-languages=c,c++ --program-suffix=-4.1 --disable-werror Thread model: posix gcc version 4.1.0 20050528 (experimental) -- Summary: strange code generation Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: other AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: alonsoschaich at gmx dot de CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21863
[Bug inline-asm/19111] Alignment ignored if optimizing for size
-- What|Removed |Added Known to fail||3.3.4 3.4.3 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19111
[Bug inline-asm/19111] Alignment ignored if optimizing for size
--- Additional Comments From alonsoschaich at gmx dot de 2004-12-21 16:33 --- Created an attachment (id=7798) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7798&action=view) .ii file -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19111
[Bug inline-asm/19111] New: Alignment ignored if optimizing for size
Hello, Please correct me if this is just invalid code, but it compiles and runs perfectly when compiled with -O0, -O1, -O2 or when build with intelC... I've reduced it to this: int main() { float __attribute__((aligned(16))) aligned_field[4]; asm ( "leal%0, %%edx\n" // load pointer to this->data[0] "movaps (%%edx), %%xmm0\n" // use aligned instruction : :"m"(aligned_field[0]) :"edx","xmm0" ); return 0; } GDB tells the application crashes in movaps. If I use movups it works with -Os. If I do something __productive__ with the data in the field, the -O3 binary doesn't crash, but I get false results, while -O2 and less work well. gcc -v says: Reading specs from /usr/lib/gcc/i686-pc-linux-gnu/3.4.3/specs Configured with: /var/tmp/portage/gcc-3.4.3-r1/work/gcc-3.4.3/configure --enable-version-specific-runtime-libs --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.4.3 --includedir=/usr/lib/gcc/i686-pc-linux-gnu/3.4.3/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.3 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.3/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.4.3/info --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/3.4.3/include/g++-v3 --host=i686-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --with-system-zlib --disable-checking --disable-werror --disable-libunwind-exceptions --enable-shared --enable-threads=posix --disable-multilib --enable-java-awt=gtk --enable-languages=c,c++,f77,objc,java Thread model: posix gcc version 3.4.3 20041125 (Gentoo Linux 3.4.3-r1, ssp-3.4.3-0, pie-8.7.7) -- Summary: Alignment ignored if optimizing for size Product: gcc Version: 3.4.3 Status: UNCONFIRMED Severity: normal Priority: P2 Component: inline-asm AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: alonsoschaich at gmx dot de CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19111