This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/13028] New: ia64 gcc with -O2 does not store value in register into local varible
- From: "czang at panasas dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Nov 2003 21:54:05 -0000
- Subject: [Bug c/13028] New: ia64 gcc with -O2 does not store value in register into local varible
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
This can be demonstrated with the following sample program:
/*
* program starts
*/
#define ntoh64(_src_, _dest_) { \
unsigned int *src_p = (unsigned int *) _src_; \
unsigned int *dest_p = (unsigned int *) _dest_; \
*dest_p++ = *src_p++; \
*dest_p++ = *src_p++; \
}
void
call(unsigned long *number_p)
{
unsigned long seqno;
ntoh64(number_p, &seqno);
printf("in reply_received: seqno is %lu\n", seqno);
printf("in reply_received: seqno is %lu\n", seqno);
}
main() {
unsigned long number = 1010101;
call(&number);
}
/*
* program ends
*/
The following is the compile command line:
[build-hp1] gcc -v -save-temps -O2 compiler.c
Reading specs from /usr/lib/gcc-lib/ia64-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.2 2.96-112.7.2)
/usr/lib/gcc-lib/ia64-redhat-linux/2.96/cpp0 -lang-c -v -D__GNUC__=2
-D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0 -D__ia64 -D__ia64__ -D__linux
-D__linux__ -D_LONGLONG -Dlinux -Dunix -D__LP64__ -D__ELF__ -D__ia64 -D__ia64__
-D__linux -D__linux__ -D_LONGLONG -D__linux__ -D__unix__ -D__LP64__ -D__ELF__
-D__linux -D__unix -Asystem(linux) -Acpu(ia64) -Amachine(ia64) -D__OPTIMIZE__
-D__LONG_MAX__=9223372036854775807L compiler.c compiler.i
GNU CPP version 2.96 20000731 (Red Hat Linux 7.2 2.96-112.7.2) (cpplib) (IA-64)
ignoring nonexistent directory "/usr/ia64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/lib/gcc-lib/ia64-redhat-linux/2.96/include
/usr/include
End of search list.
/usr/lib/gcc-lib/ia64-redhat-linux/2.96/cc1 compiler.i -mb-step -quiet
-dumpbase compiler.c -O2 -version -o compiler.s
GNU C version 2.96 20000731 (Red Hat Linux 7.2 2.96-112.7.2) (ia64-redhat-linux)
compiled by GNU C version 2.96 20000731 (Red Hat Linux 7.2 2.96-112.7.2).
as -x -o compiler.o compiler.s
/usr/lib/gcc-lib/ia64-redhat-linux/2.96/collect2 -dynamic-linker
/lib/ld-linux-ia64.so.2 /usr/lib/gcc-lib/ia64-redhat-linux/2.96/../../../crt1.o
/usr/lib/gcc-lib/ia64-redhat-linux/2.96/../../../crti.o
/usr/lib/gcc-lib/ia64-redhat-linux/2.96/crtbegin.o
-L/usr/lib/gcc-lib/ia64-redhat-linux/2.96
-L/usr/lib/gcc-lib/ia64-redhat-linux/2.96/../../.. compiler.o -lgcc -lc -lgcc
/usr/lib/gcc-lib/ia64-redhat-linux/2.96/crtend.o
/usr/lib/gcc-lib/ia64-redhat-linux/2.96/../../../crtn.o
The following is the run of the generated program:
[build-hp1] a.out
in reply_received: seqno is 0
in reply_received: seqno is 1010101
--
Summary: ia64 gcc with -O2 does not store value in register into
local varible
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: czang at panasas dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13028