This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: optimization/5781: "-O -funroll-loops" breaks machine code output
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: nobody at gcc dot gnu dot org
- Cc: gcc-prs at gcc dot gnu dot org,
- Date: 26 Feb 2002 05:26:03 -0000
- Subject: Re: optimization/5781: "-O -funroll-loops" breaks machine code output
- Reply-to: Andrew Pinski <pinskia at physics dot uc dot edu>
The following reply was made to PR optimization/5781; it has been noted by GNATS.
From: Andrew Pinski <pinskia@physics.uc.edu>
To: jodaman@cegt201.bradley.edu
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: optimization/5781: "-O -funroll-loops" breaks machine code output
Date: Tue, 26 Feb 2002 00:17:49 -0500
This has been fixed in at least 3.1 (20020223) so you can close this bug
report since 3.1
is scheduled to be released on April 15.
Thanks,
Andrew Pinski
On Monday, February 25, 2002, at 10:11 , jodaman@cegt201.bradley.edu
wrote:
>
>> Number: 5781
>> Category: optimization
>> Synopsis: "-O -funroll-loops" breaks machine code output
>> Confidential: no
>> Severity: serious
>> Priority: medium
>> Responsible: unassigned
>> State: open
>> Class: wrong-code
>> Submitter-Id: net
>> Arrival-Date: Mon Feb 25 19:16:01 PST 2002
>> Closed-Date:
>> Last-Modified:
>> Originator: jodaman@ee1.bradley.edu
>> Release: gcc version 3.0.4
>> Organization:
>> Environment:
> Linux version 2.2.20 #1 Wed Feb 6 06:07:24 CST 2002
> arch: i686
>> Description:
> Under certain conditions, the loop unrolling optimization
> will yield faulty code. The resulting code may overwrite
> the bounds of an array in a loop. Attached is a small test
> case that will crash because of this problem.
>
> Another problem test case is the LAME audio encoder
> (http://lame.sourceforge.net/) with "-O3 -funroll-loops"
> or "-O2 -funroll-loops" enabled. The developers of LAME
> are aware of the this gcc issue and have recently removed
> "-funroll-loops" for all gcc version 3 compiles.
>
> Disabling "-funroll-loops" until this problem is resolved
> may be wise because of the nature of the problem. In some
> cases, GCC may silently overstep the bounds of an array
> without any apparent immediate failure. All code compiled
> with optimization and "-funroll-loops" with GCC 3.0.3 or
> 3.0.4 is suspect. (GCC 3.0.2 might not have this problem.)
>> How-To-Repeat:
> Test case fails (crashes):
> gcc-3.0.4 -O -funroll-loops test-O_unroll.c -o test; ./test
>
> Test case completes:
> gcc-3.0.4 -O test-O_unroll.c -o test; ./test
>> Fix:
>
>> Release-Note:
>> Audit-Trail:
>> Unformatted:
> ----gnatsweb-attachment----
> Content-Type: application/octet-stream; name="test-O_unroll.c"
> Content-Transfer-Encoding: base64
> Content-Disposition: attachment; filename="test-O_unroll.c"
>
> LyoqCiAqIEBmaWxlICAgdGVzdC1PX3Vucm9sbC5jCiAqIEBhdXRob3IgSm9obiBEYWhsc3Ryb20g
> PGpvZGFtYW5AZWUxLmJyYWRsZXkuZWR1PgogKgogKiB0ZXN0IGNhc2UgZm9yICItTyAtZnVucm9s
> bC1sb29wcyIgYnVnIG9mIGdjYyAzLjAuMyBhbmQgMy4wLjQKICovCgppbnQgKmdldEEoKTsKaW50
> ICoqZ2V0QigpOwoKaW50IG1haW4oKSB7CiAgaW50IHg7CiAgaW50IGk7CiAgaW50ICphICA9IGdl
> dEEoKTsKICBpbnQgKipiID0gZ2V0QigpOyAKCiAgZm9yKCB4ID0gMDsgeCA8IDQ7IHgrKyApCiAg
> ICBmb3IoIGkgPSAxOTsgLS1pID49IDA7ICkKICAgICAgaWYoYVtpXSA8IHgpCiAgICAgICAgYlt4
> XVtpXSA9IHg7CgogIHJldHVybiAwOwp9CgpzdGF0aWMgaW50IGF6WzMyXSA9IHsgLTEsLTEsLTEs
> LTEsIC0xLC0xLC0xLC0xLCAgMCwgMCwgMCwgMCwgIDEsIDEsIDEsIDEsCiAgICAgICAgICAgICAg
> ICAgICAgICAgMSwgMiwgMiwgMiwgIDIsIDIsIDMsIDMsICAzLCA0LC0xLC0xLCAtMSwtMSwtMSwt
> MSB9OwpzdGF0aWMgc3RydWN0IHsKICBpbnQgKmJbNF07CiAgaW50IGJiWzQgKiAzMl07Cn0gYno7
> CgppbnQgKmdldEEoKSB7CiAgcmV0dXJuKCAmYXpbOF0gKTsKfQoKaW50ICoqZ2V0QigpIHsKICBp
> bnQgaTsKICBmb3IoIGkgPSAwOyBpIDwgNDsgaSsrICkKICAgIGJ6LmJbaV0gPSAmYnouYmJbaSAq
> IDMyXTsKICByZXR1cm4oIGJ6LmIgKTsKfQo=
>
>