[LLVMbugs] [Bug 4125] New: clang wrong code at all optimization levels

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri May 1 19:47:17 PDT 2009


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

           Summary: clang wrong code at all optimization levels
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: regehr at cs.utah.edu
                CC: llvmbugs at cs.uiuc.edu, jxyang at cs.utah.edu


Seen using r70531 on Ubuntu Hardy on x86.

regehr at john-home:~/volatile/tmp159$ llvm-gcc -O0 small.c -o small -w
regehr at john-home:~/volatile/tmp159$ ./small
checksum = 0
regehr at john-home:~/volatile/tmp159$ clang -O0 small.c -o small -w
regehr at john-home:~/volatile/tmp159$ ./small
checksum = 1
regehr at john-home:~/volatile/tmp159$ cat small.c
#include <stdio.h>
#include <stdint.h>

struct S1
{
  uint8_t f0;
  uint8_t f1;
};

struct S1 g_5 = {
  1L, 0xD8564F5E99A55AEFLL
};

struct S1 g_158 = {
  0xF5395DFB6A07BBA0LL, -9L
};

struct S1 g_297 = {
  0x48FFBA5703788BE3LL, 1L
};

struct S1 g_313 = {
  -8L, 1L
};

struct S1 func_1 (void);

uint32_t func_2 (uint8_t p_4, struct S1 p_6, uint8_t p_7);

int32_t func_23 (int32_t p_24, uint8_t p_25);

uint16_t func_35 (uint8_t p_37, int32_t p_39, int32_t p_40, uint32_t p_42,
                  int64_t p_43);

int32_t func_45 (int32_t p_46, struct S1 p_47);

struct S1 func_72 (uint16_t p_73);

struct S1 func_92 (struct S1 p_93);

struct S1 func_96 (uint32_t p_98, struct S1 p_99);

struct S1 func_1 (void)
{
  uint8_t l_3 = 0;
  struct S1 l_326 = {
    3L, 0xEB43ED56C7AF7ED3LL
  };
  uint8_t l_327 = 1;
  uint8_t l_328 = 1;
  func_2 (1, func_92 (func_72 (1)),
          func_23 (1,
                   func_45 (func_45
                            (1,
                             func_96 (func_35
                                      (g_313.f1, l_327, l_328, l_3, 1),
                                      l_326)), func_96 (l_3,
                                                        func_96 (func_35
                                                                 (g_313.f1,
                                                                  l_326.f1,
                                                                  l_326.f0,
                                                                  g_297.f1,
                                                                  l_326.f1),
                                                                 func_96
                                                                 (g_313.f0,
                                                                  l_326))))));
  return g_158;
}

uint32_t func_2 (uint8_t p_4, struct S1 p_6, uint8_t p_7)
{
  return 1;
}

int32_t func_23 (int32_t p_24, uint8_t p_25)
{
  return g_5.f1;
}

uint16_t func_35 (uint8_t p_37, int32_t p_39, int32_t p_40, uint32_t p_42,
         int64_t p_43)
{
  g_5.f0 = p_42;
  return 1;
}

int32_t func_45 (int32_t p_46, struct S1 p_47)
{
  return 1;
}

struct S1 func_72 (uint16_t p_73)
{
  return g_5;
}

struct S1 func_92 (struct S1 p_93)
{
  return g_158;
}

struct S1 func_96 (uint32_t p_98, struct S1 p_99)
{
  return g_5;
}

int main (void)
{
  func_1 ();
  printf ("checksum = %d\n", g_5.f0);
  return 0;
}


-- 
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