This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/24255] New: [4.1 regression] __transparent_union__ mishandled


Instead of passing the pointer to the variable itself a pointer to a temporary
holding the address of the variable is used.

$ cat wait.c
typedef union
{
  union wait *__uptr;
  int *__iptr;
} __WAIT_STATUS __attribute__ ((__transparent_union__));
union wait
{
  int w_status;
};
int wait (__WAIT_STATUS __status_loc);

int do_wait (void) { int status; wait (&status); return status; }
$ gcc -O2 -S -fverbose-asm wait.c
$ cat wait.s
        .file   "wait.c"

 # rs6000/powerpc options: -msdata=data -G 8
 # GNU C version 4.1.0 20051001 (experimental) (SUSE Linux)
(powerpc64-suse-linux)
 #      compiled by GNU C version 4.1.0 20051001 (experimental) (SUSE Linux).
 # GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
 # options passed:  -iprefix -isystem -D__unix__ -D__gnu_linux__
 # -D__linux__ -Dunix -D__unix -Dlinux -D__linux -Asystem=linux
 # -Asystem=unix -Asystem=posix -auxbase -O2 -fverbose-asm
 # options enabled:  -falign-loops -fargument-alias -fbranch-count-reg
 # -fcaller-saves -fcommon -fcprop-registers -fcrossjumping
 # -fcse-follow-jumps -fcse-skip-blocks -fdefer-pop
 # -fdelete-null-pointer-checks -fearly-inlining
 # -feliminate-unused-debug-types -fexpensive-optimizations -ffunction-cse
 # -fgcse -fgcse-lm -fguess-branch-probability -fident -fif-conversion
 # -fif-conversion2 -finline-functions-called-once -fipa-pure-const
 # -fipa-reference -fipa-type-escape -fivopts -fkeep-static-consts
 # -fleading-underscore -floop-optimize -floop-optimize2 -fmath-errno
 # -fmerge-constants -fomit-frame-pointer -foptimize-register-move
 # -foptimize-sibling-calls -fpeephole -fpeephole2 -freg-struct-return
 # -fregmove -freorder-blocks -freorder-functions -frerun-cse-after-loop
 # -frerun-loop-opt -fsched-interblock -fsched-spec
 # -fsched-stalled-insns-dep -fschedule-insns -fschedule-insns2
 # -fshow-column -fsplit-ivs-in-unroller -fstrength-reduce
 # -fstrict-aliasing -fthread-jumps -ftrapping-math -ftree-ccp -ftree-ch
 # -ftree-copy-prop -ftree-copyrename -ftree-dce -ftree-dominator-opts
 # -ftree-dse -ftree-fre -ftree-loop-im -ftree-loop-ivcanon
 # -ftree-loop-optimize -ftree-lrs -ftree-pre -ftree-salias -ftree-sink
 # -ftree-sra -ftree-store-ccp -ftree-store-copy-prop -ftree-ter
 # -ftree-vect-loop-version -ftree-vrp -funit-at-a-time -fverbose-asm
 # -fzero-initialized-in-bss -m32 -maix-struct-return -mbig -mbig-endian
 # -mbss-plt -mfp-in-toc -mfused-madd -mhard-float -mnew-mnemonics
 # -mpowerpc -msched-prolog -mupdate

 # Compiler executable checksum: 98247ca61e462f7c754c17f0242fef41

        .section        ".text"
        .align 2
        .p2align 4,,15
        .globl do_wait
        .type   do_wait, @function
do_wait:
        mflr 0   #,
        stwu 1,-32(1)    #,,
        stw 0,36(1)      #,
        addi 3,1,24      #,,
        addi 0,1,8       # status.1,,
        stw 0,24(1)      #, status.1
        bl wait  #
        lwz 0,36(1)      #,
        lwz 3,8(1)       # status, <result>
        addi 1,1,32      #,,
        mtlr 0   #,
        blr      #
        .size   do_wait,.-do_wait
        .ident  "GCC: (GNU) 4.1.0 20051001 (experimental) (SUSE Linux)"
        .section        .note.GNU-stack,"",@progbits


-- 
           Summary: [4.1 regression] __transparent_union__ mishandled
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: schwab at suse dot de
GCC target triplet: powerpc-linux


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]