Debian Bug report logs - #472867
[PR middle-end/36124] gcc-4.3: gcc regression in optimization (4.2 -> 4.3)

version graph

Package: gcc-4.3; Maintainer for gcc-4.3 is Debian GCC Maintainers <debian-gcc@lists.debian.org>;

Reported by: Cyprien LAPLACE <cyprien+debianbug@cypou.net>

Date: Wed, 26 Mar 2008 22:42:02 UTC

Severity: normal

Tags: fixed-upstream

Found in version gcc-4.3/4.3.0-2

Forwarded to http://gcc.gnu.org/PR36124

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#472867; Package gcc-4.3. Full text and rfc822 format available.

Acknowledgement sent to Cyprien LAPLACE <cyprien+debianbug@cypou.net>:
New Bug report received and forwarded. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Cyprien LAPLACE <cyprien+debianbug@cypou.net>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: gcc-4.3: gcc regression in optimization (4.2 -> 4.3)
Date: Wed, 26 Mar 2008 23:38:53 +0100
Package: gcc-4.3
Version: 4.3.0-2
Severity: grave
Justification: renders package unusable


gcc-4.3 forgets some checks in -O2 and -O3, tested on x86_64 and arm
(cross-compiler) targets.

the following is an exemple code with disassembled generated code by
gcc for 4.2 and 4.3 versions:


/* a.c */

int main()
{
  register char (*foo)[32] = (void*)0xffff8000;
  do {
    asm volatile("mov %0, %0"::"r"(foo));
  } while(++foo);
  return (long)**foo;
}

/******* gcc 4.2 ********

 * gcc-4.2 -c a.c -O2
 * objdump -d a.o

a.o:     file format elf64-x86-64

Disassembly of section .text:

0000000000000000 <main>:
   0:   b8 00 80 ff ff          mov    $0xffff8000,%eax
   5:   48 89 c0                mov    %rax,%rax
   8:   48 83 c0 20             add    $0x20,%rax
   c:   75 f7                   jne    5 <main+0x5>
   e:   0f be 04 25 00 00 00    movsbl 0x0,%eax
  15:   00 
  16:   c3                      retq   


 * arm-linux-gnueabi-gcc-4.2 -c a.c -O3
 * arm-linux-gnueabi-objdump -d a.o

a.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <main>:
   0:	e59f3010 	ldr	r3, [pc, #16]	; 18 <main+0x18>
   4:	e1a03003 	mov	r3, r3
   8:	e2933020 	adds	r3, r3, #32	; 0x20
   c:	1afffffc 	bne	4 <main+0x4>
  10:	e5d30000 	ldrb	r0, [r3]
  14:	e12fff1e 	bx	lr
  18:	ffff8000 	.word	0xffff8000

 ******* gcc 4.3 ********

 * gcc-4.3 -c a.c -O2
 * objdump -d a.o

a.o:     file format elf64-x86-64

Disassembly of section .text:

0000000000000000 <main>:
   0:   b8 00 80 ff ff          mov    $0xffff8000,%eax
   5:   0f 1f 00                nopl   (%rax)
   8:   48 89 c0                mov    %rax,%rax
   b:   48 83 c0 20             add    $0x20,%rax
   f:   eb f7                   jmp    8 <main+0x8>


 * arm-linux-gnueabi-gcc-4.3 -c a.c -O3
 * arm-linux-gnueabi-objdump -d a.o

a.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <main>:
   0:	e59f3008 	ldr	r3, [pc, #8]	; 10 <main+0x10>
   4:	e1a03003 	mov	r3, r3
   8:	e2833020 	add	r3, r3, #32	; 0x20
   c:	eafffffc 	b	4 <main+0x4>
  10:	ffff8000 	.word	0xffff8000

*/

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.22-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages gcc-4.3 depends on:
ii  binutils            2.18.1~cvs20080103-1 The GNU assembler, linker and bina
ii  cpp-4.3             4.3.0-2              The GNU C preprocessor
ii  gcc-4.3-base        4.3.0-2              The GNU Compiler Collection (base 
ii  libc6               2.7-8                GNU C Library: Shared libraries
ii  libgcc1             1:4.3.0-2            GCC support library
ii  libgomp1            4.3.0-2              GCC OpenMP (GOMP) support library

Versions of packages gcc-4.3 recommends:
ii  libc6-dev                     2.7-8      GNU C Library: Development Librari

-- no debconf information




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#472867; Package gcc-4.3. Full text and rfc822 format available.

Acknowledgement sent to Cyprien Laplace <cyprien.laplace@trango-vp.com>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #10 received at 472867@bugs.debian.org (full text, mbox):

From: Cyprien Laplace <cyprien.laplace@trango-vp.com>
To: 472867@bugs.debian.org
Subject: more simplier loop
Date: Thu, 27 Mar 2008 00:26:50 +0100
/* b.c */

int main()
{
 register long foo = 0;
 do {
   asm volatile("nop"::"r"(foo));
 } while(++foo);
 return 0;
}



which gives with gcc-4.3 -O2 -c b.c:


b.o:     file format elf64-x86-64

Disassembly of section .text:

0000000000000000 <main>:
  0:   b8 00 00 00 00          mov    $0x0,%eax
  5:   90                      nop   
  6:   48 83 c0 01             add    $0x1,%rax
  a:   75 f9                   jne    5 <main+0x5>
  c:   b8 00 00 00 00          mov    $0x0,%eax
 11:   c3                      retq  


and with arm-linux-gnueabi-gcc-4.3 -O2 -c b.c:

b.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <main>:
  0:   e3a03000        mov     r3, #0  ; 0x0
  4:   e1a00000        nop                     (mov r0,r0)
  8:   e2833001        add     r3, r3, #1      ; 0x1
  c:   eafffffc        b       4 <main+0x4>





Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#472867; Package gcc-4.3. Full text and rfc822 format available.

Acknowledgement sent to Cyprien LAPLACE <cyprien+debianbug@cypou.net>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #15 received at 472867@bugs.debian.org (full text, mbox):

From: Cyprien LAPLACE <cyprien+debianbug@cypou.net>
To: 472867@bugs.debian.org
Subject: more simplier loop (asm x86 corrected)
Date: Thu, 27 Mar 2008 00:33:58 +0100
/* b.c */

int main()
{
 register long foo = 0;
 do {
   asm volatile("nop"::"r"(foo));
 } while(++foo);
 return 0;
}



which gives with gcc-4.3 -O2 -c b.c:


b.o:     file format elf64-x86-64

Disassembly of section .text:

0000000000000000 <main>:
   0:   31 c0                   xor    %eax,%eax
   2:   66 0f 1f 44 00 00       nopw   0x0(%rax,%rax,1)
   8:   90                      nop
   9:   48 83 c0 01             add    $0x1,%rax
   d:   eb f9                   jmp    8 <main+0x8>


and with arm-linux-gnueabi-gcc-4.3 -O2 -c b.c:

b.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <main>:
  0:   e3a03000        mov     r3, #0  ; 0x0
  4:   e1a00000        nop                     (mov r0,r0)
  8:   e2833001        add     r3, r3, #1      ; 0x1
  c:   eafffffc        b       4 <main+0x4>






Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#472867; Package gcc-4.3. Full text and rfc822 format available.

Acknowledgement sent to Bastian Blank <waldi@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #20 received at 472867@bugs.debian.org (full text, mbox):

From: Bastian Blank <waldi@debian.org>
To: Cyprien LAPLACE <cyprien+debianbug@cypou.net>, 472867@bugs.debian.org
Subject: Re: Bug#472867: more simplier loop (asm x86 corrected)
Date: Thu, 27 Mar 2008 08:26:44 +0100
On Thu, Mar 27, 2008 at 12:33:58AM +0100, Cyprien LAPLACE wrote:
> /* b.c */
> 
> int main()
> {
>  register long foo = 0;

"signed long". Signed integer values have no overflow behaviour in C.
Use "unsigned long" if you want that.

>  do {
>    asm volatile("nop"::"r"(foo));
>  } while(++foo);

Can be expressed as endless loop.

>  return 0;
> }

> Disassembly of section .text:
> 
> 0000000000000000 <main>:
>    0:   31 c0                   xor    %eax,%eax
>    2:   66 0f 1f 44 00 00       nopw   0x0(%rax,%rax,1)
>    8:   90                      nop
>    9:   48 83 c0 01             add    $0x1,%rax
>    d:   eb f9                   jmp    8 <main+0x8>

gcc converts it into an endless loop.

Bastian

-- 
Killing is stupid; useless!
		-- McCoy, "A Private Little War", stardate 4211.8




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#472867; Package gcc-4.3. Full text and rfc822 format available.

Acknowledgement sent to Cyprien LAPLACE <cyprien+debianbug@cypou.net>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #25 received at 472867@bugs.debian.org (full text, mbox):

From: Cyprien LAPLACE <cyprien+debianbug@cypou.net>
To: Bastian Blank <waldi@debian.org>, 472867@bugs.debian.org
Subject: Re: Bug#472867: more simplier loop (asm x86 corrected)
Date: Thu, 27 Mar 2008 09:03:22 +0100
Hum, well .. another sample test:

/* c.c */

extern void func(void*);

void test()
{
    register char (*foo)[32] = (typeof(foo))0-1024;
    register int index;
    for(index=0;index<1024;index++) {
        func(foo++);
    }
}

gives, in x86_32:

$ gcc-4.3 -c c.c -O3 && objdump -d c.o

c.o:     file format elf32-i386

Disassembly of section .text:

00000000 <test>:
   0:   55                      push   %ebp
   1:   b8 00 80 ff ff          mov    $0xffff8000,%eax
   6:   89 e5                   mov    %esp,%ebp
   8:   53                      push   %ebx
   9:   83 ec 04                sub    $0x4,%esp
   c:   8d 74 26 00             lea    0x0(%esi),%esi
  10:   8d 58 20                lea    0x20(%eax),%ebx
  13:   89 04 24                mov    %eax,(%esp)
  16:   e8 fc ff ff ff          call   17 <test+0x17>
  1b:   89 d8                   mov    %ebx,%eax
  1d:   eb f1                   jmp    10 <test+0x10>


still an infinite loop...

Cyprien





Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#472867; Package gcc-4.3. Full text and rfc822 format available.

Acknowledgement sent to arthur.loiret@u-psud.fr:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #30 received at 472867@bugs.debian.org (full text, mbox):

From: Arthur Loiret <arthur.loiret@u-psud.fr>
To: Cyprien LAPLACE <cyprien+debianbug@cypou.net>, 472867@bugs.debian.org
Cc: control@bugs.debian.org
Subject: Re: Bug#472867: gcc-4.3: gcc regression in optimization (4.2 -> 4.3)
Date: Sat, 3 May 2008 01:26:37 +0200
[Message part 1 (text/plain, inline)]
severity 472867 normal
thanks


On Wed, Mar 26, 2008 at 11:38:53PM +0100, Cyprien LAPLACE wrote:
> Severity: grave
> Justification: renders package unusable

Not that much.


> gcc-4.3 forgets some checks in -O2 and -O3, tested on x86_64 and arm
> (cross-compiler) targets.

Can you please report this upstream ? See http://gcc.gnu.org/bugzilla/


> the following is an exemple code with disassembled generated code by
> gcc for 4.2 and 4.3 versions:

It is easier to run gcc with -S (compile but don't assemble) than compile and
then disassemble the binary.

[signature.asc (application/pgp-signature, inline)]

Severity set to `normal' from `grave' Request was from Arthur Loiret <arthur.loiret@u-psud.fr> to control@bugs.debian.org. (Fri, 02 May 2008 23:36:03 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#472867; Package gcc-4.3. Full text and rfc822 format available.

Acknowledgement sent to Cyprien LAPLACE <cyprien+debianbug@cypou.net>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #37 received at 472867@bugs.debian.org (full text, mbox):

From: Cyprien LAPLACE <cyprien+debianbug@cypou.net>
To: arthur.loiret@u-psud.fr
Subject: Re: Bug#472867: gcc-4.3: gcc regression in optimization (4.2 -> 4.3)
Date: Sat, 03 May 2008 12:05:32 +0200
Arthur Loiret a écrit :
> severity 472867 normal
> thanks
>
>
> On Wed, Mar 26, 2008 at 11:38:53PM +0100, Cyprien LAPLACE wrote:
>   
>> Severity: grave
>> Justification: renders package unusable
>>     
>
> Not that much.
>   
that was breaking one of mine (arm tlb flushing loop)... but I recog it 
should be rare.

>> gcc-4.3 forgets some checks in -O2 and -O3, tested on x86_64 and arm
>> (cross-compiler) targets.
>>     
>
> Can you please report this upstream ? See http://gcc.gnu.org/bugzilla/
>   
I'll need to test it on bare and fresh gnu compiler, which I don't have 
right now. I'll compile one.

>> the following is an exemple code with disassembled generated code by
>> gcc for 4.2 and 4.3 versions:
>>     
>
> It is easier to run gcc with -S (compile but don't assemble) than compile and
> then disassemble the binary.
yes :-)

Regards,
Cyprien




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#472867; Package gcc-4.3. Full text and rfc822 format available.

Acknowledgement sent to arthur.loiret@u-psud.fr:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #42 received at 472867@bugs.debian.org (full text, mbox):

From: Arthur Loiret <arthur.loiret@u-psud.fr>
To: Cyprien LAPLACE <cyprien+debianbug@cypou.net>, 472867@bugs.debian.org
Subject: Re: Bug#472867: gcc-4.3: gcc regression in optimization (4.2 -> 4.3)
Date: Sat, 3 May 2008 18:12:23 +0200
[Message part 1 (text/plain, inline)]
On Sat, May 03, 2008 at 12:05:32PM +0200, Cyprien LAPLACE wrote:
>> Can you please report this upstream ? See http://gcc.gnu.org/bugzilla/
>>   
> I'll need to test it on bare and fresh gnu compiler, which I don't have  
> right now. I'll compile one.

The gcc-4.3 from sid is up-to-date to the gcc-4_3-branch 20080501. So you can
report it if you think this is a 4.3 regression. If you want to try from a
trunk gcc, just wait for next gcc-snapshot upload which should be 20080502.

[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#472867; Package gcc-4.3. Full text and rfc822 format available.

Acknowledgement sent to Florian Weimer <fw@deneb.enyo.de>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #47 received at 472867@bugs.debian.org (full text, mbox):

From: Florian Weimer <fw@deneb.enyo.de>
To: Cyprien LAPLACE <cyprien+debianbug@cypou.net>
Cc: 472867@bugs.debian.org, Bastian Blank <waldi@debian.org>
Subject: Re: Bug#472867: more simplier loop (asm x86 corrected)
Date: Sat, 03 May 2008 21:22:21 +0200
* Cyprien LAPLACE:

> Hum, well .. another sample test:
>
> /* c.c */
>
> extern void func(void*);
>
> void test()
> {
>     register char (*foo)[32] = (typeof(foo))0-1024;
>     register int index;
>     for(index=0;index<1024;index++) {
>         func(foo++);
>     }
> }

This is still undefined.  If you need machine address arithmetic, you
should use uintptr_t and hope for the best.




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#472867; Package gcc-4.3. Full text and rfc822 format available.

Acknowledgement sent to Cyprien LAPLACE <cyprien+debianbug@cypou.net>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #52 received at 472867@bugs.debian.org (full text, mbox):

From: Cyprien LAPLACE <cyprien+debianbug@cypou.net>
To: Florian Weimer <fw@deneb.enyo.de>
Cc: 472867@bugs.debian.org, Bastian Blank <waldi@debian.org>
Subject: Re: Bug#472867: more simplier loop (asm x86 corrected)
Date: Sun, 04 May 2008 11:51:37 +0200
Florian Weimer a écrit :
> * Cyprien LAPLACE:
>
>   
>> Hum, well .. another sample test:
>>
>> /* c.c */
>>
>> extern void func(void*);
>>
>> void test()
>> {
>>     register char (*foo)[32] = (typeof(foo))0-1024;
>>     register int index;
>>     for(index=0;index<1024;index++) {
>>         func(foo++);
>>     }
>> }
>>     
>
> This is still undefined.  If you need machine address arithmetic, you
> should use uintptr_t and hope for the best.
>   

Does it mean that the loop indexed on an integer should become an 
infinite loop ?




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#472867; Package gcc-4.3. Full text and rfc822 format available.

Acknowledgement sent to Florian Weimer <fw@deneb.enyo.de>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #57 received at 472867@bugs.debian.org (full text, mbox):

From: Florian Weimer <fw@deneb.enyo.de>
To: Cyprien LAPLACE <cyprien+debianbug@cypou.net>
Cc: 472867@bugs.debian.org, Bastian Blank <waldi@debian.org>
Subject: Re: Bug#472867: more simplier loop (asm x86 corrected)
Date: Sun, 04 May 2008 13:04:19 +0200
* Cyprien LAPLACE:

>> This is still undefined.  If you need machine address arithmetic, you
>> should use uintptr_t and hope for the best.

> Does it mean that the loop indexed on an integer should become an
> infinite loop ?

Not necessarily.  However, the compiler may assume that foo() performs a
non-local exit before invalid pointer arithmetic occurs.




Information forwarded to debian-bugs-dist@lists.debian.org, Debian GCC Maintainers <debian-gcc@lists.debian.org>:
Bug#472867; Package gcc-4.3. Full text and rfc822 format available.

Acknowledgement sent to Cyprien LAPLACE <cyprien+debianbug@cypou.net>:
Extra info received and forwarded to list. Copy sent to Debian GCC Maintainers <debian-gcc@lists.debian.org>. Full text and rfc822 format available.

Message #62 received at 472867@bugs.debian.org (full text, mbox):

From: Cyprien LAPLACE <cyprien+debianbug@cypou.net>
To: 472867@bugs.debian.org
Subject: bug report on gcc bugzilla
Date: Sun, 04 May 2008 18:26:52 +0200
Added bugreport on gcc bugzilla #36124

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36124




Noted your statement that Bug has been forwarded to http://gcc.gnu.org/PR36124. Request was from Arthur Loiret <arthur.loiret@u-psud.fr> to control@bugs.debian.org. (Sun, 04 May 2008 17:30:02 GMT) Full text and rfc822 format available.

Tags added: fixed-upstream Request was from bts-link-upstream@lists.alioth.debian.org to control@bugs.debian.org. (Sat, 10 May 2008 14:49:11 GMT) Full text and rfc822 format available.

Changed Bug title to `[PR middle-end/36124] gcc-4.3: gcc regression in optimization (4.2 -> 4.3)' from `gcc-4.3: gcc regression in optimization (4.2 -> 4.3)'. Request was from Arthur Loiret <arthur.loiret@u-psud.fr> to control@bugs.debian.org. (Thu, 18 Dec 2008 10:24:14 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Wed Apr 16 13:53:27 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.