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

Reply via email to