[Bug ipa/82808] New: LTO clone wrong value

npickito at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Nov 2 09:09:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82808

            Bug ID: 82808
           Summary: LTO clone wrong value
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: npickito at gmail dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---
            Target: x86-64

Version: trunk@254336, 7.x
* work on 6.x

Option:
gcc case.c -O2 -fno-inline -flto


How to reproduce:
./a.out
Aborted (core dumped)

Expect:
exited normally

Case:
void foo(double *a, double x)
{
  *a = x;
}

double f_c1(int m, double *a)
{
  foo(a, m);
  return *a;
}

int main(){
  double data;
  double ret = 0 ;

  if ((ret = f_c1(2, &data)) != 2)
    {
      __builtin_abort ();
    }
  return 0;
}


Symptom:
`x` in `foo` seems like propagated as 0.

Code gen in x86_64

foo.constprop.1:
.LFB3:
        .cfi_startproc
        movq    $0x000000000, (%rdi)
        ret
        .cfi_endproc
.LFE3:
        .size   foo.constprop.1, .-foo.constprop.1
        .p2align 4,,15
        .type   f_c1.constprop.0, @function


More information about the Gcc-bugs mailing list