[Bug target/29967] New: wrong code generated with -O2 on sh4-linux

sugioka at itonet dot co dot jp gcc-bugzilla@gcc.gnu.org
Fri Nov 24 05:48:00 GMT 2006


gcc 4.1.1 generates wrong code for following source with -O2
on sh4-linux.

'-fno-schedule-insns' fixes this problem.

int *p = 0;
void *bar()
{
  return (void *)&p;
}
void foo (int code)
{
  void **pp;

  pp = bar();
  *pp = malloc (sizeof (int));
  **(int **)pp = code;  /* segmentation fault here */
}
int main()
{
  foo(1);
}


-- 
           Summary: wrong code generated with -O2 on sh4-linux
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sugioka at itonet dot co dot jp
 GCC build triplet: sh4-unknown-linux
  GCC host triplet: sh4-unknown-linux
GCC target triplet: sh4-unknown-linux


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



More information about the Gcc-bugs mailing list