[LLVMbugs] [Bug 3024] New: possible volatile bug

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Nov 7 14:09:15 PST 2008


           Summary: possible volatile bug
           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

I apologize for the poor timing of my recent bug reports!  Unfortunately I'm at
the mercy of the random number generator here.

This is seen on r58855 on Ubuntu Hardy on x86.

It looks like a backend bug: the bitcode accesses the volatile the right number
of times at all optimization levels, but the x86 doesn't.

The code is below.  The right number of reads from g_107 is 2.  At -O1,
llvm-gcc produces x86 that reads this variable only once.

#include <stdio.h>

volatile unsigned int g_107;
int x;

static inline unsigned int
rshift_u_u(unsigned int left, unsigned int right)
        if (right >= sizeof(unsigned int)*8) {
                /* Avoid undefined behavior. */
                return left;
        return left >> right;

void func_95 (unsigned int p_97);
void func_95 (unsigned int p_97)
  for (; p_97 < -7; --p_97)
    if (rshift_u_u (g_107, (-9L * p_97)))

main (void)
  func_95 (1);
  printf ("checksum = 0\n");
  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