Article View: gnu.gcc.bug
Article #6259Gnu GCC 2.7.2
From: Arthur David Olson
Date: Thu, 28 Dec 1995 00:00
Date: Thu, 28 Dec 1995 00:00
49 lines
1638 bytes
1638 bytes
(We're running SunOS 4.1.1 on a Sun 4/75.)
Description:
gcc 2.7.2 sometimes produces incorrect results if its "-funroll-loops"
option is used on a SPARC box.
Repeat-By:
The code below should set each of the four elements of the "uc" array
to 1. It does the right thing without -funroll-loops; it does the
wrong thing with -funroll-loops.
Script started on Thu Dec 28 12:31:50 1995
elsie$ cat try.c
int
main()
{
unsigned char uc[4];
int col;
int bitshift;
unsigned char item;
bitshift = -1;
for (col = 0; col < sizeof uc; ++col) {
if (bitshift == -1) {
item = 255;
bitshift = 7;
}
uc[col] = (item >> bitshift) & 1;
--bitshift;
}
if (uc[0] + uc[1] + uc[2] + uc[3] != 4)
printf("OOPS!\n");
return 0;
}
elsie$ /usr/local/bin/gcc --version
2.7.2
elsie$ /usr/local/bin/gcc -O try.c
elsie$ a.out
elsie$ /usr/local/bin/gcc -O -funroll-loops try.c
elsie$ a.out
>>>> OOPS!
elsie$ exit
script done on Thu Dec 28 12:32:25 1995
--
"His twin Midas was in medicine too--sold mineral waters."
--intro from "Robert Young Sings the Rodgers & Hammerstein Songbook"
Arthur David Olson arthur_david_olson@nih.gov
Technical Details
Message-ID:
<9512281740.AA16104@elsie.nci.nih.gov>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 113d02,615e3d84c243c34d,start X-Google-Attributes: gid113d02,public From: ado@elsie.nci.nih.gov (Arthur David Olson) Subject: Gnu GCC 2.7.2 Date: 1995/12/28 Message-ID: <9512281740.AA16104@elsie.nci.nih.gov> X-Deja-AN: 123052121 distribution: gnu sender: daemon@cis.ohio-state.edu organization: GNUs Not Usenet newsgroups: gnu.gcc.bug