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/15886] New: [3.4.1] SH: Miscompilation with -O2 -fPIC


Gcc-3.4.1 generates wrong code when compiling attached code with '-O2 -fPIC'.
Adding -fno-regmove fixes this.

Compile:
  $ sh-linux-gcc -O2 -fPIC -S dl-open.i

Miscompiled source code:
  args.caller_dl_open = __builtin_extract_return_addr (__builtin_return_address 
(0));

Generated wrong code:
  mov    r4,r11
  [snip]
  sts    pr,r0
  [snip]
  mov.l  r11,@(12,r14)       --- original pr should be stored to @(12,r14)

Correct code (-O2 -fPIC -fno-regmove):
  sts    pr,r10
  [snip]
  mov.l  r10,@(12,r14)

-- 
           Summary: [3.4.1] SH: Miscompilation with -O2 -fPIC
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sugioka at itonet dot co dot jp
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: sh-unknown-linux-gnu


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


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