🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #502

loop not-so-invariant optimization bug

#502
From: loepere
Date: Fri, 28 Jul 1989 15:40
16 lines
790 bytes
When the following program is compiled with gcc -O (1.35) on a 68020,
the computation of 'l' is taken outside of the innermost loop.
Strangely enough, if you permute the operands of the bitwise-or
operator, it compiles correctly. - Keith

foo()
{
int j, k, l;
extern int x;
	for (j = 0; j < 5; ++j)
		for (k = 0; k < 5; ++k) {
			l = ((j & 3) << 3) | k;
			if (x >= l)
				break;
		}
}
Technical Details
Message-ID: <8907281541.AA26179@AENEAS.MIT.EDU>
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!utgpu!watmath!iuvax!cica!tut.cis.ohio-state.edu!westford.ccur.com!loepere

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!utgpu!watmath!iuvax!cica!tut.cis.ohio-state.edu!westford.ccur.com!loepere
From: loepere@westford.ccur.com
Newsgroups: gnu.gcc.bug
Subject: loop not-so-invariant optimization bug
Message-ID: <8907281541.AA26179@AENEAS.MIT.EDU>
Date: 28 Jul 89 15:40:47 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 16