public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/13028] New: ia64 gcc with -O2 does not store value in register into local varible
@ 2003-11-12 21:54 czang at panasas dot com
2003-11-12 22:02 ` [Bug c/13028] " pinskia at gcc dot gnu dot org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: czang at panasas dot com @ 2003-11-12 21:54 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/13028] ia64 gcc with -O2 does not store value in register into local varible
2003-11-12 21:54 [Bug c/13028] New: ia64 gcc with -O2 does not store value in register into local varible czang at panasas dot com
@ 2003-11-12 22:02 ` pinskia at gcc dot gnu dot org
2003-11-14 15:18 ` czang at panasas dot com
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-12 22:02 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-11-12 22:02 -------
Not a bug as the types unsigned int and unsigned long are know not to alias (really their pointers
are) each other. Also you are using an old version of gcc (2.96 a non-supported one at that), try to
update it.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13028
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/13028] ia64 gcc with -O2 does not store value in register into local varible
2003-11-12 21:54 [Bug c/13028] New: ia64 gcc with -O2 does not store value in register into local varible czang at panasas dot com
2003-11-12 22:02 ` [Bug c/13028] " pinskia at gcc dot gnu dot org
@ 2003-11-14 15:18 ` czang at panasas dot com
2003-11-14 15:29 ` schwab at suse dot de
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: czang at panasas dot com @ 2003-11-14 15:18 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From czang at panasas dot com 2003-11-14 15:18 -------
It's debatable whether this is a bug but this is certainly a limitation. Is
this documented anywhere?
By the way I hope you at least try the sample program with your newer version of
gcc to see if it's fixed. That should only take you minutes. To download and
compile the compiler would take me at least hours. Thanks.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13028
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/13028] ia64 gcc with -O2 does not store value in register into local varible
2003-11-12 21:54 [Bug c/13028] New: ia64 gcc with -O2 does not store value in register into local varible czang at panasas dot com
2003-11-12 22:02 ` [Bug c/13028] " pinskia at gcc dot gnu dot org
2003-11-14 15:18 ` czang at panasas dot com
@ 2003-11-14 15:29 ` schwab at suse dot de
2003-12-09 23:11 ` dhazeghi at yahoo dot com
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: schwab at suse dot de @ 2003-11-14 15:29 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From schwab at suse dot de 2003-11-14 15:29 -------
Look up -Wstrict-aliasing in the manual.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13028
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/13028] ia64 gcc with -O2 does not store value in register into local varible
2003-11-12 21:54 [Bug c/13028] New: ia64 gcc with -O2 does not store value in register into local varible czang at panasas dot com
` (2 preceding siblings ...)
2003-11-14 15:29 ` schwab at suse dot de
@ 2003-12-09 23:11 ` dhazeghi at yahoo dot com
2003-12-10 12:02 ` czang at panasas dot com
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-12-09 23:11 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dhazeghi at yahoo dot com 2003-12-09 23:10 -------
As pointed out, you're violating strict aliasing rules. With gcc 3.3:
bash-2.05a$ gcc -Wall -O3 bug.c
bug.c: In function `call':
bug.c:17: warning: dereferencing type-punned pointer will break strict-aliasing rules
If you want this to work, you'll have to compile with -fno-strict-aliasing, in which case it does
work, at least with 3.3.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13028
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/13028] ia64 gcc with -O2 does not store value in register into local varible
2003-11-12 21:54 [Bug c/13028] New: ia64 gcc with -O2 does not store value in register into local varible czang at panasas dot com
` (3 preceding siblings ...)
2003-12-09 23:11 ` dhazeghi at yahoo dot com
@ 2003-12-10 12:02 ` czang at panasas dot com
2003-12-10 17:58 ` dhazeghi at yahoo dot com
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: czang at panasas dot com @ 2003-12-10 12:02 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From czang at panasas dot com 2003-12-10 12:02 -------
thanks for the info. I'll close this bug and we'll upgrade our gcc when it's
the right time. Our engineers are warned about the risk aliasing types of
different sizes when using optimization.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |CLOSED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13028
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/13028] ia64 gcc with -O2 does not store value in register into local varible
2003-11-12 21:54 [Bug c/13028] New: ia64 gcc with -O2 does not store value in register into local varible czang at panasas dot com
` (4 preceding siblings ...)
2003-12-10 12:02 ` czang at panasas dot com
@ 2003-12-10 17:58 ` dhazeghi at yahoo dot com
2003-12-10 17:58 ` dhazeghi at yahoo dot com
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-12-10 17:58 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dhazeghi at yahoo dot com 2003-12-10 17:58 -------
mark as "resolved invalid" (bugzilla consistency reasons).
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13028
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/13028] ia64 gcc with -O2 does not store value in register into local varible
2003-11-12 21:54 [Bug c/13028] New: ia64 gcc with -O2 does not store value in register into local varible czang at panasas dot com
` (5 preceding siblings ...)
2003-12-10 17:58 ` dhazeghi at yahoo dot com
@ 2003-12-10 17:58 ` dhazeghi at yahoo dot com
2005-06-05 8:32 ` pinskia at gcc dot gnu dot org
2005-06-05 8:33 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-12-10 17:58 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dhazeghi at yahoo dot com 2003-12-10 17:58 -------
Please don't mark bugs as closed...
--
What |Removed |Added
----------------------------------------------------------------------------
Status|CLOSED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13028
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/13028] ia64 gcc with -O2 does not store value in register into local varible
2003-11-12 21:54 [Bug c/13028] New: ia64 gcc with -O2 does not store value in register into local varible czang at panasas dot com
` (6 preceding siblings ...)
2003-12-10 17:58 ` dhazeghi at yahoo dot com
@ 2005-06-05 8:32 ` pinskia at gcc dot gnu dot org
2005-06-05 8:33 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-05 8:32 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-06-05 08:32 -------
Reopening to ...
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13028
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/13028] ia64 gcc with -O2 does not store value in register into local varible
2003-11-12 21:54 [Bug c/13028] New: ia64 gcc with -O2 does not store value in register into local varible czang at panasas dot com
` (7 preceding siblings ...)
2005-06-05 8:32 ` pinskia at gcc dot gnu dot org
@ 2005-06-05 8:33 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-05 8:33 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-06-05 08:32 -------
Mark as a dup of bug 21920.
*** This bug has been marked as a duplicate of 21920 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13028
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2005-06-05 8:33 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-12 21:54 [Bug c/13028] New: ia64 gcc with -O2 does not store value in register into local varible czang at panasas dot com
2003-11-12 22:02 ` [Bug c/13028] " pinskia at gcc dot gnu dot org
2003-11-14 15:18 ` czang at panasas dot com
2003-11-14 15:29 ` schwab at suse dot de
2003-12-09 23:11 ` dhazeghi at yahoo dot com
2003-12-10 12:02 ` czang at panasas dot com
2003-12-10 17:58 ` dhazeghi at yahoo dot com
2003-12-10 17:58 ` dhazeghi at yahoo dot com
2005-06-05 8:32 ` pinskia at gcc dot gnu dot org
2005-06-05 8:33 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).