Skip to content

llvm-cbe generates missing LLVMMul_uov from .ll ouput from clang++-10 (plzip-1.9 dec_stdout.c) #138

Open
@makise-homura

Description

@makise-homura

Say, we have LLVM 10.0.0, and just have built llvm-cbe in current directory.

Trying to build dec_stdout.cc from plzip-1.9 with lzlib-1.12:

wget -q http://download.savannah.gnu.org/releases/lzip/lzlib/lzlib-1.12.tar.gz
wget -q http://download.savannah.gnu.org/releases/lzip/plzip/plzip-1.9.tar.gz
tar xf plzip-1.9.tar.gz
tar xf lzlib-1.12.tar.gz
clang++-10 -S -emit-llvm -g -Iplzip-1.9 -Ilzlib-1.12 -o dec_stdout.ll plzip-1.9/dec_stdout.cc
./llvm-cbe dec_stdout.ll
gcc-10 -Wno-builtin-declaration-mismatch -Wno-address-of-packed-member -c -o dec_stdout.o dec_stdout.cbe.c

I have the following output (among the messages caused by #132) then:

dec_stdout.cbe.c: In function ‘llvm_OC_umul_OC_with_OC_overflow_OC_i64’:
dec_stdout.cbe.c:735:14: warning: implicit declaration of function ‘LLVMMul_uov’ [-Wimplicit-function-declaration]
  735 |   r.field1 = LLVMMul_uov(8 * sizeof(a), &a, &b, &r.field0);
      |              ^~~~~~~~~~~

If we grep dec_stdout.cbe.c for LLVMMul_uov, we'll find out that this function is used, but not declared:

  r.field1 = LLVMMul_uov(8 * sizeof(a), &a, &b, &r.field0);

Quick reproducer for this (newint.cc):

int main() { int a, *b = new int[a]; }

Reproduction:

clang++-10 -S -emit-llvm -g -o newint.ll newint.cc
./llvm-cbe newint.ll
gcc-10 newint.cbe.c -o newint

Clang and gcc versions:

clang version 10.0.0-4ubuntu1 Target: x86_64-pc-linux-gnu Thread model: posix
gcc-10 (Ubuntu 10.2.0-5ubuntu1~20.04) 10.2.0

Metadata

Metadata

Assignees

No one assigned

    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