public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* optimization/7799: Loop bug with optimization flag -Os in gcc
@ 2002-09-01 10:16 Nejat AYDIN
  0 siblings, 0 replies; 2+ messages in thread
From: Nejat AYDIN @ 2002-09-01 10:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         7799
>Category:       optimization
>Synopsis:       Loop bug with optimization flag -Os in gcc
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 01 10:16:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Nejat AYDIN
>Release:        3.2
>Organization:
>Environment:
System: Linux localhost.localdomain 2.2.19-7.0.12 #1 Fri Oct 26 15:30:36 EDT 2001 i586 unknown
Architecture: i586

host: i586-pc-linux-gnu
build: i586-pc-linux-gnu
target: i586-pc-linux-gnu
configured with: /home/goodguy/src/gcc-3.2/configure --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --program-suffix=3.2 --enable-languages=c,c++,f77,java,objc

>Description:

   The C code below, when compiled with "gcc -Os loop-bug.c" and then executed,
aborts. But there is no problem if it is compiled with "gcc -O0 loop-bug.c",
or "gcc -O1 loop-bug.c", or "gcc -O2 loop-bug.c", or "gcc -O3 loop-bug.c".
The produced code when compiled with the -Os flag is wrong; It must have been
a "jbe" instruction instead of a "jle" intruction in the assembly listing
of the function "fill".

>How-To-Repeat:

   Compile the source code below with the "gcc -Os loop-bug.c" and execute
the file produced. Also compile and execute it with other optimization
flags, such as -O0, -O1, -O2, and compare the results.

/* ****************************** loop-bug.c **************************** */

void fill (int* p, int* q[10])
{
  int i;
  for (i = 0; i < 10; i++)
     *q++ = &p[i];
}

int main (void)
{
   int* p;
   int* q[10];

   q[9] = 0;
   p = (int*)0x7FFFFFF8; 
   fill(p, q);

   if (q[9] != &p[9])
      abort();

   return 0;
}

/* *********************** End of loop-bug.c *************************** */
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: optimization/7799: Loop bug with optimization flag -Os in gcc
@ 2002-12-16  8:43 ebotcazou
  0 siblings, 0 replies; 2+ messages in thread
From: ebotcazou @ 2002-12-16  8:43 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nejataydin, nobody

Old Synopsis: [3.2/3.3 regression] Loop bug with optimization flag -Os in gcc
New Synopsis: Loop bug with optimization flag -Os in gcc

State-Changed-From-To: analyzed->suspended
State-Changed-By: ebotcazou
State-Changed-When: Mon Dec 16 08:43:03 2002
State-Changed-Why:
    Fundamental deficiency of the loop induction variable elimination pass (testsuite/gcc.c-torture/execute/loop-2e.c).

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7799


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-12-16 16:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-01 10:16 optimization/7799: Loop bug with optimization flag -Os in gcc Nejat AYDIN
2002-12-16  8:43 ebotcazou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).