Skip to content

[llvmgcc] Pointer & constant results in invalid shift #529

@llvmbot

Description

@llvmbot
Bugzilla Link 157
Resolution FIXED
Resolved on Feb 22, 2010 12:43
Version 1.0
OS All
Reporter LLVM Bugzilla Contributor

Extended Description

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 << ; exit(1); sequence?)

This is reduced from linux-2.4.22.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions