This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/34027] New: [4.3 regression] -Os code size nearly doubled


PR32044 makes it for months impossible to compile the Linux kernel with gcc
4.3, but I'll leave the discussions who's technically at fault (and whether gcc
4.3 will ever be able to compile the Linux kernel) to the people who know more
about such things.

But the fact that the code emitted with -Os used is nearly twice as big that's
a  regression in gcc.

Test case:

$ cat test.c
unsigned long long foobar(unsigned long long ns)
{
  while(ns >= 1000000000L)
    ns -= 1000000000L;
  return ns;
}
$ gcc --version
gcc (GCC) 4.2.3 20071014 (prerelease) (Debian 4.2.2-3)
...
$ gcc -Os test.c -c -o old-gcc.o
$ /usr/local/DIR/gcc-svn20071108/bin/gcc -Os test.c -c -o new-gcc.o
$ objdump -D old-gcc.o 

old-gcc.o:     file format elf32-i386

Disassembly of section .text:

00000000 <foobar>:
   0:   55                      push   %ebp
   1:   89 e5                   mov    %esp,%ebp
   3:   8b 45 08                mov    0x8(%ebp),%eax
   6:   8b 55 0c                mov    0xc(%ebp),%edx
   9:   eb 08                   jmp    13 <foobar+0x13>
   b:   05 00 36 65 c4          add    $0xc4653600,%eax
  10:   83 d2 ff                adc    $0xffffffff,%edx
  13:   83 fa 00                cmp    $0x0,%edx
  16:   77 f3                   ja     b <foobar+0xb>
  18:   3d ff c9 9a 3b          cmp    $0x3b9ac9ff,%eax
  1d:   77 ec                   ja     b <foobar+0xb>
  1f:   5d                      pop    %ebp
  20:   c3                      ret    
Disassembly of section .comment:
...
$ objdump -D new-gcc.o 

new-gcc.o:     file format elf32-i386

Disassembly of section .text:

00000000 <foobar>:
   0:   55                      push   %ebp
   1:   89 e5                   mov    %esp,%ebp
   3:   57                      push   %edi
   4:   56                      push   %esi
   5:   53                      push   %ebx
   6:   bb 00 36 65 c4          mov    $0xc4653600,%ebx
   b:   83 ec 0c                sub    $0xc,%esp
   e:   8b 7d 0c                mov    0xc(%ebp),%edi
  11:   8b 75 08                mov    0x8(%ebp),%esi
  14:   6a 00                   push   $0x0
  16:   68 00 ca 9a 3b          push   $0x3b9aca00
  1b:   57                      push   %edi
  1c:   56                      push   %esi
  1d:   e8 fc ff ff ff          call   1e <foobar+0x1e>
  22:   83 c4 10                add    $0x10,%esp
  25:   69 ca 00 36 65 c4       imul   $0xc4653600,%edx,%ecx
  2b:   29 c1                   sub    %eax,%ecx
  2d:   f7 e3                   mul    %ebx
  2f:   01 f0                   add    %esi,%eax
  31:   8d 14 11                lea    (%ecx,%edx,1),%edx
  34:   11 fa                   adc    %edi,%edx
  36:   8d 65 f4                lea    -0xc(%ebp),%esp
  39:   5b                      pop    %ebx
  3a:   5e                      pop    %esi
  3b:   5f                      pop    %edi
  3c:   5d                      pop    %ebp
  3d:   c3                      ret    
Disassembly of section .comment:
...
$


-- 
           Summary: [4.3 regression] -Os code size nearly doubled
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bunk at stusta dot de
 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=34027


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]