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 optimization/12800] New: [tree-ssa] Store dropped after cast to pointer from integer of different size


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

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

           Summary: [tree-ssa] Store dropped after cast to pointer from
                    integer of different size
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: falk at debian dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: alphaev68-unknown-linux-gnu
  GCC host triplet: alphaev68-unknown-linux-gnu
GCC target triplet: alphaev68-unknown-linux-gnu

falk@juist:/tmp% cat op.i
void op_stw_raw_T0_A0(int T2)
{
  *(char *) T2 = 0;
}

falk@juist:/tmp% gcc -W -Wall -c -O3 op.i -v
Reading specs from
/usr/local/stow/gcc-tree-ssa-2003.10.19/bin/../lib/gcc/alphaev68-unknown-linux-gnu/3.5-tree-ssa/specs
Configured with: ../configure --disable-nls --enable-languages=c++
Thread model: posix
gcc version 3.5-tree-ssa 20031019 (merged 20031017)
 /usr/local/stow/gcc-tree-ssa-2003.10.19/bin/../libexec/gcc/alphaev68-unknown-linux-gnu/3.5-tree-ssa/cc1 -fpreprocessed op.i -quiet -dumpbase op.i -mcpu=ev67 -auxbase op -O3 -W -Wall -version -o /tmp/cc31GlGU.s
GNU C version 3.5-tree-ssa 20031019 (merged 20031017) (alphaev68-unknown-linux-gnu)
        compiled by GNU C version 3.5-tree-ssa 20031015 (merged 20031005).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
op.i: In function `op_stw_raw_T0_A0':

op.i:3: warning: cast to pointer from integer of different size
 as -no-mdebug -o op.o /tmp/cc31GlGU.s

falk@juist:/tmp% objdump -d op.o            

0000000000000000 <op_stw_raw_T0_A0>:
   0:   01 80 fa 6b     ret


Correct is (as mainline produces):

0000000000000000 <op_stw_raw_T0_A0>:
   0:   00 00 f0 3b     stb     zero,0(a0)
   4:   01 80 fa 6b     ret


Works also at -O0.

Note you'd need -Wl,-taso to make a program with this code run.


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