Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by Charlie Xiaoli Huang
Wed, 05 Aug 1992 20:33
gcc 2.2.2 bug on Sun OS 4.1.1
Author: Charlie Xiaoli Huang
Date: Wed, 05 Aug 1992 20:33
Date: Wed, 05 Aug 1992 20:33
116 lines
3442 bytes
3442 bytes
Enclosed please find a small shar file containing 2
very short C files (< 20 lines total) and a Makefile.
If compiled as per Makefile, it produces incorrect
result --- a local variable was altered after a
call to an external function which does not have access
to this local variable.
The platform is Sun OS 4.1.1 with gcc 2.2.2 and the bundled
cc from Sun.
It seems to be a bug with the optimize. The very first instruction
in the optimize code for routine foo of file foo.c trashed the
said variable.
Thanks in advance,
hxl
#!/bin/sh
# This is a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 08/05/1992 18:57 UTC by hxl@chopin
# Source directory /tmp_mnt/cessna/hxl/tmp
#
# existing files will NOT be overwritten unless -c is specified
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 132 -rw-r--r-- gcc2bug/foo.c
# 142 -rw-r--r-- gcc2bug/a.c
# 96 -rw-r--r-- gcc2bug/Makefile
#
# ============= gcc2bug/foo.c ==============
if test ! -d 'gcc2bug'; then
echo 'x - creating directory gcc2bug'
mkdir 'gcc2bug'
fi
if test -f 'gcc2bug/foo.c' -a X"$1" != X"-c"; then
echo 'x - skipping gcc2bug/foo.c (File already exists)'
else
echo 'x - extracting gcc2bug/foo.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gcc2bug/foo.c' &&
int tm = 0;
float y;
float z;
foo(x)
int x;
{
X y = (float)x/(float)100;
X return 1;
}
X
main()
{
X extern int clk();
X clk();
}
SHAR_EOF
chmod 0644 gcc2bug/foo.c ||
echo 'restore of gcc2bug/foo.c failed'
Wc_c="`wc -c < 'gcc2bug/foo.c'`"
test 132 -eq "$Wc_c" ||
echo 'gcc2bug/foo.c: original size 132, current size' "$Wc_c"
fi
# ============= gcc2bug/a.c ==============
if test -f 'gcc2bug/a.c' -a X"$1" != X"-c"; then
echo 'x - skipping gcc2bug/a.c (File already exists)'
else
echo 'x - extracting gcc2bug/a.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gcc2bug/a.c' &&
clk()
{
X extern int tm;
X int t1;
X register int t2;
X
X extern int foo();
X
X t1 = 0;
X t2 = 100;
X
X foo(t2);
X printf("%d\n", t1);
}
SHAR_EOF
chmod 0644 gcc2bug/a.c ||
echo 'restore of gcc2bug/a.c failed'
Wc_c="`wc -c < 'gcc2bug/a.c'`"
test 142 -eq "$Wc_c" ||
echo 'gcc2bug/a.c: original size 142, current size' "$Wc_c"
fi
# ============= gcc2bug/Makefile ==============
if test -f 'gcc2bug/Makefile' -a X"$1" != X"-c"; then
echo 'x - skipping gcc2bug/Makefile (File already exists)'
else
echo 'x - extracting gcc2bug/Makefile (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'gcc2bug/Makefile' &&
foo: foo.o a.o
X gcc -o foo foo.o a.o
X
foo.o: foo.c
X gcc -g -O2 -c foo.c
X
a.o: a.c
X cc -g -c a.c
SHAR_EOF
chmod 0644 gcc2bug/Makefile ||
echo 'restore of gcc2bug/Makefile failed'
Wc_c="`wc -c < 'gcc2bug/Makefile'`"
test 96 -eq "$Wc_c" ||
echo 'gcc2bug/Makefile: original size 96, current size' "$Wc_c"
fi
exit 0
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads