home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ferkel.ucsb.edu!taco!rock!stanford.edu!agate!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!npac.syr.EDU!edelsohn
- From: edelsohn@npac.syr.EDU (David Edelsohn)
- Newsgroups: gnu.gcc.bug
- Subject: gcc-2.3.3 optimization bug on RS/6000
- Date: 26 Jan 1993 22:17:46 -0500
- Organization: GNUs Not Usenet
- Lines: 88
- Sender: daemon@cis.ohio-state.edu
- Approved: bug-gcc@prep.ai.mit.edu
- Distribution: gnu
- Message-ID: <199301261958.AA07475@king.syr.edu>
-
- The following C program produces different results depending on
- whether it is compiled with optimization or not. This code is a fragment
- of that found in libg++-2.3's iostream library (sbufvform.C) although it
- does not depend on C++ features. This bug causes libg++-2.3 to work
- incorrectly on the RS/6000 architecture.
-
- -----bug.c-----
- #include <stdio.h>
-
- #define to_digit(c) ((c) - '0')
- #define is_digit(c) ((unsigned)to_digit(c) <= 9)
-
- main(int argc, char *argv[])
- {
- register const char *fmt;
- register int ch;
- register int n;
- int prec;
-
- fmt = argv[1];
-
- ch = *fmt++;
-
- n = 0;
- while (is_digit(ch)) {
- n = 10 * n + to_digit(ch);
- ch = *fmt++;
- }
- prec = n < 0 ? -1 : n;
-
- printf("%d\n", prec);
-
- exit(0);
- }
- -----
-
- contrib% gcc -v bug.c
- Reading specs from /contrib/lib/gcc-lib/rs6000-ibm-aix32/2.3.3/specs
- gcc version 2.3.3
- /contrib/lib/gcc-lib/rs6000-ibm-aix32/2.3.3/cpp -lang-c -v -undef
- -D__GNUC__=2 -D_IBMR2 -D_AIX -D_AIX32 -D___IBMR2__ -D___AIX__ -D___AIX32__
- -D___IBMR2 -D___AIX -D___AIX32 -D__CHAR_UNSIGNED__ bug.c /tmp/ccXTICrx.i
- GNU CPP version 2.3.3
- /contrib/lib/gcc-lib/rs6000-ibm-aix32/2.3.3/cc1 /tmp/ccXTICrx.i -quiet
- -dumpbase bug.c -version -o /tmp/ccXTICrx.s
- GNU C version 2.3.3 compiled by GNU C version 2.3.3.
- as -u -o /tmp/ccXTICrx1.o /tmp/ccXTICrx.s
- /contrib/lib/gcc-lib/rs6000-ibm-aix32/2.3.3/ld -T512 -H512 -btextro
- -bhalt:4 -bnodelcsect /lib/crt0.o
- -L/contrib/lib/gcc-lib/rs6000-ibm-aix32/2.3.3 -L/contrib/lib
- /tmp/ccXTICrx1.o /contrib/lib/gcc-lib/rs6000-ibm-aix32/2.3.3/libgcc.a -lc
- /contrib/lib/gcc-lib/rs6000-ibm-aix32/2.3.3/libgcc.a
-
- contrib% a.out 23
- 23
-
- contrib% gcc -v -O bug.c
- Reading specs from /contrib/lib/gcc-lib/rs6000-ibm-aix32/2.3.3/specs
- gcc version 2.3.3
- /contrib/lib/gcc-lib/rs6000-ibm-aix32/2.3.3/cpp -lang-c -v -undef
- -D__GNUC__=2 -D_IBMR2 -D_AIX -D_AIX32 -D___IBMR2__ -D___AIX__ -D___AIX32__
- -D___IBMR2 -D___AIX -D___AIX32 -D__CHAR_UNSIGNED__ -D__OPTIMIZE__ bug.c
- /tmp/ccXTwDFW.i
- GNU CPP version 2.3.3
- /contrib/lib/gcc-lib/rs6000-ibm-aix32/2.3.3/cc1 /tmp/ccXTwDFW.i -quiet
- -dumpbase bug.c -O -version -o /tmp/ccXTwDFW.s
- GNU C version 2.3.3 compiled by GNU C version 2.3.3.
- as -u -o /tmp/ccXTwDFW1.o /tmp/ccXTwDFW.s
- /contrib/lib/gcc-lib/rs6000-ibm-aix32/2.3.3/ld -T512 -H512 -btextro
- -bhalt:4 -bnodelcsect /lib/crt0.o
- -L/contrib/lib/gcc-lib/rs6000-ibm-aix32/2.3.3 -L/contrib/lib
- /tmp/ccXTwDFW1.o /contrib/lib/gcc-lib/rs6000-ibm-aix32/2.3.3/libgcc.a -lc
- /contrib/lib/gcc-lib/rs6000-ibm-aix32/2.3.3/libgcc.a
-
- contrib% a.out 23
- -1
-
- I would appreciate receiving any patches developed to fix this bug.
-
- Thanks, David
- ===============================================================================
- David Edelsohn Dept of Physics
- Syracuse Center for Computational Science 201 Physics Bldg
- INTERNET: edelsohn@sccs.Syr.EDU Syracuse, NY 13244-1130
- "The Church doesn't have problems with sex; the world does" -- Vatican official
- "A good theory should fit on a T-shirt" -- Astronomer at Jan 1992 AAS meeting
-
-
-