[LLVMbugs] [Bug 157] NEW: CFE fails to bit-and a constant int with a ptr casted to long

bugzilla-daemon at zion.cs.uiuc.edu bugzilla-daemon at zion.cs.uiuc.edu
Tue Nov 25 21:25:51 PST 2003


http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=157

           Summary: CFE fails to bit-and a constant int with a ptr casted to
                    long
           Product: tools
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: llvm-gcc
        AssignedTo: sabre at nondot.org
        ReportedBy: gaeke+bugs at uiuc.edu


I'm not honestly sure how to describe what is going on here, but
the generated code for this C function fails to make it through
gccas, because the if condition turns into a shr instruction that gccas
doesn't like.  I suspect the C frontend may simply be casting the
shift amount to the wrong type.

Here's the code:
306 zion> cat c-checksum.c
static unsigned long do_csum(const unsigned char *buff, int len, unsigned long
result) {
  if (2 & (unsigned long) buff) result += 1;
  return result;
}

We get:
304 zion> llvm-gcc -c -save-temps c-checksum.c 
gccas: c-checksum.s:219: Shift constant expression requires integer operand!
Value still in symbol table! Type = 'int' Name = 'len'
Value still in symbol table! Type = 'uint' Name = 'result.0'
Value still in symbol table! Type = 'int *' Name = 'len_addr'
Value still in symbol table! Type = 'uint *' Name = 'result.1'
Value still in symbol table! Type = 'uint *' Name = 'result_addr'
Value still in symbol table! Type = 'ubyte *' Name = 'buff'
Value still in symbol table! Type = 'ubyte *' Name = 'tmp.0'
Value still in symbol table! Type = 'ubyte * *' Name = 'buff_addr'
gccas: SymbolTable.cpp:51: virtual llvm::SymbolTable::~SymbolTable(): Assertion
`LeftoverValues && "Values remain in symbol table!"' failed.
gcc: Internal error: Aborted (program as)
Please submit a full bug report.
See <URL:http://llvm.cs.uiuc.edu> for instructions.

(as an aside: I seem to have been seeing this assertion a lot lately. Maybe it
should be turned into a regular std::cerr << <message>; exit(1); sequence?)

This is reduced from linux-2.4.22.



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the llvm-bugs mailing list