public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/19828] New: [4.0 Regression] LIM is pulling out a pure function even though there is something which can modify global memory
@ 2005-02-09  5:38 pinskia at gcc dot gnu dot org
  2005-02-09  5:54 ` [Bug tree-optimization/19828] " pinskia at gcc dot gnu dot org
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-09  5:38 UTC (permalink / raw)
  To: gcc-bugs

Take the following program, it should run and work correct and not call abort but with -O1/-O2 on the 
mainline we call abort because LIM pulls out the call to f of the loop but should not because f1 can 
modify the global memory (and does).  If I uncomment the store to the global memory in the function 
containing the loop we get the correct code as LIM sees that the call to f has a VUSE and call to f1 has a 
V_MAY_DEF.

int f(void) __attribute__((pure));
int lll;
int f() { return lll; }
int f1() { lll++; return lll % 2;}
int g(void)
{
  int k, l;
  k=0;
//lll = 0;
  for(l =0;l<10;l++)
    if (f1 ())
     k = f();
  return k;
}
void abort ();

int main(void)
{
  if (g() != 9)
   abort ();
}

-- 
           Summary: [4.0 Regression] LIM is pulling out a pure function even
                    though there is something which can modify global memory
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: dnovillo at gcc dot gnu dot org,drow at gcc dot gnu dot
                    org,gcc-bugs at gcc dot gnu dot org


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


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

end of thread, other threads:[~2005-02-20 15:52 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-09  5:38 [Bug tree-optimization/19828] New: [4.0 Regression] LIM is pulling out a pure function even though there is something which can modify global memory pinskia at gcc dot gnu dot org
2005-02-09  5:54 ` [Bug tree-optimization/19828] " pinskia at gcc dot gnu dot org
2005-02-09  6:11 ` ian at airs dot com
2005-02-09  6:27 ` drow at gcc dot gnu dot org
2005-02-09  6:37 ` drow at gcc dot gnu dot org
2005-02-09  6:43 ` pinskia at gcc dot gnu dot org
2005-02-09 13:05 ` pinskia at gcc dot gnu dot org
2005-02-10 17:43 ` steven at gcc dot gnu dot org
2005-02-12 19:16 ` steven at gcc dot gnu dot org
2005-02-14  5:57 ` rakdver at gcc dot gnu dot org
2005-02-14  6:05 ` drow at gcc dot gnu dot org
2005-02-14  7:38 ` rakdver at atrey dot karlin dot mff dot cuni dot cz
2005-02-14  8:18 ` drow at gcc dot gnu dot org
2005-02-14  8:52 ` ian at airs dot com
2005-02-14  9:12 ` joseph at codesourcery dot com
2005-02-18 21:16 ` jakub at gcc dot gnu dot org
2005-02-18 21:23 ` rakdver at gcc dot gnu dot org
2005-02-19 18:07 ` cvs-commit at gcc dot gnu dot org
2005-02-19 18:08 ` jakub at gcc dot gnu dot org
2005-02-20 22:57 ` pinskia at gcc dot gnu dot org

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).