[LLVMbugs] [Bug 11977] New: possible wrong code bug

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Feb 10 13:35:57 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=11977

             Bug #: 11977
           Summary: possible wrong code bug
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: regehr at cs.utah.edu
                CC: chenyang at cs.utah.edu, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Sorry for the ugly test case -- this one is not responding well to reduction
attempts.

[regehr at gamow 2]$ clang -v
clang version 3.1 (trunk 150180)
Target: x86_64-unknown-linux-gnu
Thread model: posix
[regehr at gamow 2]$ clang -O1 small.c ; ./a.out 
1
[regehr at gamow 2]$ clang -O2 small.c ; ./a.out 
0
[regehr at gamow 2]$ cat small.c
int printf (const char *, ...);

#pragma pack(1)
struct S1
{
  int f0;
  char f1;
  short f2;
} g_43 = { }, g_123, g_1126;

int fn1 (struct S1 p1)
{
  g_123.f0 = 0;
  return 0;
}

void fn2 (void)
{
  struct S1 l_1445;
  g_1126 = l_1445 = g_43;
}

int g_474;

int main (void)
{
  struct S1 l_38;
  l_38 = g_43;
  fn1 (g_43);
  g_474 = l_38.f0;
  l_38.f2 || fn1 (g_123);
  for (g_43.f1 = 1; ; g_43.f1++)
    break;
  fn2 ();
  printf ("%d\n", g_1126.f1);
}

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list