public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/12404] New: pointer to union member problem
@ 2003-09-25 16:56 yamt at mwd dot biglobe dot ne dot jp
  2003-09-25 21:32 ` [Bug optimization/12404] pointer to union member problem (aliasing problem) pinskia at gcc dot gnu dot org
  2003-12-25  3:23 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: yamt at mwd dot biglobe dot ne dot jp @ 2003-09-25 16:56 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12404

           Summary: pointer to union member problem
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: yamt at mwd dot biglobe dot ne dot jp
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-unknown-netbsdelf1.6W
  GCC host triplet: i386--netbsdelf
GCC target triplet: i386--netbsdelf

compiling the following program with -O2 for i386
yields the latter asm output.

% gcc -v
Using built-in specs.
Configured with: /usr/src/tools/gcc/../../gnu/dist/gcc/configure --enable-long-long --disable-multilib --enable-threads --build=i386-unknown-netbsdelf --host=i386--netbsdelf --target=i386--netbsdelf : (reconfigured) /usr/src/tools/gcc/../../gnu/dist/gcc/configure --enable-long-long --disable-multilib --enable-threads --build=i386-unknown-netbsdelf1.6W --host=i386--netbsdelf --target=i386--netbsdelf
Thread model: posix
gcc version 3.3.1

============================================================
#include <stdio.h>

int
main()
{
	union { int i; short s; } u[] = {{1}, {2}, {3}};

	printf("%d\n", *&u->s);
}
============================================================
	.file	"a.c"
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
	.text
	.p2align 2,,3
.globl main
	.type	main, @function
main:
	pushl	%ebp
	movl	%esp, %ebp
	subl	$24, %esp
	andl	$-16, %esp
	subl	$8, %esp
	movswl	-24(%ebp),%eax	# <= used before initialized.
	pushl	%eax
	pushl	$.LC0
	movl	$1, -24(%ebp)	# <= initialize here
	movl	$2, -20(%ebp)
	movl	$3, -16(%ebp)
	call	printf
	leave
	ret
	.size	main, .-main
	.ident	"GCC: (GNU) 3.3.1"


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug optimization/12404] pointer to union member problem (aliasing problem)
  2003-09-25 16:56 [Bug optimization/12404] New: pointer to union member problem yamt at mwd dot biglobe dot ne dot jp
@ 2003-09-25 21:32 ` pinskia at gcc dot gnu dot org
  2003-12-25  3:23 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-09-25 21:32 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12404


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2003-09-25 21:21:14
               date|                            |
            Summary|pointer to union member     |pointer to union member
                   |problem                     |problem (aliasing problem)


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-09-25 21:21 -------
I can confirm this on the mainline (20030925), the problem is aliasing issue.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug optimization/12404] pointer to union member problem (aliasing problem)
  2003-09-25 16:56 [Bug optimization/12404] New: pointer to union member problem yamt at mwd dot biglobe dot ne dot jp
  2003-09-25 21:32 ` [Bug optimization/12404] pointer to union member problem (aliasing problem) pinskia at gcc dot gnu dot org
@ 2003-12-25  3:23 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-12-25  3:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-12-25 03:13 -------
Fixed on the mainline (20031224).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |3.4.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12404


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-12-25  3:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-25 16:56 [Bug optimization/12404] New: pointer to union member problem yamt at mwd dot biglobe dot ne dot jp
2003-09-25 21:32 ` [Bug optimization/12404] pointer to union member problem (aliasing problem) pinskia at gcc dot gnu dot org
2003-12-25  3:23 ` 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).